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 2010/11/16 21:22:08 UTC

svn commit: r1035782 [2/29] - in /trafficserver/traffic/trunk: example/add-header/ example/append-transform/ example/basic-auth/ example/blacklist-0/ example/blacklist-1/ example/bnull-transform/ example/cache_plugin/ example/cache_scan/ example/file-1...

Modified: trafficserver/traffic/trunk/example/bnull-transform/bnull-transform.c
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/example/bnull-transform/bnull-transform.c?rev=1035782&r1=1035781&r2=1035782&view=diff
==============================================================================
--- trafficserver/traffic/trunk/example/bnull-transform/bnull-transform.c (original)
+++ trafficserver/traffic/trunk/example/bnull-transform/bnull-transform.c Tue Nov 16 20:22:02 2010
@@ -38,16 +38,16 @@
 #include <stdio.h>
 #include <ts/ts.h>
 
-#define INK_NULL_MUTEX      NULL
+#define TS_NULL_MUTEX      NULL
 #define STATE_BUFFER_DATA   0
 #define STATE_OUTPUT_DATA   1
 
 typedef struct
 {
   int state;
-  INKVIO output_vio;
-  INKIOBuffer output_buffer;
-  INKIOBufferReader output_reader;
+  TSVIO output_vio;
+  TSIOBuffer output_buffer;
+  TSIOBufferReader output_reader;
 } MyData;
 
 static MyData *
@@ -55,7 +55,7 @@ my_data_alloc()
 {
   MyData *data;
 
-  data = (MyData *) INKmalloc(sizeof(MyData));
+  data = (MyData *) TSmalloc(sizeof(MyData));
   data->state = STATE_BUFFER_DATA;
   data->output_vio = NULL;
   data->output_buffer = NULL;
@@ -69,16 +69,16 @@ my_data_destroy(MyData * data)
 {
   if (data) {
     if (data->output_buffer) {
-      INKIOBufferDestroy(data->output_buffer);
+      TSIOBufferDestroy(data->output_buffer);
     }
-    INKfree(data);
+    TSfree(data);
   }
 }
 
 static int
-handle_buffering(INKCont contp, MyData * data)
+handle_buffering(TSCont contp, MyData * data)
 {
-  INKVIO write_vio;
+  TSVIO write_vio;
   int towrite;
   int avail;
 
@@ -86,14 +86,14 @@ handle_buffering(INKCont contp, MyData *
      ourself. This VIO contains the buffer that we are to read from
      as well as the continuation we are to call when the buffer is
      empty. */
-  write_vio = INKVConnWriteVIOGet(contp);
+  write_vio = TSVConnWriteVIOGet(contp);
 
   /* Create the output buffer and its associated reader */
   if (!data->output_buffer) {
-    data->output_buffer = INKIOBufferCreate();
-    INKAssert(data->output_buffer);
-    data->output_reader = INKIOBufferReaderAlloc(data->output_buffer);
-    INKAssert(data->output_reader);
+    data->output_buffer = TSIOBufferCreate();
+    TSAssert(data->output_buffer);
+    data->output_reader = TSIOBufferReaderAlloc(data->output_buffer);
+    TSAssert(data->output_reader);
   }
 
   /* We also check to see if the write VIO's buffer is non-NULL. A
@@ -102,7 +102,7 @@ handle_buffering(INKCont contp, MyData *
      more WRITE_READY or WRITE_COMPLETE events. For this buffered
      transformation that means we're done buffering data. */
 
-  if (!INKVIOBufferGet(write_vio)) {
+  if (!TSVIOBufferGet(write_vio)) {
     data->state = STATE_OUTPUT_DATA;
     return 0;
   }
@@ -111,53 +111,53 @@ handle_buffering(INKCont contp, MyData *
      transform plugin this is also the amount of data we have left
      to write to the output connection. */
 
-  towrite = INKVIONTodoGet(write_vio);
+  towrite = TSVIONTodoGet(write_vio);
   if (towrite > 0) {
     /* The amount of data left to read needs to be truncated by
        the amount of data actually in the read buffer. */
 
-    avail = INKIOBufferReaderAvail(INKVIOReaderGet(write_vio));
+    avail = TSIOBufferReaderAvail(TSVIOReaderGet(write_vio));
     if (towrite > avail) {
       towrite = avail;
     }
 
     if (towrite > 0) {
       /* Copy the data from the read buffer to the input buffer. */
-      if (INKIOBufferCopy(data->output_buffer, INKVIOReaderGet(write_vio), towrite, 0) == INK_ERROR) {
-        INKError("[bnull-transform] Unable to copy read buffer\n");
+      if (TSIOBufferCopy(data->output_buffer, TSVIOReaderGet(write_vio), towrite, 0) == TS_ERROR) {
+        TSError("[bnull-transform] Unable to copy read buffer\n");
         goto Lerror;
       }
 
       /* Tell the read buffer that we have read the data and are no
          longer interested in it. */
-      if (INKIOBufferReaderConsume(INKVIOReaderGet(write_vio), towrite) == INK_ERROR) {
-        INKError("[bnull-transform] Unable to copy read buffer\n");
+      if (TSIOBufferReaderConsume(TSVIOReaderGet(write_vio), towrite) == TS_ERROR) {
+        TSError("[bnull-transform] Unable to copy read buffer\n");
         goto Lerror;
       }
 
       /* Modify the write VIO to reflect how much data we've
          completed. */
-      if (INKVIONDoneSet(write_vio, INKVIONDoneGet(write_vio)
-                         + towrite) == INK_ERROR) {
-        INKError("[bnull-transform] Unable to copy read buffer\n");
+      if (TSVIONDoneSet(write_vio, TSVIONDoneGet(write_vio)
+                         + towrite) == TS_ERROR) {
+        TSError("[bnull-transform] Unable to copy read buffer\n");
         goto Lerror;
       }
     }
   }
 
   /* Now we check the write VIO to see if there is data left to read. */
-  if (INKVIONTodoGet(write_vio) > 0) {
+  if (TSVIONTodoGet(write_vio) > 0) {
     if (towrite > 0) {
       /* Call back the write VIO continuation to let it know that we
          are ready for more data. */
-      INKContCall(INKVIOContGet(write_vio), INK_EVENT_VCONN_WRITE_READY, write_vio);
+      TSContCall(TSVIOContGet(write_vio), TS_EVENT_VCONN_WRITE_READY, write_vio);
     }
   } else {
     data->state = STATE_OUTPUT_DATA;
 
     /* Call back the write VIO continuation to let it know that we
        have completed the write operation. */
-    INKContCall(INKVIOContGet(write_vio), INK_EVENT_VCONN_WRITE_COMPLETE, write_vio);
+    TSContCall(TSVIOContGet(write_vio), TS_EVENT_VCONN_WRITE_COMPLETE, write_vio);
   }
 
   return 1;
@@ -165,31 +165,31 @@ handle_buffering(INKCont contp, MyData *
 Lerror:
 
   /* If we are in this code path then something is seriously wrong. */
-  INKError("[bnull-transform] Fatal error in plugin");
-  INKReleaseAssert(!"[bnull-transform] Fatal error in plugin\n");
+  TSError("[bnull-transform] Fatal error in plugin");
+  TSReleaseAssert(!"[bnull-transform] Fatal error in plugin\n");
   return 0;
 }
 
 static int
-handle_output(INKCont contp, MyData * data)
+handle_output(TSCont contp, MyData * data)
 {
   /* Check to see if we need to initiate the output operation. */
   if (!data->output_vio) {
-    INKVConn output_conn;
+    TSVConn output_conn;
 
     /* Get the output connection where we'll write data to. */
-    output_conn = INKTransformOutputVConnGet(contp);
+    output_conn = TSTransformOutputVConnGet(contp);
 
     data->output_vio =
-      INKVConnWrite(output_conn, contp, data->output_reader, INKIOBufferReaderAvail(data->output_reader));
+      TSVConnWrite(output_conn, contp, data->output_reader, TSIOBufferReaderAvail(data->output_reader));
 
-    INKAssert(data->output_vio);
+    TSAssert(data->output_vio);
   }
   return 1;
 }
 
 static void
-handle_transform(INKCont contp)
+handle_transform(TSCont contp)
 {
   MyData *data;
   int done;
@@ -199,10 +199,10 @@ handle_transform(INKCont contp)
      private data structure pointer is NULL, then we'll create it
      and initialize its internals. */
 
-  data = INKContDataGet(contp);
+  data = TSContDataGet(contp);
   if (!data) {
     data = my_data_alloc();
-    INKContDataSet(contp, data);
+    TSContDataSet(contp, data);
   }
 
   do {
@@ -221,40 +221,40 @@ handle_transform(INKCont contp)
 }
 
 static int
-bnull_transform(INKCont contp, INKEvent event, void *edata)
+bnull_transform(TSCont contp, TSEvent event, void *edata)
 {
   /* Check to see if the transformation has been closed by a
-     call to INKVConnClose. */
+     call to TSVConnClose. */
 
-  if (INKVConnClosedGet(contp)) {
-    my_data_destroy(INKContDataGet(contp));
-    INKAssert(INKContDestroy(contp) == INK_SUCCESS);
+  if (TSVConnClosedGet(contp)) {
+    my_data_destroy(TSContDataGet(contp));
+    TSAssert(TSContDestroy(contp) == TS_SUCCESS);
   } else {
     switch (event) {
-    case INK_EVENT_ERROR:{
-        INKVIO write_vio;
+    case TS_EVENT_ERROR:{
+        TSVIO write_vio;
 
         /* Get the write VIO for the write operation that was
            performed on ourself. This VIO contains the continuation of
            our parent transformation. */
-        write_vio = INKVConnWriteVIOGet(contp);
+        write_vio = TSVConnWriteVIOGet(contp);
 
         /* Call back the write VIO continuation to let it know that we
            have completed the write operation. */
-        INKContCall(INKVIOContGet(write_vio), INK_EVENT_ERROR, write_vio);
+        TSContCall(TSVIOContGet(write_vio), TS_EVENT_ERROR, write_vio);
         break;
       }
 
-    case INK_EVENT_VCONN_WRITE_COMPLETE:
+    case TS_EVENT_VCONN_WRITE_COMPLETE:
       /* When our output connection says that it has finished
          reading all the data we've written to it then we should
          shutdown the write portion of its connection to
          indicate that we don't want to hear about it anymore. */
 
-      INKAssert(INKVConnShutdown(INKTransformOutputVConnGet(contp), 0, 1) != INK_ERROR);
+      TSAssert(TSVConnShutdown(TSTransformOutputVConnGet(contp), 0, 1) != TS_ERROR);
       break;
 
-    case INK_EVENT_VCONN_WRITE_READY:
+    case TS_EVENT_VCONN_WRITE_READY:
     default:
       /* If we get a WRITE_READY event or any other type of event
          (sent, perhaps, because we were reenabled) then we'll attempt
@@ -268,52 +268,52 @@ bnull_transform(INKCont contp, INKEvent 
 }
 
 static int
-transformable(INKHttpTxn txnp)
+transformable(TSHttpTxn txnp)
 {
-  INKMBuffer bufp;
-  INKMLoc hdr_loc;
-  INKHttpStatus resp_status;
+  TSMBuffer bufp;
+  TSMLoc hdr_loc;
+  TSHttpStatus resp_status;
   int retv;
 
   /* We are only interested in transforming "200 OK" responses. */
 
-  INKHttpTxnServerRespGet(txnp, &bufp, &hdr_loc);
-  resp_status = INKHttpHdrStatusGet(bufp, hdr_loc);
-  retv = (resp_status == INK_HTTP_STATUS_OK);
+  TSHttpTxnServerRespGet(txnp, &bufp, &hdr_loc);
+  resp_status = TSHttpHdrStatusGet(bufp, hdr_loc);
+  retv = (resp_status == TS_HTTP_STATUS_OK);
 
-  if (INKHandleMLocRelease(bufp, INK_NULL_MLOC, hdr_loc) == INK_ERROR) {
-    INKError("[bnull-transform] Error releasing MLOC while checking " "header status\n");
+  if (TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc) == TS_ERROR) {
+    TSError("[bnull-transform] Error releasing MLOC while checking " "header status\n");
   }
 
   return retv;
 }
 
 static void
-transform_add(INKHttpTxn txnp)
+transform_add(TSHttpTxn txnp)
 {
-  INKVConn connp;
+  TSVConn connp;
 
-  connp = INKTransformCreate(bnull_transform, txnp);
-  if (INKHttpTxnHookAdd(txnp, INK_HTTP_RESPONSE_TRANSFORM_HOOK, connp)
-      == INK_ERROR) {
+  connp = TSTransformCreate(bnull_transform, txnp);
+  if (TSHttpTxnHookAdd(txnp, TS_HTTP_RESPONSE_TRANSFORM_HOOK, connp)
+      == TS_ERROR) {
     /* this should not happen */
-    INKError("[bnull-transform] Error adding transform to transaction\n");
+    TSError("[bnull-transform] Error adding transform to transaction\n");
   }
 
   return;
 }
 
 static int
-transform_plugin(INKCont contp, INKEvent event, void *edata)
+transform_plugin(TSCont contp, TSEvent event, void *edata)
 {
-  INKHttpTxn txnp = (INKHttpTxn) edata;
+  TSHttpTxn txnp = (TSHttpTxn) edata;
 
   switch (event) {
-  case INK_EVENT_HTTP_READ_RESPONSE_HDR:
+  case TS_EVENT_HTTP_READ_RESPONSE_HDR:
     if (transformable(txnp)) {
       transform_add(txnp);
     }
-    INKHttpTxnReenable(txnp, INK_EVENT_HTTP_CONTINUE);
+    TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE);
     return 0;
   default:
     break;
@@ -325,7 +325,7 @@ transform_plugin(INKCont contp, INKEvent
 int
 check_ts_version()
 {
-  const char *ts_version = INKTrafficServerVersionGet();
+  const char *ts_version = TSTrafficServerVersionGet();
   int result = 0;
 
   if (ts_version) {
@@ -349,35 +349,35 @@ check_ts_version()
 }
 
 void
-INKPluginInit(int argc, const char *argv[])
+TSPluginInit(int argc, const char *argv[])
 {
-  INKPluginRegistrationInfo info;
-  INKMutex mutex = INK_NULL_MUTEX;
+  TSPluginRegistrationInfo info;
+  TSMutex mutex = TS_NULL_MUTEX;
 
   info.plugin_name = "buffered-null-transform";
   info.vendor_name = "MyCompany";
   info.support_email = "ts-api-support@MyCompany.com";
 
-  if (!INKPluginRegister(INK_SDK_VERSION_2_0, &info)) {
-    INKError("[bnull-transform] Plugin registration failed.\n");
+  if (!TSPluginRegister(TS_SDK_VERSION_2_0, &info)) {
+    TSError("[bnull-transform] Plugin registration failed.\n");
     goto Lerror;
   }
 
   if (!check_ts_version()) {
-    INKError("[bnull-transform] Plugin requires Traffic Server 2.0" " or later\n");
+    TSError("[bnull-transform] Plugin requires Traffic Server 2.0" " or later\n");
     goto Lerror;
   }
 
   /* This is call we could use if we need to protect global data */
-  /* INKReleaseAssert ((mutex = INKMutexCreate()) != INK_NULL_MUTEX); */
+  /* TSReleaseAssert ((mutex = TSMutexCreate()) != TS_NULL_MUTEX); */
 
-  if (INKHttpHookAdd(INK_HTTP_READ_RESPONSE_HDR_HOOK, INKContCreate(transform_plugin, mutex)) == INK_ERROR) {
-    INKError("[bnull-transform] Unable to add READ_RESPONSE_HDR_HOOK\n");
+  if (TSHttpHookAdd(TS_HTTP_READ_RESPONSE_HDR_HOOK, TSContCreate(transform_plugin, mutex)) == TS_ERROR) {
+    TSError("[bnull-transform] Unable to add READ_RESPONSE_HDR_HOOK\n");
     goto Lerror;
   }
 
   return;
 
 Lerror:
-  INKError("[bnull-transform] Plugin disabled\n");
+  TSError("[bnull-transform] Plugin disabled\n");
 }

Modified: trafficserver/traffic/trunk/example/cache_plugin/cache_plugin.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/example/cache_plugin/cache_plugin.cc?rev=1035782&r1=1035781&r2=1035782&view=diff
==============================================================================
--- trafficserver/traffic/trunk/example/cache_plugin/cache_plugin.cc (original)
+++ trafficserver/traffic/trunk/example/cache_plugin/cache_plugin.cc Tue Nov 16 20:22:02 2010
@@ -36,14 +36,14 @@ using namespace std;
 
 
 static map<string, string> cache;
-static INKMutex cacheMutex;
+static TSMutex cacheMutex;
 
 //----------------------------------------------------------------------------
 void *
 eventLoop(void *data)
 {
   while (1) {
-    INKDebug("cache_plugin", "[eventLoop]");
+    TSDebug("cache_plugin", "[eventLoop]");
     sleep(5);
 
     for (int i = 78; i > 0; --i)
@@ -51,13 +51,13 @@ eventLoop(void *data)
     cout << endl;               // print a line
     cout << "entries in cache: " << cache.size() << endl;
 
-    if (INKMutexLock(cacheMutex) == INK_SUCCESS) {
+    if (TSMutexLock(cacheMutex) == TS_SUCCESS) {
       for (map<string, string>::const_iterator it = cache.begin(); it != cache.end(); ++it) {
         //cout << "key: " << it->first << endl;
         //<< "value:" << it->second << endl;
         cout << "key size: " << it->first.size() << endl << "value size:" << it->second.size() << endl;
       }
-      INKMutexUnlock(cacheMutex);
+      TSMutexUnlock(cacheMutex);
     }
     for (int i = 78; i > 0; --i)
       cout << "-";
@@ -70,18 +70,18 @@ eventLoop(void *data)
 
 //----------------------------------------------------------------------------
 static int
-cache_read(INKCont contp, INKEvent event, void *edata)
+cache_read(TSCont contp, TSEvent event, void *edata)
 {
-  INKDebug("cache_plugin", "[cache_read]");
+  TSDebug("cache_plugin", "[cache_read]");
 
-  INKHttpTxn txnp = (INKHttpTxn) edata;
+  TSHttpTxn txnp = (TSHttpTxn) edata;
   void *key = 0;
   int keySize = 0;
   uint64 size, offset;
 
   // get the key for the lookup
-  INKCacheKeyGet(txnp, &key, &keySize);
-  INKCacheBufferInfoGet(txnp, &size, &offset);
+  TSCacheKeyGet(txnp, &key, &keySize);
+  TSCacheBufferInfoGet(txnp, &size, &offset);
 
   // 1. get IO buffer from the NewCacehVC
   // 2. get the offset and size to read from cache, size will be less then 32KB
@@ -92,17 +92,17 @@ cache_read(INKCont contp, INKEvent event
   const void *cacheData = 0;
   uint64_t cacheSize = 0;
 
-  if (event == INK_EVENT_CACHE_LOOKUP) {
-    event = INK_EVENT_CACHE_LOOKUP_COMPLETE;
+  if (event == TS_EVENT_CACHE_LOOKUP) {
+    event = TS_EVENT_CACHE_LOOKUP_COMPLETE;
   } else {
-    event = INK_EVENT_CACHE_READ_COMPLETE;
+    event = TS_EVENT_CACHE_READ_COMPLETE;
   }
 
   if (key != 0 && keySize > 0) {
     string keyString((char *) key, keySize);
 
-    if (INKMutexLock(cacheMutex) != INK_SUCCESS) {
-      INKDebug("cache_plugin", "[cache_read] failed to acquire cache mutex");
+    if (TSMutexLock(cacheMutex) != TS_SUCCESS) {
+      TSDebug("cache_plugin", "[cache_read] failed to acquire cache mutex");
     } else {
       map<string, string>::iterator it = cache.find(keyString);
       if (it != cache.end() && size > 0 && offset < it->second.size()) {
@@ -114,35 +114,35 @@ cache_read(INKCont contp, INKEvent event
         cacheData = it->second.substr(offset, cacheSize).c_str();
 
         if (cacheSize + offset < it->second.size()) {
-          if (event == INK_EVENT_CACHE_LOOKUP_COMPLETE) {
-            event = INK_EVENT_CACHE_LOOKUP_READY;
+          if (event == TS_EVENT_CACHE_LOOKUP_COMPLETE) {
+            event = TS_EVENT_CACHE_LOOKUP_READY;
           } else {
-            event = INK_EVENT_CACHE_READ_READY;
+            event = TS_EVENT_CACHE_READ_READY;
           }
         }
       }
-      INKReturnCode rval = INKHttpCacheReenable(txnp, event, cacheData, cacheSize);
-      INKMutexUnlock(cacheMutex);
+      TSReturnCode rval = TSHttpCacheReenable(txnp, event, cacheData, cacheSize);
+      TSMutexUnlock(cacheMutex);
       return rval;
     }
   }
 
-  return INKHttpCacheReenable(txnp, event, cacheData, cacheSize);
+  return TSHttpCacheReenable(txnp, event, cacheData, cacheSize);
 }
 
 
 //----------------------------------------------------------------------------
 static int
-cache_write(INKCont contp, INKEvent event, void *edata)
+cache_write(TSCont contp, TSEvent event, void *edata)
 {
-  INKDebug("cache_plugin", "[cache_write]");
+  TSDebug("cache_plugin", "[cache_write]");
 
-  INKHttpTxn txnp = (INKHttpTxn) edata;
+  TSHttpTxn txnp = (TSHttpTxn) edata;
 
   // get the key for the data
   void *key;
   int keySize;
-  INKCacheKeyGet(txnp, &key, &keySize);
+  TSCacheKeyGet(txnp, &key, &keySize);
 
   uint64_t cacheSize = 0;
 
@@ -151,23 +151,23 @@ cache_write(INKCont contp, INKEvent even
   // 3. use the existing InkAPI to read the io buffer and write into cache
 
   // get the buffer to write into cache and get the start of the buffer
-  INKIOBufferReader buffer = INKCacheBufferReaderGet(txnp);
-  INKIOBufferBlock block = INKIOBufferReaderStart(buffer);
-  int64 available = INKIOBufferReaderAvail(buffer);
+  TSIOBufferReader buffer = TSCacheBufferReaderGet(txnp);
+  TSIOBufferBlock block = TSIOBufferReaderStart(buffer);
+  int64 available = TSIOBufferReaderAvail(buffer);
 
   string keyString((char *) key, keySize);
 
   // read from cache
 
-  if (INKMutexLock(cacheMutex) != INK_SUCCESS) {
-    INKDebug("cache_plugin", "[cache_write] failed to acquire cache mutex");
+  if (TSMutexLock(cacheMutex) != TS_SUCCESS) {
+    TSDebug("cache_plugin", "[cache_write] failed to acquire cache mutex");
   } else {
-    INKDebug("cache_plugin", "[cache_write] writting to cache");
+    TSDebug("cache_plugin", "[cache_write] writting to cache");
     map<string, string>::iterator it = cache.find(keyString);
     if (it == cache.end()) {
       cache.insert(make_pair(keyString, string("")));
       it = cache.find(keyString);
-    } else if (event == INK_EVENT_CACHE_WRITE_HEADER) {
+    } else if (event == TS_EVENT_CACHE_WRITE_HEADER) {
       //don't append headers
       it->second.erase();
     }
@@ -175,39 +175,39 @@ cache_write(INKCont contp, INKEvent even
     if (available > 0) {
       int64 ndone = 0;
       do {
-        const char *data = INKIOBufferBlockReadStart(block, buffer, &available);
+        const char *data = TSIOBufferBlockReadStart(block, buffer, &available);
 
         // append the buffer block to the string
         if (data != NULL) {
           it->second.append(data, available);
         }
         ndone += available;
-      } while ((block = INKIOBufferBlockNext(block)) != NULL);
+      } while ((block = TSIOBufferBlockNext(block)) != NULL);
 
-      INKIOBufferReaderConsume(buffer, ndone);
+      TSIOBufferReaderConsume(buffer, ndone);
     }
     cacheSize = it->second.size();
-    INKMutexUnlock(cacheMutex);
+    TSMutexUnlock(cacheMutex);
   }
 
-  return INKHttpCacheReenable(txnp, event, 0, cacheSize);
+  return TSHttpCacheReenable(txnp, event, 0, cacheSize);
 }
 
 
 //----------------------------------------------------------------------------
 static int
-cache_remove(INKCont contp, INKEvent event, void *edata)
+cache_remove(TSCont contp, TSEvent event, void *edata)
 {
-  INKHttpTxn txnp = (INKHttpTxn) edata;
-  INKDebug("cache_plugin", "[cache_remove]");
+  TSHttpTxn txnp = (TSHttpTxn) edata;
+  TSDebug("cache_plugin", "[cache_remove]");
 
   // get the key for the data
   void *key;
   int keySize;
-  INKCacheKeyGet(txnp, &key, &keySize);
+  TSCacheKeyGet(txnp, &key, &keySize);
 
-  if (INKMutexLock(cacheMutex) != INK_SUCCESS) {
-    INKDebug("cache_plugin", "[cache_remove] failed to acquire cache mutex");
+  if (TSMutexLock(cacheMutex) != TS_SUCCESS) {
+    TSDebug("cache_plugin", "[cache_remove] failed to acquire cache mutex");
   } else {
     // find the entry in cache
     string keyString((char *) key, keySize);
@@ -217,46 +217,46 @@ cache_remove(INKCont contp, INKEvent eve
     if (it != cache.end()) {
       cache.erase(it);
     } else {
-      INKDebug("cache_plugin", "trying to remove a entry from cache that doesn't exist");
+      TSDebug("cache_plugin", "trying to remove a entry from cache that doesn't exist");
     }
-    INKMutexUnlock(cacheMutex);
+    TSMutexUnlock(cacheMutex);
   }
 
-  return INKHttpCacheReenable(txnp, event, 0, 0);
+  return TSHttpCacheReenable(txnp, event, 0, 0);
 }
 
 
 //----------------------------------------------------------------------------
 static int
-cache_plugin(INKCont contp, INKEvent event, void *edata)
+cache_plugin(TSCont contp, TSEvent event, void *edata)
 {
 
-  INKHttpTxn txnp = (INKHttpTxn) edata;
+  TSHttpTxn txnp = (TSHttpTxn) edata;
 
   switch (event) {
     // read events
-  case INK_EVENT_CACHE_LOOKUP:
-  case INK_EVENT_CACHE_READ:
+  case TS_EVENT_CACHE_LOOKUP:
+  case TS_EVENT_CACHE_READ:
     return cache_read(contp, event, edata);
     break;
 
     // write events
-  case INK_EVENT_CACHE_WRITE:
-  case INK_EVENT_CACHE_WRITE_HEADER:
+  case TS_EVENT_CACHE_WRITE:
+  case TS_EVENT_CACHE_WRITE_HEADER:
     return cache_write(contp, event, edata);
     break;
 
     // delete events
-  case INK_EVENT_CACHE_DELETE:
+  case TS_EVENT_CACHE_DELETE:
     return cache_remove(contp, event, edata);
     break;
 
-  case INK_EVENT_CACHE_CLOSE:
-    return INKHttpCacheReenable(txnp, event, 0, 0);
+  case TS_EVENT_CACHE_CLOSE:
+    return TSHttpCacheReenable(txnp, event, 0, 0);
     break;
 
   default:
-    INKDebug("cache_plugin", "ERROR: unknown event");
+    TSDebug("cache_plugin", "ERROR: unknown event");
     return 0;
   }
 }
@@ -264,21 +264,21 @@ cache_plugin(INKCont contp, INKEvent eve
 
 //----------------------------------------------------------------------------
 void
-INKPluginInit(const int argc, const char **argv)
+TSPluginInit(const int argc, const char **argv)
 {
-  INKPluginRegistrationInfo info;
+  TSPluginRegistrationInfo info;
 
-  INKDebug("cache_plugin", "[INKPluginInit] Starting cache plugin");
+  TSDebug("cache_plugin", "[TSPluginInit] Starting cache plugin");
 
   info.plugin_name = (char *) "cache_plugin";
   info.vendor_name = (char *) "ASF";
   info.support_email = (char *) "";
 
-  cacheMutex = INKMutexCreate();
+  cacheMutex = TSMutexCreate();
 
-  INKCont continuation_plugin = INKContCreate(cache_plugin, INKMutexCreate());
+  TSCont continuation_plugin = TSContCreate(cache_plugin, TSMutexCreate());
 
-  INKCacheHookAdd(INK_CACHE_PLUGIN_HOOK, continuation_plugin);
+  TSCacheHookAdd(TS_CACHE_PLUGIN_HOOK, continuation_plugin);
 
-  //cacheThread = INKThreadCreate(eventLoop, 0);
+  //cacheThread = TSThreadCreate(eventLoop, 0);
 }

Modified: trafficserver/traffic/trunk/example/cache_scan/cache_scan.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/example/cache_scan/cache_scan.cc?rev=1035782&r1=1035781&r2=1035782&view=diff
==============================================================================
--- trafficserver/traffic/trunk/example/cache_scan/cache_scan.cc (original)
+++ trafficserver/traffic/trunk/example/cache_scan/cache_scan.cc Tue Nov 16 20:22:02 2010
@@ -22,7 +22,7 @@
  */
 
 /*
- * cache_scan.cc:  use INKCacheScan to print URLs and headers for objects in
+ * cache_scan.cc:  use TSCacheScan to print URLs and headers for objects in
  *                 the cache when endpoint /show-cache is requested
  */
 
@@ -33,22 +33,22 @@
 #include <ts/ts.h>
 #include <ts/experimental.h>
 
-static INKCont global_contp;
+static TSCont global_contp;
 
 struct cache_scan_state_t
 {
-  INKVConn net_vc;
-  INKVConn cache_vc;
-  INKVIO read_vio;
-  INKVIO write_vio;
-
-  INKIOBuffer req_buffer;
-  INKIOBuffer resp_buffer;
-  INKIOBufferReader resp_reader;
-
-  INKHttpTxn http_txnp;
-  INKAction pending_action;
-  INKCacheKey key_to_delete;
+  TSVConn net_vc;
+  TSVConn cache_vc;
+  TSVIO read_vio;
+  TSVIO write_vio;
+
+  TSIOBuffer req_buffer;
+  TSIOBuffer resp_buffer;
+  TSIOBufferReader resp_reader;
+
+  TSHttpTxn http_txnp;
+  TSAction pending_action;
+  TSCacheKey key_to_delete;
 
   int64 total_bytes;
   int total_items;
@@ -62,103 +62,103 @@ typedef struct cache_scan_state_t cache_
 
 //----------------------------------------------------------------------------
 static int
-handle_scan(INKCont contp, INKEvent event, void *edata)
+handle_scan(TSCont contp, TSEvent event, void *edata)
 {
-  INKCacheHttpInfo cache_infop;
-  cache_scan_state *cstate = (cache_scan_state *) INKContDataGet(contp);
+  TSCacheHttpInfo cache_infop;
+  cache_scan_state *cstate = (cache_scan_state *) TSContDataGet(contp);
 
-  if (event == INK_EVENT_CACHE_REMOVE) {
+  if (event == TS_EVENT_CACHE_REMOVE) {
     cstate->done = 1;
     const char error[] = "Cache remove operation succeeded";
-    cstate->cache_vc = (INKVConn) edata;
-    cstate->write_vio = INKVConnWrite(cstate->net_vc, contp, cstate->resp_reader, INT_MAX);
-    cstate->total_bytes += INKIOBufferWrite(cstate->resp_buffer, error, sizeof(error) - 1);
-    INKVIONBytesSet(cstate->write_vio, cstate->total_bytes);
-    INKVIOReenable(cstate->write_vio);
+    cstate->cache_vc = (TSVConn) edata;
+    cstate->write_vio = TSVConnWrite(cstate->net_vc, contp, cstate->resp_reader, INT_MAX);
+    cstate->total_bytes += TSIOBufferWrite(cstate->resp_buffer, error, sizeof(error) - 1);
+    TSVIONBytesSet(cstate->write_vio, cstate->total_bytes);
+    TSVIOReenable(cstate->write_vio);
     return 0;
   }
 
-  if (event == INK_EVENT_CACHE_REMOVE_FAILED) {
+  if (event == TS_EVENT_CACHE_REMOVE_FAILED) {
     cstate->done = 1;
     const char error[] = "Cache remove operation failed error=";
     char rc[12];
     snprintf(rc, 12, "%p", edata);
-    cstate->cache_vc = (INKVConn) edata;
-    cstate->write_vio = INKVConnWrite(cstate->net_vc, contp, cstate->resp_reader, INT_MAX);
-    cstate->total_bytes += INKIOBufferWrite(cstate->resp_buffer, error, sizeof(error) - 1);
-    cstate->total_bytes += INKIOBufferWrite(cstate->resp_buffer, rc, strlen(rc));
+    cstate->cache_vc = (TSVConn) edata;
+    cstate->write_vio = TSVConnWrite(cstate->net_vc, contp, cstate->resp_reader, INT_MAX);
+    cstate->total_bytes += TSIOBufferWrite(cstate->resp_buffer, error, sizeof(error) - 1);
+    cstate->total_bytes += TSIOBufferWrite(cstate->resp_buffer, rc, strlen(rc));
 
-    INKVIONBytesSet(cstate->write_vio, cstate->total_bytes);
-    INKVIOReenable(cstate->write_vio);
+    TSVIONBytesSet(cstate->write_vio, cstate->total_bytes);
+    TSVIOReenable(cstate->write_vio);
     return 0;
   }
 
   //first scan event, save vc and start write
-  if (event == INK_EVENT_CACHE_SCAN) {
-    cstate->cache_vc = (INKVConn) edata;
-    cstate->write_vio = INKVConnWrite(cstate->net_vc, contp, cstate->resp_reader, INT_MAX);
-    return INK_EVENT_CONTINUE;
+  if (event == TS_EVENT_CACHE_SCAN) {
+    cstate->cache_vc = (TSVConn) edata;
+    cstate->write_vio = TSVConnWrite(cstate->net_vc, contp, cstate->resp_reader, INT_MAX);
+    return TS_EVENT_CONTINUE;
   }
   //just stop scanning if blocked or failed
-  if (event == INK_EVENT_CACHE_SCAN_FAILED ||
-      event == INK_EVENT_CACHE_SCAN_OPERATION_BLOCKED || event == INK_EVENT_CACHE_SCAN_OPERATION_FAILED) {
+  if (event == TS_EVENT_CACHE_SCAN_FAILED ||
+      event == TS_EVENT_CACHE_SCAN_OPERATION_BLOCKED || event == TS_EVENT_CACHE_SCAN_OPERATION_FAILED) {
     cstate->done = 1;
     if (cstate->resp_buffer) {
       const char error[] = "Cache scan operation blocked or failed";
-      cstate->total_bytes += INKIOBufferWrite(cstate->resp_buffer, error, sizeof(error) - 1);
+      cstate->total_bytes += TSIOBufferWrite(cstate->resp_buffer, error, sizeof(error) - 1);
     }
     if (cstate->write_vio) {
-      INKVIONBytesSet(cstate->write_vio, cstate->total_bytes);
-      INKVIOReenable(cstate->write_vio);
+      TSVIONBytesSet(cstate->write_vio, cstate->total_bytes);
+      TSVIOReenable(cstate->write_vio);
     }
-    return INK_CACHE_SCAN_RESULT_DONE;
+    return TS_CACHE_SCAN_RESULT_DONE;
   }
 
   //grab header and print url to outgoing vio
-  if (event == INK_EVENT_CACHE_SCAN_OBJECT) {
+  if (event == TS_EVENT_CACHE_SCAN_OBJECT) {
     if (cstate->done) {
-      return INK_CACHE_SCAN_RESULT_DONE;
+      return TS_CACHE_SCAN_RESULT_DONE;
     }
-    cache_infop = (INKCacheHttpInfo) edata;
+    cache_infop = (TSCacheHttpInfo) edata;
 
-    INKMBuffer req_bufp, resp_bufp;
-    INKMLoc req_hdr_loc, resp_hdr_loc;
-    INKMLoc url_loc;
+    TSMBuffer req_bufp, resp_bufp;
+    TSMLoc req_hdr_loc, resp_hdr_loc;
+    TSMLoc url_loc;
 
     char *url;
     int url_len;
     const char s1[] = "URL: ", s2[] = "\n";
-    cstate->total_bytes += INKIOBufferWrite(cstate->resp_buffer, s1, sizeof(s1) - 1);
-    INKCacheHttpInfoReqGet(cache_infop, &req_bufp, &req_hdr_loc);
-    url_loc = INKHttpHdrUrlGet(req_bufp, req_hdr_loc);
-    url = INKUrlStringGet(req_bufp, url_loc, &url_len);
-
-    cstate->total_bytes += INKIOBufferWrite(cstate->resp_buffer, url, url_len);
-    cstate->total_bytes += INKIOBufferWrite(cstate->resp_buffer, s2, sizeof(s2) - 1);
-
-    INKfree(url);
-    INKHandleMLocRelease(req_bufp, req_hdr_loc, url_loc);
-    INKHandleMLocRelease(req_bufp, INK_NULL_MLOC, req_hdr_loc);
+    cstate->total_bytes += TSIOBufferWrite(cstate->resp_buffer, s1, sizeof(s1) - 1);
+    TSCacheHttpInfoReqGet(cache_infop, &req_bufp, &req_hdr_loc);
+    url_loc = TSHttpHdrUrlGet(req_bufp, req_hdr_loc);
+    url = TSUrlStringGet(req_bufp, url_loc, &url_len);
+
+    cstate->total_bytes += TSIOBufferWrite(cstate->resp_buffer, url, url_len);
+    cstate->total_bytes += TSIOBufferWrite(cstate->resp_buffer, s2, sizeof(s2) - 1);
+
+    TSfree(url);
+    TSHandleMLocRelease(req_bufp, req_hdr_loc, url_loc);
+    TSHandleMLocRelease(req_bufp, TS_NULL_MLOC, req_hdr_loc);
 
 
     //print the response headers
-    INKCacheHttpInfoRespGet(cache_infop, &resp_bufp, &resp_hdr_loc);
-    cstate->total_bytes += INKMimeHdrLengthGet(resp_bufp, resp_hdr_loc);
-    INKMimeHdrPrint(resp_bufp, resp_hdr_loc, cstate->resp_buffer);
-    INKHandleMLocRelease(resp_bufp, INK_NULL_MLOC, resp_hdr_loc);
+    TSCacheHttpInfoRespGet(cache_infop, &resp_bufp, &resp_hdr_loc);
+    cstate->total_bytes += TSMimeHdrLengthGet(resp_bufp, resp_hdr_loc);
+    TSMimeHdrPrint(resp_bufp, resp_hdr_loc, cstate->resp_buffer);
+    TSHandleMLocRelease(resp_bufp, TS_NULL_MLOC, resp_hdr_loc);
 
 
-    cstate->total_bytes += INKIOBufferWrite(cstate->resp_buffer, s2, sizeof(s2) - 1);
+    cstate->total_bytes += TSIOBufferWrite(cstate->resp_buffer, s2, sizeof(s2) - 1);
     if (!cstate->write_pending) {
       cstate->write_pending = 1;
-      INKVIOReenable(cstate->write_vio);
+      TSVIOReenable(cstate->write_vio);
     }
 
     cstate->total_items++;
-    return INK_CACHE_SCAN_RESULT_CONTINUE;
+    return TS_CACHE_SCAN_RESULT_CONTINUE;
   }
   //CACHE_SCAN_DONE: ready to close the vc on the next write reenable
-  if (event == INK_EVENT_CACHE_SCAN_DONE) {
+  if (event == TS_EVENT_CACHE_SCAN_DONE) {
     cstate->done = 1;
     char s[512];
     int s_len = snprintf(s, sizeof(s),
@@ -167,45 +167,45 @@ handle_scan(INKCont contp, INKEvent even
                          "Enter URL to delete: <input type=\"text\" size=\"40\" name=\"remove_url\">"
                          "<input type=\"submit\"  value=\"Delete URL\">",
                          cstate->total_items);
-    cstate->total_bytes += INKIOBufferWrite(cstate->resp_buffer, s, s_len);
-    INKVIONBytesSet(cstate->write_vio, cstate->total_bytes);
+    cstate->total_bytes += TSIOBufferWrite(cstate->resp_buffer, s, s_len);
+    TSVIONBytesSet(cstate->write_vio, cstate->total_bytes);
     if (!cstate->write_pending) {
       cstate->write_pending = 1;
-      INKVIOReenable(cstate->write_vio);
+      TSVIOReenable(cstate->write_vio);
     }
-    return INK_CACHE_SCAN_RESULT_DONE;
+    return TS_CACHE_SCAN_RESULT_DONE;
   }
 
-  INKError("Unknown event in handle_scan: %d", event);
+  TSError("Unknown event in handle_scan: %d", event);
   return -1;
 }
 
 //----------------------------------------------------------------------------
 static int
-handle_accept(INKCont contp, INKEvent event, INKVConn vc)
+handle_accept(TSCont contp, TSEvent event, TSVConn vc)
 {
-  cache_scan_state *cstate = (cache_scan_state *) INKContDataGet(contp);
+  cache_scan_state *cstate = (cache_scan_state *) TSContDataGet(contp);
 
-  if (event == INK_EVENT_NET_ACCEPT) {
+  if (event == TS_EVENT_NET_ACCEPT) {
     if (cstate) {
       //setup vc, buffers
       cstate->net_vc = vc;
 
-      cstate->req_buffer = INKIOBufferCreate();
-      cstate->resp_buffer = INKIOBufferCreate();
-      cstate->resp_reader = INKIOBufferReaderAlloc(cstate->resp_buffer);
+      cstate->req_buffer = TSIOBufferCreate();
+      cstate->resp_buffer = TSIOBufferCreate();
+      cstate->resp_reader = TSIOBufferReaderAlloc(cstate->resp_buffer);
 
-      cstate->read_vio = INKVConnRead(cstate->net_vc, contp, cstate->req_buffer, INT_MAX);
+      cstate->read_vio = TSVConnRead(cstate->net_vc, contp, cstate->req_buffer, INT_MAX);
     } else {
-      INKVConnClose(vc);
-      INKContDestroy(contp);
+      TSVConnClose(vc);
+      TSContDestroy(contp);
     }
   } else {
     //net_accept failed
     if (cstate) {
-      INKfree(cstate);
+      TSfree(cstate);
     }
-    INKContDestroy(contp);
+    TSContDestroy(contp);
   }
 
   return 0;
@@ -213,95 +213,95 @@ handle_accept(INKCont contp, INKEvent ev
 
 //----------------------------------------------------------------------------
 static void
-cleanup(INKCont contp)
+cleanup(TSCont contp)
 {
 
   //shutdown vc and free memory
-  cache_scan_state *cstate = (cache_scan_state *) INKContDataGet(contp);
+  cache_scan_state *cstate = (cache_scan_state *) TSContDataGet(contp);
 
   if (cstate) {
     // cancel any pending cache scan actions, since we will be destroying the
     // continuation
     if (cstate->pending_action) {
-      INKActionCancel(cstate->pending_action);
+      TSActionCancel(cstate->pending_action);
     }
 
     if (cstate->net_vc) {
-      INKVConnShutdown(cstate->net_vc, 1, 1);
+      TSVConnShutdown(cstate->net_vc, 1, 1);
     }
 
     if (cstate->req_buffer) {
-      if (INKIOBufferDestroy(cstate->req_buffer) == INK_ERROR) {
-        INKError("failed to destroy req_buffer");
+      if (TSIOBufferDestroy(cstate->req_buffer) == TS_ERROR) {
+        TSError("failed to destroy req_buffer");
       }
       cstate->req_buffer = NULL;
     }
 
     if (cstate->key_to_delete) {
-      if (INKCacheKeyDestroy(cstate->key_to_delete) == INK_ERROR) {
-        INKError("failed to destroy cache key");
+      if (TSCacheKeyDestroy(cstate->key_to_delete) == TS_ERROR) {
+        TSError("failed to destroy cache key");
       }
       cstate->key_to_delete = NULL;
     }
 
     if (cstate->resp_buffer) {
-      if (INKIOBufferDestroy(cstate->resp_buffer) == INK_ERROR) {
-        INKError("failed to destroy resp_buffer");
+      if (TSIOBufferDestroy(cstate->resp_buffer) == TS_ERROR) {
+        TSError("failed to destroy resp_buffer");
       }
       cstate->resp_buffer = NULL;
     }
 
-    if (INKVConnClose(cstate->net_vc) == INK_ERROR) {
-      INKError("INKVConnClose failed");
+    if (TSVConnClose(cstate->net_vc) == TS_ERROR) {
+      TSError("TSVConnClose failed");
     }
 
-    INKfree(cstate);
+    TSfree(cstate);
   }
-  INKContDestroy(contp);
+  TSContDestroy(contp);
 }
 
 //----------------------------------------------------------------------------
 static int
-handle_io(INKCont contp, INKEvent event, void *edata)
+handle_io(TSCont contp, TSEvent event, void *edata)
 {
-  cache_scan_state *cstate = (cache_scan_state *) INKContDataGet(contp);
+  cache_scan_state *cstate = (cache_scan_state *) TSContDataGet(contp);
 
   switch (event) {
-  case INK_EVENT_VCONN_READ_READY:
-  case INK_EVENT_VCONN_READ_COMPLETE:
+  case TS_EVENT_VCONN_READ_READY:
+  case TS_EVENT_VCONN_READ_COMPLETE:
     {
       //we don't care about the request, so just shut down the read vc
-      if (INKVConnShutdown(cstate->net_vc, 1, 0) == INK_ERROR) {
-        INKError("INKVConnShutdown failed");
+      if (TSVConnShutdown(cstate->net_vc, 1, 0) == TS_ERROR) {
+        TSError("TSVConnShutdown failed");
         cleanup(contp);
         return 0;
       }
       //setup the response headers so we are ready to write body
       char hdrs[] = "HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n";
-      cstate->total_bytes = INKIOBufferWrite(cstate->resp_buffer, hdrs, sizeof(hdrs) - 1);
+      cstate->total_bytes = TSIOBufferWrite(cstate->resp_buffer, hdrs, sizeof(hdrs) - 1);
 
       if (cstate->key_to_delete) {
-        INKAction actionp = INKCacheRemove(contp, cstate->key_to_delete);
-        if (actionp != INK_ERROR_PTR) {
-          if (!INKActionDone(actionp)) {
+        TSAction actionp = TSCacheRemove(contp, cstate->key_to_delete);
+        if (actionp != TS_ERROR_PTR) {
+          if (!TSActionDone(actionp)) {
             cstate->pending_action = actionp;
           }
         } else {
-          INKError("CacheRemove action failed");
+          TSError("CacheRemove action failed");
           cleanup(contp);
           return 0;
         }
       } else {
         char head[] = "<h3>Cache Contents:</h3>\n<p><pre>\n";
-        cstate->total_bytes += INKIOBufferWrite(cstate->resp_buffer, head, sizeof(head) - 1);
+        cstate->total_bytes += TSIOBufferWrite(cstate->resp_buffer, head, sizeof(head) - 1);
         //start scan
-        INKAction actionp = INKCacheScan(contp, 0, 512000);
-        if (actionp != INK_ERROR_PTR) {
-          if (!INKActionDone(actionp)) {
+        TSAction actionp = TSCacheScan(contp, 0, 512000);
+        if (actionp != TS_ERROR_PTR) {
+          if (!TSActionDone(actionp)) {
             cstate->pending_action = actionp;
           }
         } else {
-          INKError("CacheScan action failed");
+          TSError("CacheScan action failed");
           cleanup(contp);
           return 0;
         }
@@ -309,18 +309,18 @@ handle_io(INKCont contp, INKEvent event,
 
       return 0;
     }
-  case INK_EVENT_VCONN_WRITE_READY:
+  case TS_EVENT_VCONN_WRITE_READY:
     {
-      INKDebug("cache_iter", "ndone: %d total_bytes: %d", INKVIONDoneGet(cstate->write_vio), cstate->total_bytes);
+      TSDebug("cache_iter", "ndone: %d total_bytes: %d", TSVIONDoneGet(cstate->write_vio), cstate->total_bytes);
       cstate->write_pending = 0;
       // the cache scan handler should call vio reenable when there is
       // available data
-      //INKVIOReenable(cstate->write_vio);
+      //TSVIOReenable(cstate->write_vio);
       return 0;
     }
-  case INK_EVENT_VCONN_WRITE_COMPLETE:
-    INKDebug("cache_iter", "write complete");
-  case INK_EVENT_VCONN_EOS:
+  case TS_EVENT_VCONN_WRITE_COMPLETE:
+    TSDebug("cache_iter", "write complete");
+  case TS_EVENT_VCONN_EOS:
   default:
     cstate->done = 1;
     cleanup(contp);
@@ -333,34 +333,34 @@ handle_io(INKCont contp, INKEvent event,
 //----------------------------------------------------------------------------
 // handler for VConnection and CacheScan events
 static int
-cache_intercept(INKCont contp, INKEvent event, void *edata)
+cache_intercept(TSCont contp, TSEvent event, void *edata)
 {
-  INKDebug("cache_iter", "cache_intercept event: %d", event);
+  TSDebug("cache_iter", "cache_intercept event: %d", event);
 
   switch (event) {
-  case INK_EVENT_NET_ACCEPT:
-  case INK_EVENT_NET_ACCEPT_FAILED:
-    return handle_accept(contp, event, (INKVConn) edata);
-  case INK_EVENT_VCONN_READ_READY:
-  case INK_EVENT_VCONN_READ_COMPLETE:
-  case INK_EVENT_VCONN_WRITE_READY:
-  case INK_EVENT_VCONN_WRITE_COMPLETE:
-  case INK_EVENT_VCONN_EOS:
+  case TS_EVENT_NET_ACCEPT:
+  case TS_EVENT_NET_ACCEPT_FAILED:
+    return handle_accept(contp, event, (TSVConn) edata);
+  case TS_EVENT_VCONN_READ_READY:
+  case TS_EVENT_VCONN_READ_COMPLETE:
+  case TS_EVENT_VCONN_WRITE_READY:
+  case TS_EVENT_VCONN_WRITE_COMPLETE:
+  case TS_EVENT_VCONN_EOS:
     return handle_io(contp, event, edata);
-  case INK_EVENT_CACHE_SCAN:
-  case INK_EVENT_CACHE_SCAN_FAILED:
-  case INK_EVENT_CACHE_SCAN_OBJECT:
-  case INK_EVENT_CACHE_SCAN_OPERATION_BLOCKED:
-  case INK_EVENT_CACHE_SCAN_OPERATION_FAILED:
-  case INK_EVENT_CACHE_SCAN_DONE:
-  case INK_EVENT_CACHE_REMOVE:
-  case INK_EVENT_CACHE_REMOVE_FAILED:
+  case TS_EVENT_CACHE_SCAN:
+  case TS_EVENT_CACHE_SCAN_FAILED:
+  case TS_EVENT_CACHE_SCAN_OBJECT:
+  case TS_EVENT_CACHE_SCAN_OPERATION_BLOCKED:
+  case TS_EVENT_CACHE_SCAN_OPERATION_FAILED:
+  case TS_EVENT_CACHE_SCAN_DONE:
+  case TS_EVENT_CACHE_REMOVE:
+  case TS_EVENT_CACHE_REMOVE_FAILED:
     return handle_scan(contp, event, edata);
-  case INK_EVENT_ERROR:
+  case TS_EVENT_ERROR:
     cleanup(contp);
     return 0;
   default:
-    INKError("Unknown event in cache_intercept: %d", event);
+    TSError("Unknown event in cache_intercept: %d", event);
     cleanup(contp);
     return 0;
   }
@@ -404,50 +404,50 @@ unescapifyStr(char *buffer)
 
 //----------------------------------------------------------------------------
 static int
-setup_request(INKCont contp, INKHttpTxn txnp)
+setup_request(TSCont contp, TSHttpTxn txnp)
 {
 
-  INKMBuffer bufp;
-  INKMLoc hdr_loc;
-  INKMLoc url_loc;
-  INKCont scan_contp;
+  TSMBuffer bufp;
+  TSMLoc hdr_loc;
+  TSMLoc url_loc;
+  TSCont scan_contp;
   const char *path, *query;
   cache_scan_state *cstate;
   int path_len, query_len;
 
-  INKAssert(contp == global_contp);
+  TSAssert(contp == global_contp);
 
-  if (!INKHttpTxnClientReqGet(txnp, &bufp, &hdr_loc)) {
-    INKError("couldn't retrieve client request header");
-    return INKHttpTxnReenable(txnp, INK_EVENT_HTTP_CONTINUE);
+  if (!TSHttpTxnClientReqGet(txnp, &bufp, &hdr_loc)) {
+    TSError("couldn't retrieve client request header");
+    return TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE);
   }
 
-  url_loc = INKHttpHdrUrlGet(bufp, hdr_loc);
+  url_loc = TSHttpHdrUrlGet(bufp, hdr_loc);
   if (!url_loc) {
-    INKError("couldn't retrieve request url");
-    INKHandleMLocRelease(bufp, INK_NULL_MLOC, hdr_loc);
-    return INKHttpTxnReenable(txnp, INK_EVENT_HTTP_CONTINUE);
+    TSError("couldn't retrieve request url");
+    TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc);
+    return TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE);
   }
 
-  path = INKUrlPathGet(bufp, url_loc, &path_len);
+  path = TSUrlPathGet(bufp, url_loc, &path_len);
   if (!path) {
-    INKError("couldn't retrieve request path");
-    INKHandleMLocRelease(bufp, hdr_loc, url_loc);
-    INKHandleMLocRelease(bufp, INK_NULL_MLOC, hdr_loc);
-    return INKHttpTxnReenable(txnp, INK_EVENT_HTTP_CONTINUE);
+    TSError("couldn't retrieve request path");
+    TSHandleMLocRelease(bufp, hdr_loc, url_loc);
+    TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc);
+    return TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE);
   }
 
-  query = INKUrlHttpQueryGet(bufp, url_loc, &query_len);
+  query = TSUrlHttpQueryGet(bufp, url_loc, &query_len);
 
   if (path_len == 10 && !strncmp(path, "show-cache", 10)) {
 
-    scan_contp = INKContCreate(cache_intercept, INKMutexCreate());
-    if (INKHttpTxnIntercept(scan_contp, txnp) != INK_SUCCESS) {
-      INKError("HttpTxnIntercept failed");
-      INKContDestroy(scan_contp);
+    scan_contp = TSContCreate(cache_intercept, TSMutexCreate());
+    if (TSHttpTxnIntercept(scan_contp, txnp) != TS_SUCCESS) {
+      TSError("HttpTxnIntercept failed");
+      TSContDestroy(scan_contp);
       goto Ldone;
     }
-    cstate = (cache_scan_state *) INKmalloc(sizeof(cache_scan_state));
+    cstate = (cache_scan_state *) TSmalloc(sizeof(cache_scan_state));
     memset(cstate, 0, sizeof(cache_scan_state));
     cstate->http_txnp = txnp;
 
@@ -468,69 +468,69 @@ setup_request(INKCont contp, INKHttpTxn 
         del_url_len = strlen(start);
         end = start + del_url_len;
 
-        if (INKCacheKeyCreate(&cstate->key_to_delete) != INK_SUCCESS) {
-          INKError("CacheKeyCreate failed");
-          INKfree(cstate);
+        if (TSCacheKeyCreate(&cstate->key_to_delete) != TS_SUCCESS) {
+          TSError("CacheKeyCreate failed");
+          TSfree(cstate);
           goto Ldone;
         }
 
-        INKDebug("cache_iter", "deleting url: %s", start);
+        TSDebug("cache_iter", "deleting url: %s", start);
 
-        INKMBuffer urlBuf = INKMBufferCreate();
-        INKMLoc urlLoc = INKUrlCreate(urlBuf);
+        TSMBuffer urlBuf = TSMBufferCreate();
+        TSMLoc urlLoc = TSUrlCreate(urlBuf);
 
-        if (INKUrlParse(urlBuf, urlLoc, (const char **) &start, end) != INK_PARSE_DONE
-            || INKCacheKeyDigestFromUrlSet(cstate->key_to_delete, urlLoc)
-            != INK_SUCCESS) {
-          INKError("CacheKeyDigestFromUrlSet failed");
-          INKfree(cstate);
-          INKUrlDestroy(urlBuf, urlLoc);
-          INKHandleMLocRelease(urlBuf, NULL, urlLoc);
-          INKCacheKeyDestroy(cstate->key_to_delete);
+        if (TSUrlParse(urlBuf, urlLoc, (const char **) &start, end) != TS_PARSE_DONE
+            || TSCacheKeyDigestFromUrlSet(cstate->key_to_delete, urlLoc)
+            != TS_SUCCESS) {
+          TSError("CacheKeyDigestFromUrlSet failed");
+          TSfree(cstate);
+          TSUrlDestroy(urlBuf, urlLoc);
+          TSHandleMLocRelease(urlBuf, NULL, urlLoc);
+          TSCacheKeyDestroy(cstate->key_to_delete);
           goto Ldone;
         }
-        INKUrlDestroy(urlBuf, urlLoc);
-        INKHandleMLocRelease(urlBuf, NULL, urlLoc);
+        TSUrlDestroy(urlBuf, urlLoc);
+        TSHandleMLocRelease(urlBuf, NULL, urlLoc);
       }
     }
 
-    if (INKContDataSet(scan_contp, cstate) != INK_SUCCESS) {
-      INKError("ContDataSet failed");
-      INKfree(cstate);
+    if (TSContDataSet(scan_contp, cstate) != TS_SUCCESS) {
+      TSError("ContDataSet failed");
+      TSfree(cstate);
       goto Ldone;
     }
-    INKDebug("cache_iter", "setup cache intercept");
+    TSDebug("cache_iter", "setup cache intercept");
   } else {
-    INKDebug("cache_iter", "not a cache iter request");
+    TSDebug("cache_iter", "not a cache iter request");
   }
 
 Ldone:
-  INKHandleStringRelease(bufp, url_loc, path);
-  INKHandleStringRelease(bufp, url_loc, query);
-  INKHandleMLocRelease(bufp, hdr_loc, url_loc);
-  INKHandleMLocRelease(bufp, INK_NULL_MLOC, hdr_loc);
+  TSHandleStringRelease(bufp, url_loc, path);
+  TSHandleStringRelease(bufp, url_loc, query);
+  TSHandleMLocRelease(bufp, hdr_loc, url_loc);
+  TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc);
 
-  return INKHttpTxnReenable(txnp, INK_EVENT_HTTP_CONTINUE);
+  return TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE);
 }
 
 //----------------------------------------------------------------------------
 // handler for http txn events
 static int
-cache_print_plugin(INKCont contp, INKEvent event, void *edata)
+cache_print_plugin(TSCont contp, TSEvent event, void *edata)
 {
   switch (event) {
-  case INK_EVENT_HTTP_READ_REQUEST_HDR:
-    return setup_request(contp, (INKHttpTxn) edata);
+  case TS_EVENT_HTTP_READ_REQUEST_HDR:
+    return setup_request(contp, (TSHttpTxn) edata);
   default:
     break;
   }
-  return INKHttpTxnReenable((INKHttpTxn) edata, INK_EVENT_HTTP_CONTINUE);
+  return TSHttpTxnReenable((TSHttpTxn) edata, TS_EVENT_HTTP_CONTINUE);
 }
 
 //----------------------------------------------------------------------------
 void
-INKPluginInit(int argc, const char *argv[])
+TSPluginInit(int argc, const char *argv[])
 {
-  global_contp = INKContCreate(cache_print_plugin, INKMutexCreate());
-  INKHttpHookAdd(INK_HTTP_READ_REQUEST_HDR_HOOK, global_contp);
+  global_contp = TSContCreate(cache_print_plugin, TSMutexCreate());
+  TSHttpHookAdd(TS_HTTP_READ_REQUEST_HDR_HOOK, global_contp);
 }

Modified: trafficserver/traffic/trunk/example/file-1/file-1.c
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/example/file-1/file-1.c?rev=1035782&r1=1035781&r2=1035782&view=diff
==============================================================================
--- trafficserver/traffic/trunk/example/file-1/file-1.c (original)
+++ trafficserver/traffic/trunk/example/file-1/file-1.c Tue Nov 16 20:22:02 2010
@@ -41,7 +41,7 @@ int
 check_ts_version()
 {
 
-  const char *ts_version = INKTrafficServerVersionGet();
+  const char *ts_version = TSTrafficServerVersionGet();
   int result = 0;
 
   if (ts_version) {
@@ -63,37 +63,37 @@ check_ts_version()
 }
 
 void
-INKPluginInit(int argc, const char *argv[])
+TSPluginInit(int argc, const char *argv[])
 {
-  INKFile filep;
+  TSFile filep;
   char buf[4096];
   int i;
-  INKPluginRegistrationInfo info;
+  TSPluginRegistrationInfo info;
 
   info.plugin_name = "file_plugin";
   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;
   }
 
   for (i = 1; i < argc; i++) {
-    filep = INKfopen(argv[i], "r");
+    filep = TSfopen(argv[i], "r");
     if (!filep) {
       continue;
     }
 
-    while (INKfgets(filep, buf, 4096)) {
-      INKDebug("debug-file", "%s", buf);
+    while (TSfgets(filep, buf, 4096)) {
+      TSDebug("debug-file", "%s", buf);
     }
 
-    INKfclose(filep);
+    TSfclose(filep);
   }
 }
 

Modified: trafficserver/traffic/trunk/example/file-1/readme.txt
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/example/file-1/readme.txt?rev=1035782&r1=1035781&r2=1035782&view=diff
==============================================================================
--- trafficserver/traffic/trunk/example/file-1/readme.txt (original)
+++ trafficserver/traffic/trunk/example/file-1/readme.txt Tue Nov 16 20:22:02 2010
@@ -22,15 +22,15 @@ If you use a relative pathname, the path
 respect to the Traffic Server install directory.  (That is, the path 
 contained in /etc/traffic_server.)
 
-The only function defined is INKPluginInit.
+The only function defined is TSPluginInit.
 
 It does the following:
 
 - opens the file specified in plugin.config, using
-	INKfopen
+	TSfopen
 
 - reads the content of the file into a buffer using 
-	INKfgets
+	TSfgets
 
 - closes the file using 
-	INKfclose
+	TSfclose

Modified: trafficserver/traffic/trunk/example/file_system_cache/DiskCache.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/example/file_system_cache/DiskCache.cc?rev=1035782&r1=1035781&r2=1035782&view=diff
==============================================================================
--- trafficserver/traffic/trunk/example/file_system_cache/DiskCache.cc (original)
+++ trafficserver/traffic/trunk/example/file_system_cache/DiskCache.cc Tue Nov 16 20:22:02 2010
@@ -73,7 +73,7 @@ DiskCache::lock(const datum & key, const
   // add the open file to the openFiles map if it not already there
   // lock the map
   if (pthread_mutex_lock(&_mutex) != 0) {
-    INKDebug("cache_plugin", "[DiskCache::lock] can't get mutex");
+    TSDebug("cache_plugin", "[DiskCache::lock] can't get mutex");
     return -1;
   }
   // lookup
@@ -84,7 +84,7 @@ DiskCache::lock(const datum & key, const
       if (pthread_mutex_unlock(&_mutex) != 0) {
         abort();
       }
-      INKDebug("cache_plugin", "[DiskCache::lock] file already opened with shared access");
+      TSDebug("cache_plugin", "[DiskCache::lock] file already opened with shared access");
       return -1;
     }
   } else {
@@ -94,7 +94,7 @@ DiskCache::lock(const datum & key, const
         if (pthread_mutex_unlock(&_mutex) != 0) {
           abort();
         }
-        INKDebug("cache_plugin", "[DiskCache::lock] file already opend with exclusive access");
+        TSDebug("cache_plugin", "[DiskCache::lock] file already opend with exclusive access");
         return -1;
       } else {
         it->second.refcount++;
@@ -119,18 +119,18 @@ DiskCache::lock(const datum & key, const
   }
 
   if (fd < 0) {
-    INKDebug("cache_plugin", "[DiskCache::lock] can't open the file: %s", path.c_str());
+    TSDebug("cache_plugin", "[DiskCache::lock] can't open the file: %s", path.c_str());
     return -1;
   }
   // try to obtain the lock
   if (exclusive) {
     if (flock(fd, LOCK_EX || LOCK_NB) != 0) {
-      INKDebug("cache_plugin", "[DiskCache::lock] can't get exclusive flock on file: %s", path.c_str());
+      TSDebug("cache_plugin", "[DiskCache::lock] can't get exclusive flock on file: %s", path.c_str());
       return -1;
     }
   } else {
     if (flock(fd, LOCK_EX || LOCK_NB) != 0) {
-      INKDebug("cache_plugin", "[DiskCache::lock] can't get shared flock on file: %s", path.c_str());
+      TSDebug("cache_plugin", "[DiskCache::lock] can't get shared flock on file: %s", path.c_str());
       return -1;
     }
   }
@@ -148,7 +148,7 @@ DiskCache::lock(const datum & key, const
       if (pthread_mutex_unlock(&_mutex) != 0) {
         abort();
       }
-      INKDebug("cache_plugin", "[DiskCache::lock] file already opened with shared access");
+      TSDebug("cache_plugin", "[DiskCache::lock] file already opened with shared access");
       return -1;
     } else {
       _openFiles[key] = openFile(fd, true);
@@ -267,7 +267,7 @@ DiskCache::aioRead(const datum & key, da
   // get the file descriptor from the open file map
   int fd = -1;
   if ((fd = _getFileDescriptor(key, false /* non-exclusive */ )) < 0) {
-    INKDebug("cache_plugin", "[DiskCache::aioRead] can't find file descriptor");
+    TSDebug("cache_plugin", "[DiskCache::aioRead] can't find file descriptor");
     return -1;
   }
   // Set up the AIO request
@@ -296,7 +296,7 @@ DiskCache::aioWrite(const datum & key, c
   // get the file descriptor from the open file map
   int fd = -1;
   if ((fd = _getFileDescriptor(key, true)) < 0) {
-    INKDebug("cache_plugin", "[DiskCache::aioWrite] can't find file descriptor");
+    TSDebug("cache_plugin", "[DiskCache::aioWrite] can't find file descriptor");
     return -1;
   }
   // Set up the AIO request
@@ -342,7 +342,7 @@ DiskCache::write(const datum & key, cons
   // get the file descriptor from the open file map
   int fd = -1;
   if ((fd = _getFileDescriptor(key, true)) < 0) {
-    INKDebug("cache_plugin", "[DiskCache::write] can't find file descriptor");
+    TSDebug("cache_plugin", "[DiskCache::write] can't find file descriptor");
     return -1;
   }
   //cout << "value size: " << value.dsize << endl;
@@ -356,7 +356,7 @@ DiskCache::write(const datum & key, cons
   }
   //cout << "bytesWritten: " << bytesWritten << endl;
   if (bytesWritten < 0) {
-    INKDebug("cache_plugin", "[DiskCache::write] 0 bytes written");
+    TSDebug("cache_plugin", "[DiskCache::write] 0 bytes written");
     return -1;
   }
 
@@ -371,7 +371,7 @@ DiskCache::read(const datum & key, datum
   // get the file descriptor from the open file map
   int fd = -1;
   if ((fd = _getFileDescriptor(key, false /* non-exclusive */ )) < 0) {
-    INKDebug("cache_plugin", "[DiskCache::read] can't find file descriptor");
+    TSDebug("cache_plugin", "[DiskCache::read] can't find file descriptor");
     return -1;
   }
 
@@ -385,7 +385,7 @@ DiskCache::read(const datum & key, datum
   }
   //cout << "bytesRead: " << bytesRead << endl;
   if (bytesRead < 0) {
-    INKDebug("cache_plugin", "[DiskCache::read] 0 bytes read, offset: %llu, size: %llu", offset, size);
+    TSDebug("cache_plugin", "[DiskCache::read] 0 bytes read, offset: %llu, size: %llu", offset, size);
     //perror("read error:");
     return -1;
   }
@@ -402,13 +402,13 @@ DiskCache::remove(const datum & key)
   int fd = -1;
 
   if ((fd = _getFileDescriptor(key, true, true)) < 0) {
-    INKDebug("cache_plugin", "[DiskCache::remove] can't find file descriptor");
+    TSDebug("cache_plugin", "[DiskCache::remove] can't find file descriptor");
     return -1;
   }
   // truncate the file
   int rval = ftruncate(fd, 0);
   if (rval != 0) {
-    INKDebug("cache_plugin", "[DiskCache::remove] error truncating file");
+    TSDebug("cache_plugin", "[DiskCache::remove] error truncating file");
   }
   return rval;
 }
@@ -470,8 +470,8 @@ DiskCache::_makeDirectoryRecursive(const
       string fullPath = path + dirName;
       if (mkdir(fullPath.c_str(), 0755) == -1) {
         if (errno != EEXIST) {
-          INKDebug("cache_plugin", "Couldn't create the cache directory: %s", fullPath.c_str());
-          INKError("Couldn't create the  cache directory: %s", fullPath.c_str());
+          TSDebug("cache_plugin", "Couldn't create the cache directory: %s", fullPath.c_str());
+          TSError("Couldn't create the  cache directory: %s", fullPath.c_str());
 
           return 1;
         }

Modified: trafficserver/traffic/trunk/example/file_system_cache/DiskCache.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/example/file_system_cache/DiskCache.h?rev=1035782&r1=1035781&r2=1035782&view=diff
==============================================================================
--- trafficserver/traffic/trunk/example/file_system_cache/DiskCache.h (original)
+++ trafficserver/traffic/trunk/example/file_system_cache/DiskCache.h Tue Nov 16 20:22:02 2010
@@ -187,8 +187,8 @@ public:
   {
     if (mkdir(_topDirectory.c_str(), 0755) != 0) {
       if (errno != EEXIST) {
-        INKDebug("cache_plugin", "Couldn't create the top cache directory: %s", _topDirectory.c_str());
-        INKError("cache_plugin", "Couldn't create the top cache directory: %s", _topDirectory.c_str());
+        TSDebug("cache_plugin", "Couldn't create the top cache directory: %s", _topDirectory.c_str());
+        TSError("cache_plugin", "Couldn't create the top cache directory: %s", _topDirectory.c_str());
         return 1;
       }
     }

Modified: trafficserver/traffic/trunk/example/file_system_cache/diskcache_plugin.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/example/file_system_cache/diskcache_plugin.cc?rev=1035782&r1=1035781&r2=1035782&view=diff
==============================================================================
--- trafficserver/traffic/trunk/example/file_system_cache/diskcache_plugin.cc (original)
+++ trafficserver/traffic/trunk/example/file_system_cache/diskcache_plugin.cc Tue Nov 16 20:22:02 2010
@@ -32,32 +32,32 @@ static DiskCache cache;
 
 //----------------------------------------------------------------------------
 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;
+  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;
     }
@@ -69,24 +69,24 @@ get_info_from_buffer(INKIOBufferReader t
 
 
 static int
-cache_read(INKCont contp, INKEvent event, void *edata)
+cache_read(TSCont contp, TSEvent event, void *edata)
 {
-  INKDebug("cache_plugin", "[cache_read] event id: %d", event);
+  TSDebug("cache_plugin", "[cache_read] event id: %d", event);
 
 
-  INKDebug("cache_plugin", "[cache_read] disk cache plugin ");
+  TSDebug("cache_plugin", "[cache_read] disk cache plugin ");
 
-  INKHttpTxn txnp = (INKHttpTxn) edata;
+  TSHttpTxn txnp = (TSHttpTxn) edata;
   datum key, value;
   int keySize = 0;
-  INKU64 size, offset;
-  //INKIOBuffer buff;
+  TSU64 size, offset;
+  //TSIOBuffer buff;
 
   // get the key for the lookup
-  INKCacheKeyGet(txnp, (void **) &key.dptr, &keySize);
+  TSCacheKeyGet(txnp, (void **) &key.dptr, &keySize);
   key.dsize = keySize;
-  //INKCacheBufferInfoGet(txnp, &buff,&size, &offset);
-  INKCacheBufferInfoGet(txnp, &size, &offset);
+  //TSCacheBufferInfoGet(txnp, &buff,&size, &offset);
+  TSCacheBufferInfoGet(txnp, &size, &offset);
   //cout <<"size of the object is" <<size << endl;
   // cout <<"offset of the object is" <<offset << endl;
 
@@ -101,25 +101,25 @@ cache_read(INKCont contp, INKEvent event
   value.dptr = buffer;
   value.dsize = 0;
 
-  INKDebug("cache_plugin", "[cache_read] lock");
+  TSDebug("cache_plugin", "[cache_read] lock");
   cache.lock(key, false /* shared lock */ );
-  INKDebug("cache_plugin", "[cache_read] read");
+  TSDebug("cache_plugin", "[cache_read] read");
   if (cache.read(key, value, size, offset) == -1) {
-    INKDebug("cache_plugin", "[cache_read] didn't find in cache");
+    TSDebug("cache_plugin", "[cache_read] didn't find in cache");
     value.dptr = 0;
   }
-  INKDebug("cache_plugin", "[cache_read] unlock");
+  TSDebug("cache_plugin", "[cache_read] unlock");
   cache.unlock(key);
   // TODO write into IO buffer directly as described in steps above
-  /*if(event != INK_EVENT_CACHE_LOOKUP)
+  /*if(event != TS_EVENT_CACHE_LOOKUP)
      {
-     INKIOBufferWrite(buff,value.dptr,value.dsize);
-     INKDebug("cache_plugin", "[cache_read] return");
-     return INKHttpCacheReenable(txnp, event, 0, value.dsize);
+     TSIOBufferWrite(buff,value.dptr,value.dsize);
+     TSDebug("cache_plugin", "[cache_read] return");
+     return TSHttpCacheReenable(txnp, event, 0, value.dsize);
      }
      else
      { */
-  return INKHttpCacheReenable(txnp, event, value.dptr, value.dsize);
+  return TSHttpCacheReenable(txnp, event, value.dptr, value.dsize);
   //}
 
 }
@@ -127,16 +127,16 @@ cache_read(INKCont contp, INKEvent event
 
 //----------------------------------------------------------------------------
 static int
-cache_write(INKCont contp, INKEvent event, void *edata)
+cache_write(TSCont contp, TSEvent event, void *edata)
 {
-  INKDebug("cache_plugin", "[cache_write] disk cache plugin");
+  TSDebug("cache_plugin", "[cache_write] disk cache plugin");
 
-  INKHttpTxn txnp = (INKHttpTxn) edata;
+  TSHttpTxn txnp = (TSHttpTxn) edata;
 
   // get the key for the data
   datum key, value;
   int keySize = 0;
-  INKCacheKeyGet(txnp, (void **) &key.dptr, &keySize);
+  TSCacheKeyGet(txnp, (void **) &key.dptr, &keySize);
   key.dsize = keySize;
 
   // 1. get IO buffer from the NewCacheVC
@@ -144,9 +144,9 @@ cache_write(INKCont contp, INKEvent even
   // 3. use the existing InkAPI to read the io buffer and write into cache
 
   // get the buffer to write into cache and get the start of the buffer
-  INKIOBufferReader buffer = INKCacheBufferReaderGet(txnp);
-  INKIOBufferBlock block = INKIOBufferReaderStart(buffer);
-  int available = INKIOBufferReaderAvail(buffer);
+  TSIOBufferReader buffer = TSCacheBufferReaderGet(txnp);
+  TSIOBufferBlock block = TSIOBufferReaderStart(buffer);
+  int available = TSIOBufferReaderAvail(buffer);
   char *temp_buf;
   uint64_t totalSize;
   // write to cache
@@ -155,69 +155,69 @@ cache_write(INKCont contp, INKEvent even
   cache.lock(key, true /* exclusive lock */ );
 //    do {
 //     int valueSize;
-//      value.dptr = (char*)INKIOBufferBlockReadStart(block, buffer, &valueSize);
+//      value.dptr = (char*)TSIOBufferBlockReadStart(block, buffer, &valueSize);
   value.dptr = (char *) get_info_from_buffer(buffer);
   value.dsize = available;
-//      INKDebug("cache_plugin", "[cache_write] **** value size %d", valueSize);
+//      TSDebug("cache_plugin", "[cache_write] **** value size %d", valueSize);
 
 
   // write the first buffer block to the string
   if (value.dptr != NULL) {
-    INKDebug("cache_plugin", "[cache_write] writing to the cache, bytes: %llu", value.dsize);
+    TSDebug("cache_plugin", "[cache_write] writing to the cache, bytes: %llu", value.dsize);
     if (cache.write(key, value) == -1) {
-      INKDebug("cache_plugin", "[cache_write] ERROR: writing to cache");
+      TSDebug("cache_plugin", "[cache_write] ERROR: writing to cache");
     }
-    //INKfree (value.dptr);
-//        INKIOBufferReaderConsume(buffer, valueSize);
+    //TSfree (value.dptr);
+//        TSIOBufferReaderConsume(buffer, valueSize);
   }
-//    } while ((block = INKIOBufferBlockNext(block)) != NULL);
+//    } while ((block = TSIOBufferBlockNext(block)) != NULL);
   totalSize = cache.getSize(key);
   cache.unlock(key);
 //  }
 
-  return INKHttpCacheReenable(txnp, event, 0, totalSize);
+  return TSHttpCacheReenable(txnp, event, 0, totalSize);
 }
 
 
 //----------------------------------------------------------------------------
 static int
-cache_remove(INKCont contp, INKEvent event, void *edata)
+cache_remove(TSCont contp, TSEvent event, void *edata)
 {
-  INKDebug("cache_plugin", "[cache_remove] disk cache plugin");
+  TSDebug("cache_plugin", "[cache_remove] disk cache plugin");
 
-  INKHttpTxn txnp = (INKHttpTxn) edata;
+  TSHttpTxn txnp = (TSHttpTxn) edata;
 
-  return INKHttpCacheReenable(txnp, event, 0, 0);
+  return TSHttpCacheReenable(txnp, event, 0, 0);
 }
 
 
 //----------------------------------------------------------------------------
 static int
-cache_main(INKCont contp, INKEvent event, void *edata)
+cache_main(TSCont contp, TSEvent event, void *edata)
 {
-  INKDebug("cache_plugin", "[cache_main] event id: %d", event);
+  TSDebug("cache_plugin", "[cache_main] event id: %d", event);
 
   switch (event) {
-  case INK_EVENT_CACHE_LOOKUP:
-  case INK_EVENT_CACHE_READ:
+  case TS_EVENT_CACHE_LOOKUP:
+  case TS_EVENT_CACHE_READ:
     return cache_read(contp, event, edata);
     break;
 
-  case INK_EVENT_CACHE_WRITE:
-  case INK_EVENT_CACHE_WRITE_HEADER:
+  case TS_EVENT_CACHE_WRITE:
+  case TS_EVENT_CACHE_WRITE_HEADER:
     return cache_write(contp, event, edata);
     break;
 
-  case INK_EVENT_CACHE_DELETE:
+  case TS_EVENT_CACHE_DELETE:
     return cache_remove(contp, event, edata);
     break;
 
-  case INK_EVENT_CACHE_CLOSE:
+  case TS_EVENT_CACHE_CLOSE:
     //do nothing
     break;
 
   default:
-    INKDebug("cache_plugin", "ERROR: unknown event");
+    TSDebug("cache_plugin", "ERROR: unknown event");
     return 0;
   }
 }
@@ -225,27 +225,27 @@ cache_main(INKCont contp, INKEvent event
 
 //----------------------------------------------------------------------------
 void
-INKPluginInit(const int argc, const char **argv)
+TSPluginInit(const int argc, const char **argv)
 {
-  INKPluginRegistrationInfo info;
-  INKCont contp;
+  TSPluginRegistrationInfo info;
+  TSCont contp;
 
-  INKDebug("cache_plugin", "Starting plugin");
+  TSDebug("cache_plugin", "Starting plugin");
 
 
   info.plugin_name = "cache_plugin";
   info.vendor_name = "ASF";
   info.support_email = "";
 
-  INKCont continuation_main = INKContCreate(cache_main, INKMutexCreate());
+  TSCont continuation_main = TSContCreate(cache_main, TSMutexCreate());
 
-  INKCacheHookAdd(INK_CACHE_PLUGIN_HOOK, continuation_main);
+  TSCacheHookAdd(TS_CACHE_PLUGIN_HOOK, continuation_main);
 
   cache.setTopDirectory("/home/trafficserver/share/yts");
   cache.setNumberDirectories(65536);
   if (cache.makeDirectories() != 0) {
-    INKDebug("cache_plugin", "Couldn't create the cache directories");
-    INKError("cache_plugin", "Couldn't create the cache directories");
+    TSDebug("cache_plugin", "Couldn't create the cache directories");
+    TSError("cache_plugin", "Couldn't create the cache directories");
     abort();
   }
 }

Modified: trafficserver/traffic/trunk/example/file_system_cache/test_diskcache.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/example/file_system_cache/test_diskcache.cc?rev=1035782&r1=1035781&r2=1035782&view=diff
==============================================================================
--- trafficserver/traffic/trunk/example/file_system_cache/test_diskcache.cc (original)
+++ trafficserver/traffic/trunk/example/file_system_cache/test_diskcache.cc Tue Nov 16 20:22:02 2010
@@ -30,12 +30,12 @@
 #define LOOP 1000
 
 void
-INKDebug(const char *tag, const char *format_str, ...)
+TSDebug(const char *tag, const char *format_str, ...)
 {
 }
 
 void
-INKError(const char *format_str, ...)
+TSError(const char *format_str, ...)
 {
 }
 

Modified: trafficserver/traffic/trunk/example/gzip-transform/gunzip.c
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/example/gzip-transform/gunzip.c?rev=1035782&r1=1035781&r2=1035782&view=diff
==============================================================================
--- trafficserver/traffic/trunk/example/gzip-transform/gunzip.c (original)
+++ trafficserver/traffic/trunk/example/gzip-transform/gunzip.c Tue Nov 16 20:22:02 2010
@@ -38,10 +38,10 @@
 
 typedef struct
 {
-  INKHttpTxn txn;
-  INKVIO output_vio;
-  INKIOBuffer output_buffer;
-  INKIOBufferReader output_reader;
+  TSHttpTxn txn;
+  TSVIO output_vio;
+  TSIOBuffer output_buffer;
+  TSIOBufferReader output_reader;
   int output_length;
   z_stream zstrm;
   uLong crc;
@@ -63,7 +63,7 @@ load_dictionary(char *dict, uLong * adle
 
   fp = fopen(preload_file, "r");
   if (!fp) {
-    INKError("gunzip-transform: ERROR: Unable to open dict file %s\n", preload_file);
+    TSError("gunzip-transform: ERROR: Unable to open dict file %s\n", preload_file);
     exit(0);
   }
 
@@ -84,14 +84,14 @@ load_dictionary(char *dict, uLong * adle
 static voidpf
 gzip_alloc(voidpf opaque, uInt items, uInt size)
 {
-  return (voidpf) INKmalloc(items * size);
+  return (voidpf) TSmalloc(items * size);
 }
 
 
 static void
 gzip_free(voidpf opaque, voidpf address)
 {
-  INKfree(address);
+  TSfree(address);
 }
 
 
@@ -100,7 +100,7 @@ gzip_data_alloc()
 {
   GzipData *data;
 
-  data = (GzipData *) INKmalloc(sizeof(GzipData));
+  data = (GzipData *) TSmalloc(sizeof(GzipData));
   data->output_vio = NULL;
   data->output_buffer = NULL;
   data->output_reader = NULL;
@@ -134,45 +134,45 @@ gzip_data_destroy(GzipData * data)
   if (data) {
     err = inflateEnd(&data->zstrm);
     if (err != Z_OK) {
-      INKError("gunzip-transform: ERROR: inflateEnd (%d)!", err);
+      TSError("gunzip-transform: ERROR: inflateEnd (%d)!", err);
     }
 
     if (data->output_buffer) {
-      INKIOBufferDestroy(data->output_buffer);
+      TSIOBufferDestroy(data->output_buffer);
     }
-    INKfree(data);
+    TSfree(data);
   }
 }
 
 
 static void
-gzip_transform_init(INKCont contp, GzipData * data)
+gzip_transform_init(TSCont contp, GzipData * data)
 {
-  INKVConn output_conn;
+  TSVConn output_conn;
 
   data->state = 1;
 
   /* Get the output connection where we'll write data to. */
-  output_conn = INKTransformOutputVConnGet(contp);
+  output_conn = TSTransformOutputVConnGet(contp);
 
-  data->output_buffer = INKIOBufferCreate();
-  data->output_reader = INKIOBufferReaderAlloc(data->output_buffer);
-  data->output_vio = INKVConnWrite(output_conn, contp, data->output_reader, INT_MAX);
+  data->output_buffer = TSIOBufferCreate();
+  data->output_reader = TSIOBufferReaderAlloc(data->output_buffer);
+  data->output_vio = TSVConnWrite(output_conn, contp, data->output_reader, INT_MAX);
 }
 
 
 static void
-gzip_transform_one(GzipData * data, INKIOBufferReader input_reader, int amount)
+gzip_transform_one(GzipData * data, TSIOBufferReader input_reader, int amount)
 {
-  INKIOBufferBlock blkp;
+  TSIOBufferBlock blkp;
   const char *ibuf;
   char *obuf;
   int64 ilength, olength;
   int err = Z_OK;
 
   while (amount > 0) {
-    blkp = INKIOBufferReaderStart(input_reader);
-    ibuf = INKIOBufferBlockReadStart(blkp, input_reader, &ilength);
+    blkp = TSIOBufferReaderStart(input_reader);
+    ibuf = TSIOBufferBlockReadStart(blkp, input_reader, &ilength);
 
     if (ilength > amount) {
       ilength = amount;
@@ -185,15 +185,15 @@ gzip_transform_one(GzipData * data, INKI
       err = inflateInit(&data->zstrm);
       data->flag = 0;
       if (err != Z_OK) {
-        INKError("gunzip-transform: ERROR: inflateInit (%d)!", err);
+        TSError("gunzip-transform: ERROR: inflateInit (%d)!", err);
         exit(1);
       }
     }
 
     while (data->zstrm.avail_in > 0 && err != Z_STREAM_END) {
-      blkp = INKIOBufferStart(data->output_buffer);
+      blkp = TSIOBufferStart(data->output_buffer);
 
-      obuf = INKIOBufferBlockWriteStart(blkp, &olength);
+      obuf = TSIOBufferBlockWriteStart(blkp, &olength);
 
       data->zstrm.next_out = (unsigned char *) obuf;
       data->zstrm.avail_out = olength;
@@ -205,18 +205,18 @@ gzip_transform_one(GzipData * data, INKI
 */
       if (err == Z_NEED_DICT) {
         assert(preload);
-        INKDebug("gunzip-transform", "Transform needs dictionary");
+        TSDebug("gunzip-transform", "Transform needs dictionary");
         /* TODO assert encoding dict is same as the decoding one, else send an error page */
         /* Dont send the user binary junk! */
 
         err = inflateSetDictionary(&data->zstrm, (Bytef *) dictionary, strlen(dictionary));
         if (err != Z_OK) {
-          INKError("gunzip-transform: ERROR: inflateSetDictionary (%d)!", err);
+          TSError("gunzip-transform: ERROR: inflateSetDictionary (%d)!", err);
         }
       }
 
       if (olength > data->zstrm.avail_out) {
-        INKIOBufferProduce(data->output_buffer, olength - data->zstrm.avail_out);
+        TSIOBufferProduce(data->output_buffer, olength - data->zstrm.avail_out);
         data->output_length += (olength - data->zstrm.avail_out);
       }
 
@@ -224,7 +224,7 @@ gzip_transform_one(GzipData * data, INKI
 
     /* TODO compute crc */
 
-    INKIOBufferReaderConsume(input_reader, ilength);
+    TSIOBufferReaderConsume(input_reader, ilength);
     amount -= ilength;
   }
 }
@@ -234,7 +234,7 @@ static void
 gzip_transform_finish(GzipData * data)
 {
   if (data->state == 1) {
-    INKIOBufferBlock blkp;
+    TSIOBufferBlock blkp;
     char *obuf;
     int64 olength;
     int err;
@@ -242,9 +242,9 @@ gzip_transform_finish(GzipData * data)
     data->state = 2;
 
     for (;;) {
-      blkp = INKIOBufferStart(data->output_buffer);
+      blkp = TSIOBufferStart(data->output_buffer);
 
-      obuf = INKIOBufferBlockWriteStart(blkp, &olength);
+      obuf = TSIOBufferBlockWriteStart(blkp, &olength);
       data->zstrm.next_out = (unsigned char *) obuf;
       data->zstrm.avail_out = olength;
 
@@ -252,7 +252,7 @@ gzip_transform_finish(GzipData * data)
       err = inflate(&data->zstrm, Z_FINISH);
 
       if (olength > data->zstrm.avail_out) {
-        INKIOBufferProduce(data->output_buffer, olength - data->zstrm.avail_out);
+        TSIOBufferProduce(data->output_buffer, olength - data->zstrm.avail_out);
         data->output_length += (olength - data->zstrm.avail_out);
       }
 
@@ -264,7 +264,7 @@ gzip_transform_finish(GzipData * data)
     }
 
     if (data->output_length != (data->zstrm.total_out)) {
-      INKError("gunzip-transform: ERROR: output lengths don't match (%d, %ld)", data->output_length,
+      TSError("gunzip-transform: ERROR: output lengths don't match (%d, %ld)", data->output_length,
                data->zstrm.total_out);
     }
 
@@ -274,9 +274,9 @@ gzip_transform_finish(GzipData * data)
 
 
 static void
-gzip_transform_do(INKCont contp)
+gzip_transform_do(TSCont contp)
 {
-  INKVIO write_vio;
+  TSVIO write_vio;
   GzipData *data;
   int towrite;
   int avail;
@@ -286,7 +286,7 @@ gzip_transform_do(INKCont contp)
      structure contains the output vio and output buffer. If the
      private data structure pointer is NULL, then we'll create it
      and initialize its internals. */
-  data = INKContDataGet(contp);
+  data = TSContDataGet(contp);
   if (data->state == 0) {
     gzip_transform_init(contp, data);
   }
@@ -295,7 +295,7 @@ gzip_transform_do(INKCont contp)
      ourself. This vio contains the buffer that we are to read from
      as well as the continuation we are to call when the buffer is
      empty. */
-  write_vio = INKVConnWriteVIOGet(contp);
+  write_vio = TSVConnWriteVIOGet(contp);
 
   length = data->output_length;
 
@@ -306,52 +306,52 @@ gzip_transform_do(INKCont contp)
      transformation that means we're done. In a more complex
      transformation we might have to finish writing the transformed
      data to our output connection. */
-  if (!INKVIOBufferGet(write_vio)) {
+  if (!TSVIOBufferGet(write_vio)) {
 
     gzip_transform_finish(data);
 
-    INKVIONBytesSet(data->output_vio, data->output_length);
+    TSVIONBytesSet(data->output_vio, data->output_length);
 
-    INKVIOReenable(data->output_vio);
+    TSVIOReenable(data->output_vio);
     return;
   }
 
   /* Determine how much data we have left to read. For this gzip
      transform plugin this is also the amount of data we have left
      to write to the output connection. */
-  towrite = INKVIONTodoGet(write_vio);
+  towrite = TSVIONTodoGet(write_vio);
   if (towrite > 0) {
     /* The amount of data left to read needs to be truncated by
        the amount of data actually in the read buffer. */
-    avail = INKIOBufferReaderAvail(INKVIOReaderGet(write_vio));
+    avail = TSIOBufferReaderAvail(TSVIOReaderGet(write_vio));
     if (towrite > avail) {
       towrite = avail;
     }
 
     if (towrite > 0) {
-      gzip_transform_one(data, INKVIOReaderGet(write_vio), towrite);
+      gzip_transform_one(data, TSVIOReaderGet(write_vio), towrite);
 
       /* Modify the write vio to reflect how much data we've
          completed. */
-      INKVIONDoneSet(write_vio, INKVIONDoneGet(write_vio) + towrite);
+      TSVIONDoneSet(write_vio, TSVIONDoneGet(write_vio) + towrite);
     }
   }
 
   /* Now we check the write vio to see if there is data left to
      read. */
-  if (INKVIONTodoGet(write_vio) > 0) {
+  if (TSVIONTodoGet(write_vio) > 0) {
     if (towrite > 0) {
       /* If we output some data then we reenable the output
          connection by reenabling the output vio. This will wakeup
          the output connection and allow it to consume data from the
          output buffer. */
       if (data->output_length > length) {
-        INKVIOReenable(data->output_vio);
+        TSVIOReenable(data->output_vio);
       }
 
       /* Call back the write vio continuation to let it know that we
          are ready for more data. */
-      INKContCall(INKVIOContGet(write_vio), INK_EVENT_VCONN_WRITE_READY, write_vio);
+      TSContCall(TSVIOContGet(write_vio), TS_EVENT_VCONN_WRITE_READY, write_vio);
     }
   } else {
     /* If there is no data left to read, then we modify the output
@@ -361,53 +361,53 @@ gzip_transform_do(INKCont contp)
        that it can consume the data we just gave it. */
     gzip_transform_finish(data);
 
-    INKVIONBytesSet(data->output_vio, data->output_length);
+    TSVIONBytesSet(data->output_vio, data->output_length);
 
     if (data->output_length > length) {
-      INKVIOReenable(data->output_vio);
+      TSVIOReenable(data->output_vio);
     }
 
     /* Call back the write vio continuation to let it know that we
        have completed the write operation. */
-    INKContCall(INKVIOContGet(write_vio), INK_EVENT_VCONN_WRITE_COMPLETE, write_vio);
+    TSContCall(TSVIOContGet(write_vio), TS_EVENT_VCONN_WRITE_COMPLETE, write_vio);
   }
 }
 
 
 static int
-gzip_transform(INKCont contp, INKEvent event, void *edata)
+gzip_transform(TSCont contp, TSEvent event, void *edata)
 {
   /* Check to see if the transformation has been closed by a call to
-     INKVConnClose. */
-  if (INKVConnClosedGet(contp)) {
-    gzip_data_destroy(INKContDataGet(contp));
-    INKContDestroy(contp);
+     TSVConnClose. */
+  if (TSVConnClosedGet(contp)) {
+    gzip_data_destroy(TSContDataGet(contp));
+    TSContDestroy(contp);
     return 0;
   } else {
     switch (event) {
-    case INK_EVENT_ERROR:
+    case TS_EVENT_ERROR:
       {
-        INKVIO write_vio;
+        TSVIO write_vio;
 
         /* Get the write vio for the write operation that was
            performed on ourself. This vio contains the continuation of
            our parent transformation. */
-        write_vio = INKVConnWriteVIOGet(contp);
+        write_vio = TSVConnWriteVIOGet(contp);
 
         /* Call back the write vio continuation to let it know that we
            have completed the write operation. */
-        INKContCall(INKVIOContGet(write_vio), INK_EVENT_ERROR, write_vio);
+        TSContCall(TSVIOContGet(write_vio), TS_EVENT_ERROR, write_vio);
       }
       break;
-    case INK_EVENT_VCONN_WRITE_COMPLETE:
-    case INK_EVENT_VCONN_EOS:
+    case TS_EVENT_VCONN_WRITE_COMPLETE:
+    case TS_EVENT_VCONN_EOS:
       /* When our output connection says that it has finished
          reading all the data we've written to it then we should
          shutdown the write portion of its connection to
          indicate that we don't want to hear about it anymore. */
-      INKVConnShutdown(INKTransformOutputVConnGet(contp), 0, 1);
+      TSVConnShutdown(TSTransformOutputVConnGet(contp), 0, 1);
       break;
-    case INK_EVENT_VCONN_WRITE_READY:
+    case TS_EVENT_VCONN_WRITE_READY:
     default:
       /* If we get a WRITE_READY event or any other type of
          event (sent, perhaps, because we were reenabled) then
@@ -421,112 +421,112 @@ gzip_transform(INKCont contp, INKEvent e
 }
 
 static int
-gzip_transformable(INKHttpTxn txnp, int server)
+gzip_transformable(TSHttpTxn txnp, int server)
 {
-  INKMBuffer bufp;
-  INKMLoc hdr_loc;
-  INKMLoc field_loc;
+  TSMBuffer bufp;
+  TSMLoc hdr_loc;
+  TSMLoc field_loc;
   const char *value;
 
   if (server) {
-    INKHttpTxnServerRespGet(txnp, &bufp, &hdr_loc);
+    TSHttpTxnServerRespGet(txnp, &bufp, &hdr_loc);
   } else {
-    INKHttpTxnCachedRespGet(txnp, &bufp, &hdr_loc);
+    TSHttpTxnCachedRespGet(txnp, &bufp, &hdr_loc);
   }
 
   /* We only want to do gunzip(inflate) on documents that have a
      content-encoding "deflate". */
 
-  field_loc = INKMimeHdrFieldFind(bufp, hdr_loc, "Content-Encoding", -1);
+  field_loc = TSMimeHdrFieldFind(bufp, hdr_loc, "Content-Encoding", -1);
   if (!field_loc) {
-    INKHandleMLocRelease(bufp, INK_NULL_MLOC, hdr_loc);
+    TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc);
     return -4;
   }
 
-  if (INKMimeHdrFieldValueStringGet(bufp, hdr_loc, field_loc, 0, &value, NULL) == INK_ERROR) {
-    INKHandleMLocRelease(bufp, hdr_loc, field_loc);
-    INKHandleMLocRelease(bufp, INK_NULL_MLOC, hdr_loc);
+  if (TSMimeHdrFieldValueStringGet(bufp, hdr_loc, field_loc, 0, &value, NULL) == TS_ERROR) {
+    TSHandleMLocRelease(bufp, hdr_loc, field_loc);
+    TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc);
     return -5;
   }
 
   if (value && (strncasecmp(value, "deflate", sizeof("deflate") - 1) == 0)) {
-    INKHandleMLocRelease(bufp, hdr_loc, field_loc);
-    INKHandleMLocRelease(bufp, INK_NULL_MLOC, hdr_loc);
+    TSHandleMLocRelease(bufp, hdr_loc, field_loc);
+    TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc);
     return 0;
   } else {
-    INKHandleMLocRelease(bufp, hdr_loc, field_loc);
-    INKHandleMLocRelease(bufp, INK_NULL_MLOC, hdr_loc);
+    TSHandleMLocRelease(bufp, hdr_loc, field_loc);
+    TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc);
     return -5;
   }
 }
 
 
 static void
-gzip_transform_add(INKHttpTxn txnp, int flag)
+gzip_transform_add(TSHttpTxn txnp, int flag)
 {
-  INKVConn connp;
+  TSVConn connp;
   GzipData *data;
 
   data = gzip_data_alloc();
   data->txn = txnp;
 
-  connp = INKTransformCreate(gzip_transform, txnp);
-  INKContDataSet(connp, data);
-  INKHttpTxnHookAdd(txnp, INK_HTTP_RESPONSE_TRANSFORM_HOOK, connp);
+  connp = TSTransformCreate(gzip_transform, txnp);
+  TSContDataSet(connp, data);
+  TSHttpTxnHookAdd(txnp, TS_HTTP_RESPONSE_TRANSFORM_HOOK, connp);
 }
 
 
 static int
-transform_plugin(INKCont contp, INKEvent event, void *edata)
+transform_plugin(TSCont contp, TSEvent event, void *edata)
 {
-  INKHttpTxn txnp = (INKHttpTxn) edata;
+  TSHttpTxn txnp = (TSHttpTxn) edata;
   int reason;
 
   switch (event) {
-  case INK_EVENT_HTTP_READ_REQUEST_HDR:
+  case TS_EVENT_HTTP_READ_REQUEST_HDR:
     {
-      INKMBuffer bufp;
-      INKMLoc hdr_loc;
-      INKMLoc ae_loc;           /* for the accept encoding mime field */
-
-      INKHttpTxnClientReqGet(txnp, &bufp, &hdr_loc);
-      ae_loc = INKMimeHdrFieldCreate(bufp, hdr_loc);
-      INKMimeHdrFieldNameSet(bufp, hdr_loc, ae_loc, "Accept-Encoding", -1);
-      INKMimeHdrFieldValueAppend(bufp, hdr_loc, ae_loc, -1, "deflate", -1);
-      INKMimeHdrFieldAppend(bufp, hdr_loc, ae_loc);
-      INKHandleMLocRelease(bufp, hdr_loc, ae_loc);
-      INKHandleMLocRelease(bufp, INK_NULL_MLOC, hdr_loc);
+      TSMBuffer bufp;
+      TSMLoc hdr_loc;
+      TSMLoc ae_loc;           /* for the accept encoding mime field */
+
+      TSHttpTxnClientReqGet(txnp, &bufp, &hdr_loc);
+      ae_loc = TSMimeHdrFieldCreate(bufp, hdr_loc);
+      TSMimeHdrFieldNameSet(bufp, hdr_loc, ae_loc, "Accept-Encoding", -1);
+      TSMimeHdrFieldValueAppend(bufp, hdr_loc, ae_loc, -1, "deflate", -1);
+      TSMimeHdrFieldAppend(bufp, hdr_loc, ae_loc);
+      TSHandleMLocRelease(bufp, hdr_loc, ae_loc);
+      TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc);
 
-      INKDebug("gunzip-transform", "Changed request header to accept deflate encoding");
-      INKHttpTxnReenable(txnp, INK_EVENT_HTTP_CONTINUE);
+      TSDebug("gunzip-transform", "Changed request header to accept deflate encoding");
+      TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE);
       break;
     }
-  case INK_EVENT_HTTP_READ_RESPONSE_HDR:
+  case TS_EVENT_HTTP_READ_RESPONSE_HDR:
     reason = gzip_transformable(txnp, 1);
     if (reason >= 0) {
-      INKMBuffer bufp;
-      INKMLoc hdr_loc;
-      INKMLoc field_loc;
-
-      INKHttpTxnServerRespGet(txnp, &bufp, &hdr_loc);
-      field_loc = INKMimeHdrFieldFind(bufp, hdr_loc, "Content-Encoding", -1);
-      INKMimeHdrFieldDestroy(bufp, hdr_loc, field_loc);
-      INKHandleMLocRelease(bufp, INK_NULL_MLOC, hdr_loc);
+      TSMBuffer bufp;
+      TSMLoc hdr_loc;
+      TSMLoc field_loc;
+
+      TSHttpTxnServerRespGet(txnp, &bufp, &hdr_loc);
+      field_loc = TSMimeHdrFieldFind(bufp, hdr_loc, "Content-Encoding", -1);
+      TSMimeHdrFieldDestroy(bufp, hdr_loc, field_loc);
+      TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc);
 
-      INKDebug("gunzip-transform", "server content transformable");
+      TSDebug("gunzip-transform", "server content transformable");
       gzip_transform_add(txnp, 1);
     } else {
-      INKDebug("gunzip-transform", "server content NOT transformable [%d]", reason);
+      TSDebug("gunzip-transform", "server content NOT transformable [%d]", reason);
     }
 
-    INKHttpTxnReenable(txnp, INK_EVENT_HTTP_CONTINUE);
+    TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE);
     break;
 
-  case INK_EVENT_HTTP_READ_CACHE_HDR:
+  case TS_EVENT_HTTP_READ_CACHE_HDR:
 
-    INKDebug("gunzip-transform", "Cached data");
+    TSDebug("gunzip-transform", "Cached data");
 
-    INKHttpTxnReenable(txnp, INK_EVENT_HTTP_CONTINUE);
+    TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE);
     break;
 
   default:
@@ -538,7 +538,7 @@ transform_plugin(INKCont contp, INKEvent
 
 
 void
-INKPluginInit(int argc, const char *argv[])
+TSPluginInit(int argc, const char *argv[])
 {
   if (argc == 2) {
     strcpy(preload_file, argv[1]);
@@ -546,7 +546,7 @@ INKPluginInit(int argc, const char *argv
     load_dictionary(dictionary, &dictId);
   }
 
-  INKHttpHookAdd(INK_HTTP_READ_REQUEST_HDR_HOOK, INKContCreate(transform_plugin, NULL));
-  INKHttpHookAdd(INK_HTTP_READ_RESPONSE_HDR_HOOK, INKContCreate(transform_plugin, NULL));
-  INKHttpHookAdd(INK_HTTP_READ_CACHE_HDR_HOOK, INKContCreate(transform_plugin, NULL));
+  TSHttpHookAdd(TS_HTTP_READ_REQUEST_HDR_HOOK, TSContCreate(transform_plugin, NULL));
+  TSHttpHookAdd(TS_HTTP_READ_RESPONSE_HDR_HOOK, TSContCreate(transform_plugin, NULL));
+  TSHttpHookAdd(TS_HTTP_READ_CACHE_HDR_HOOK, TSContCreate(transform_plugin, NULL));
 }