trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bc...@apache.org
Subject svn commit: r1199440 - in /trafficserver/plugins/trunk/buffer_upload: Makefile buffer_upload.c
Date Tue, 08 Nov 2011 20:20:01 GMT
Author: bcall
Date: Tue Nov  8 20:20:01 2011
New Revision: 1199440

URL: http://svn.apache.org/viewvc?rev=1199440&view=rev
Log:
Replaced the Makefile and changed ink to ts

Modified:
    trafficserver/plugins/trunk/buffer_upload/Makefile
    trafficserver/plugins/trunk/buffer_upload/buffer_upload.c

Modified: trafficserver/plugins/trunk/buffer_upload/Makefile
URL: http://svn.apache.org/viewvc/trafficserver/plugins/trunk/buffer_upload/Makefile?rev=1199440&r1=1199439&r2=1199440&view=diff
==============================================================================
--- trafficserver/plugins/trunk/buffer_upload/Makefile (original)
+++ trafficserver/plugins/trunk/buffer_upload/Makefile Tue Nov  8 20:20:01 2011
@@ -1,16 +1,26 @@
-CC=cc
-LD=ld
-CFLAGS= -g -D_REENTRANT=1 -m32
-LDFLAGS= -g -shared -m32
-API_INC=../../traffic/branches/buffer_upload/proxy/api/include
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
 
-default: buffer_upload.so
+TSXS?=tsxs
 
-buffer_upload.o : buffer_upload.c $(API_INC)/InkAPI.h
-	$(CC) $(CFLAGS) -I$(API_INC) -o buffer_upload.o -c buffer_upload.c
+all:	buffer_upload.c
+	$(TSXS) -v -c $? -o buffer_upload.so
 
-buffer_upload.so: buffer_upload.o
-	$(CC) $(LDFLAGS) -o buffer_upload.so buffer_upload.o
+install:
+	$(TSXS) -i -o buffer_upload.so
 
 clean:
-	rm -f buffer_upload.o buffer_upload.so
+	rm -f *.lo *.so *.bz2 *.asc *.md5 *.sha1

Modified: trafficserver/plugins/trunk/buffer_upload/buffer_upload.c
URL: http://svn.apache.org/viewvc/trafficserver/plugins/trunk/buffer_upload/buffer_upload.c?rev=1199440&r1=1199439&r2=1199440&view=diff
==============================================================================
--- trafficserver/plugins/trunk/buffer_upload/buffer_upload.c (original)
+++ trafficserver/plugins/trunk/buffer_upload/buffer_upload.c Tue Nov  8 20:20:01 2011
@@ -9,7 +9,7 @@
 #include <ctype.h>
 #include <limits.h>
 #define bool int
-#include "InkAPI.h"
+#include <ts/ts.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -30,16 +30,16 @@
 #define PLUGIN_NAME "buffer_upload"
 #define LOG_SET_FUNCTION_NAME(NAME) const char * FUNCTION_NAME = NAME
 #define LOG_ERROR(API_NAME) { \
-    INKError("%s: %s %s %s File %s, line number %d", PLUGIN_NAME, API_NAME, "APIFAIL", \
+    TS_ERROR("%s: %s %s %s File %s, line number %d", PLUGIN_NAME, API_NAME, "APIFAIL", \
              FUNCTION_NAME, __FILE__, __LINE__); \
 }
 #define LOG_ERROR_AND_RETURN(API_NAME) { \
     LOG_ERROR(API_NAME); \
-    return INK_ERROR; \
+    return TS_ERROR; \
 }
 
-#define VALID_PTR(X) ((X != NULL) && (X != INK_ERROR_PTR))
-#define NOT_VALID_PTR(X) ((X == NULL) || (X == INK_ERROR_PTR))
+#define VALID_PTR(X) ((X != NULL) && (X != TS_ERROR_PTR))
+#define NOT_VALID_PTR(X) ((X == NULL) || (X == TS_ERROR_PTR))
 
 
 struct upload_config_t {
@@ -73,29 +73,29 @@ struct config_val_ul {
    void *val;
 };
 
-static INKStat upload_vc_count;
+static TSStat upload_vc_count;
 
 static upload_config* uconfig = NULL;
 
 struct pvc_state_t {
-    INKVConn p_vc;
-    INKVIO p_read_vio;
-    INKVIO p_write_vio;
+    TSVConn p_vc;
+    TSVIO p_read_vio;
+    TSVIO p_write_vio;
 
-    INKVConn net_vc;
-    INKVIO n_read_vio;
-    INKVIO n_write_vio;
+    TSVConn net_vc;
+    TSVIO n_read_vio;
+    TSVIO n_write_vio;
 
-    INKIOBuffer req_buffer;
-    INKIOBufferReader req_reader;
+    TSIOBuffer req_buffer;
+    TSIOBufferReader req_reader;
 
-    INKIOBuffer resp_buffer;
-    INKIOBufferReader resp_reader;
+    TSIOBuffer resp_buffer;
+    TSIOBufferReader resp_reader;
 
-    INKIOBufferReader req_hdr_reader;
-    INKIOBuffer req_hdr_buffer;
+    TSIOBufferReader req_hdr_reader;
+    TSIOBuffer req_hdr_buffer;
 
-    INKMutex disk_io_mutex;
+    TSMutex disk_io_mutex;
 
     int fd;
     char *filename;
@@ -113,116 +113,116 @@ struct pvc_state_t {
     char *chunk_buffer;         // buffer to store the data read from disk
     int is_reading_from_disk;
 
-    INKHttpTxn http_txnp;
+    TSHttpTxn http_txnp;
 };
 
 typedef struct pvc_state_t pvc_state ;
 
 // print IOBuffer for test purpose
 static void
-print_buffer(INKIOBufferReader reader) {
+print_buffer(TSIOBufferReader reader) {
 
-    INKIOBufferBlock block;
+    TSIOBufferBlock block;
     int size;
     const char *ptr;
 
-    block = INKIOBufferReaderStart(reader);
-    while (block != NULL && block != INK_ERROR_PTR)
+    block = TSIOBufferReaderStart(reader);
+    while (block != NULL && block != TS_ERROR_PTR)
     {
-        ptr = INKIOBufferBlockReadStart(block, reader, &size);
-        INKDebug(DEBUG_TAG, "buffer size: %d", size);
-        INKDebug(DEBUG_TAG, "buffer: %.*s", size, ptr);
-        block = INKIOBufferBlockNext(block);
+        ptr = TSIOBufferBlockReadStart(block, reader, &size);
+        TSDebug(DEBUG_TAG, "buffer size: %d", size);
+        TSDebug(DEBUG_TAG, "buffer: %.*s", size, ptr);
+        block = TSIOBufferBlockNext(block);
     }
 }
 
 static int
-write_buffer_to_disk(INKIOBufferReader reader, pvc_state* my_state, INKCont contp) {
+write_buffer_to_disk(TSIOBufferReader reader, pvc_state* my_state, TSCont contp) {
 
-    INKIOBufferBlock block;
+    TSIOBufferBlock block;
     int size;
     const char *ptr;
     char *pBuf;
 
     LOG_SET_FUNCTION_NAME("write_buffer_to_disk");
-    block = INKIOBufferReaderStart(reader);
-    while (block != NULL && block != INK_ERROR_PTR) {
-        ptr = INKIOBufferBlockReadStart(block, reader, &size);
-        pBuf = (char *)INKmalloc(sizeof(char)*size);
+    block = TSIOBufferReaderStart(reader);
+    while (block != NULL && block != TS_ERROR_PTR) {
+        ptr = TSIOBufferBlockReadStart(block, reader, &size);
+        pBuf = (char *)TSmalloc(sizeof(char)*size);
         if (pBuf == NULL) {
-            LOG_ERROR_AND_RETURN("INKAIOWrite");
+            LOG_ERROR_AND_RETURN("TSAIOWrite");
         }
         memcpy(pBuf, ptr, size);
-        if (INKAIOWrite(my_state->fd, my_state->write_offset, pBuf, size, contp) < 0) {
-            LOG_ERROR_AND_RETURN("INKAIOWrite");
+        if (TSAIOWrite(my_state->fd, my_state->write_offset, pBuf, size, contp) < 0) {
+            LOG_ERROR_AND_RETURN("TSAIOWrite");
         }
         my_state->write_offset += size;
-        block = INKIOBufferBlockNext(block);
+        block = TSIOBufferBlockNext(block);
     }
-    return INK_SUCCESS;
+    return TS_SUCCESS;
 
 }
 
 static int
-call_httpconnect(INKCont contp, pvc_state* my_state) {
+call_httpconnect(TSCont contp, pvc_state* my_state) {
 
     LOG_SET_FUNCTION_NAME("call_httpconnect");
     
-    unsigned int client_ip = INKHttpTxnClientIPGet(my_state->http_txnp);
+    unsigned int client_ip = TSHttpTxnClientIPGet(my_state->http_txnp);
 
-    INKDebug(DEBUG_TAG, "call INKHttpConnect() ...");
-    if (INKHttpConnect(htonl(client_ip), 9999, &(my_state->net_vc)) == INK_ERROR) {
-        LOG_ERROR_AND_RETURN("INKHttpConnect");
+    TSDebug(DEBUG_TAG, "call TSHttpConnect() ...");
+    if (TSHttpConnect(htonl(client_ip), 9999, &(my_state->net_vc)) == TS_ERROR) {
+        LOG_ERROR_AND_RETURN("TSHttpConnect");
     }
-    my_state->p_write_vio = INKVConnWrite(my_state->p_vc, contp, my_state->resp_reader, INT_MAX);
-    if (my_state->p_write_vio == INK_ERROR_PTR) {
-        LOG_ERROR_AND_RETURN("INKVConnWrite");
+    my_state->p_write_vio = TSVConnWrite(my_state->p_vc, contp, my_state->resp_reader, INT_MAX);
+    if (my_state->p_write_vio == TS_ERROR_PTR) {
+        LOG_ERROR_AND_RETURN("TSVConnWrite");
     }
-    my_state->n_read_vio = INKVConnRead(my_state->net_vc, contp, my_state->resp_buffer, INT_MAX);
-    if (my_state->n_read_vio == INK_ERROR_PTR) {
-        LOG_ERROR_AND_RETURN("INKVConnRead");
+    my_state->n_read_vio = TSVConnRead(my_state->net_vc, contp, my_state->resp_buffer, INT_MAX);
+    if (my_state->n_read_vio == TS_ERROR_PTR) {
+        LOG_ERROR_AND_RETURN("TSVConnRead");
     }
-    my_state->n_write_vio = INKVConnWrite(my_state->net_vc, contp, my_state->req_reader, INT_MAX);
-    if (my_state->n_write_vio == INK_ERROR_PTR) {
-        LOG_ERROR_AND_RETURN("INKVConnWrite");
+    my_state->n_write_vio = TSVConnWrite(my_state->net_vc, contp, my_state->req_reader, INT_MAX);
+    if (my_state->n_write_vio == TS_ERROR_PTR) {
+        LOG_ERROR_AND_RETURN("TSVConnWrite");
     }
-    return INK_SUCCESS;
+    return TS_SUCCESS;
 }
 
 static void
-pvc_cleanup(INKCont contp, pvc_state* my_state) {
+pvc_cleanup(TSCont contp, pvc_state* my_state) {
 
     LOG_SET_FUNCTION_NAME("pvc_cleanup");
 
     if (my_state->req_buffer) {
-        if(INKIOBufferReaderFree(my_state->req_reader) == INK_ERROR) {
-            LOG_ERROR("INKIOBufferReaderFree");
+        if(TSIOBufferReaderFree(my_state->req_reader) == TS_ERROR) {
+            LOG_ERROR("TSIOBufferReaderFree");
         }
         my_state->req_reader = NULL;
-        if (INKIOBufferDestroy(my_state->req_buffer) == INK_ERROR) {
-            LOG_ERROR("INKIOBufferDestroy");
+        if (TSIOBufferDestroy(my_state->req_buffer) == TS_ERROR) {
+            LOG_ERROR("TSIOBufferDestroy");
         }
         my_state->req_buffer = NULL;
     }
 
     if (my_state->resp_buffer) {
-        if(INKIOBufferReaderFree(my_state->resp_reader) == INK_ERROR) {
-            LOG_ERROR("INKIOBufferReaderFree");
+        if(TSIOBufferReaderFree(my_state->resp_reader) == TS_ERROR) {
+            LOG_ERROR("TSIOBufferReaderFree");
         }
         my_state->resp_reader = NULL;
-        if (INKIOBufferDestroy(my_state->resp_buffer) == INK_ERROR) {
-            LOG_ERROR("INKIOBufferDestroy");
+        if (TSIOBufferDestroy(my_state->resp_buffer) == TS_ERROR) {
+            LOG_ERROR("TSIOBufferDestroy");
         }
         my_state->resp_buffer = NULL;
     }
 
     if (my_state->req_hdr_buffer) {
-        if(INKIOBufferReaderFree(my_state->req_hdr_reader) == INK_ERROR) {
-            LOG_ERROR("INKIOBufferReaderFree");
+        if(TSIOBufferReaderFree(my_state->req_hdr_reader) == TS_ERROR) {
+            LOG_ERROR("TSIOBufferReaderFree");
         }
         my_state->req_hdr_reader = NULL;
-        if (INKIOBufferDestroy(my_state->req_hdr_buffer) == INK_ERROR) {
-            LOG_ERROR("INKIOBufferDestroy");
+        if (TSIOBufferDestroy(my_state->req_hdr_buffer) == TS_ERROR) {
+            LOG_ERROR("TSIOBufferDestroy");
         }
         my_state->req_hdr_buffer = NULL;
     }
@@ -239,145 +239,145 @@ pvc_cleanup(INKCont contp, pvc_state* my
     }
 
     if (my_state->chunk_buffer) {
-        INKfree(my_state->chunk_buffer);
+        TSfree(my_state->chunk_buffer);
         my_state->chunk_buffer = NULL;
     }
 
-    INKfree(my_state);
-    if (INKContDestroy(contp) == INK_ERROR) {
-        LOG_ERROR("INKContDestroy");
+    TSfree(my_state);
+    if (TSContDestroy(contp) == TS_ERROR) {
+        LOG_ERROR("TSContDestroy");
     }
 
     /* Decrement upload_vc_count */
-    INKStatDecrement(upload_vc_count);
+    TSStatDecrement(upload_vc_count);
 }
 
 static void
-pvc_check_done(INKCont contp, pvc_state* my_state) {
+pvc_check_done(TSCont contp, pvc_state* my_state) {
     LOG_SET_FUNCTION_NAME("pvc_check_done");
 
     if (my_state->req_finished && my_state->resp_finished) {
-        if (INKVConnClose(my_state->p_vc) == INK_ERROR) {
-            LOG_ERROR("INKVConnClose");
+        if (TSVConnClose(my_state->p_vc) == TS_ERROR) {
+            LOG_ERROR("TSVConnClose");
         }
-        if (INKVConnClose(my_state->net_vc) == INK_ERROR) {
-            LOG_ERROR("INKVConnClose");
+        if (TSVConnClose(my_state->net_vc) == TS_ERROR) {
+            LOG_ERROR("TSVConnClose");
         }
         pvc_cleanup(contp, my_state);
     }
 }
     
 static void
-pvc_process_accept(INKCont contp, int event, void* edata, pvc_state* my_state) {
+pvc_process_accept(TSCont contp, int event, void* edata, pvc_state* my_state) {
 
     LOG_SET_FUNCTION_NAME("pvc_process_accept");
 
-    //INKDebug(DEBUG_TAG, "plugin called: pvc_process_accept with event %d", event);
+    //TSDebug(DEBUG_TAG, "plugin called: pvc_process_accept with event %d", event);
 
-    if (event == INK_EVENT_NET_ACCEPT) {
-        my_state->p_vc = (INKVConn) edata;
+    if (event == TS_EVENT_NET_ACCEPT) {
+        my_state->p_vc = (TSVConn) edata;
 
-        my_state->req_buffer = INKIOBufferCreate();
-        my_state->req_reader = INKIOBufferReaderAlloc(my_state->req_buffer);
+        my_state->req_buffer = TSIOBufferCreate();
+        my_state->req_reader = TSIOBufferReaderAlloc(my_state->req_buffer);
         // set the maximum memory buffer size for request (both request header and post data), default is 32K
         // only apply to memory buffer mode
-        if (!uconfig->use_disk_buffer && INKIOBufferWaterMarkSet(my_state->req_buffer, uconfig->mem_buffer_size) == INK_ERROR) {
-            LOG_ERROR("INKIOBufferWaterMarkSet");
+        if (!uconfig->use_disk_buffer && TSIOBufferWaterMarkSet(my_state->req_buffer, uconfig->mem_buffer_size) == TS_ERROR) {
+            LOG_ERROR("TSIOBufferWaterMarkSet");
         }
-        my_state->resp_buffer = INKIOBufferCreate();
-        my_state->resp_reader = INKIOBufferReaderAlloc(my_state->resp_buffer);
+        my_state->resp_buffer = TSIOBufferCreate();
+        my_state->resp_reader = TSIOBufferReaderAlloc(my_state->resp_buffer);
 
-        if ((my_state->req_buffer == INK_ERROR_PTR) || (my_state->req_reader == INK_ERROR_PTR) 
-            || (my_state->resp_buffer == INK_ERROR_PTR) || (my_state->resp_reader == INK_ERROR_PTR)) {
-            LOG_ERROR("INKIOBufferCreate || INKIOBufferReaderAlloc");
-            if (INKVConnClose(my_state->p_vc) == INK_ERROR) {
-                LOG_ERROR("INKVConnClose");
+        if ((my_state->req_buffer == TS_ERROR_PTR) || (my_state->req_reader == TS_ERROR_PTR) 
+            || (my_state->resp_buffer == TS_ERROR_PTR) || (my_state->resp_reader == TS_ERROR_PTR)) {
+            LOG_ERROR("TSIOBufferCreate || TSIOBufferReaderAlloc");
+            if (TSVConnClose(my_state->p_vc) == TS_ERROR) {
+                LOG_ERROR("TSVConnClose");
             }
             pvc_cleanup(contp, my_state);
         } else {
-            my_state->p_read_vio = INKVConnRead(my_state->p_vc, contp, my_state->req_buffer, INT_MAX);
-            if (my_state->p_read_vio == INK_ERROR_PTR) {
-                LOG_ERROR("INKVConnRead");
+            my_state->p_read_vio = TSVConnRead(my_state->p_vc, contp, my_state->req_buffer, INT_MAX);
+            if (my_state->p_read_vio == TS_ERROR_PTR) {
+                LOG_ERROR("TSVConnRead");
             }
         }
-    } else if (event == INK_EVENT_NET_ACCEPT_FAILED) {
+    } else if (event == TS_EVENT_NET_ACCEPT_FAILED) {
         pvc_cleanup(contp, my_state);
     } else {
-        INKReleaseAssert(!"Unexpected Event");
+        TSReleaseAssert(!"Unexpected Event");
     }
 }
 
 static void
-pvc_process_p_read(INKCont contp, INKEvent event, pvc_state* my_state) {
+pvc_process_p_read(TSCont contp, TSEvent event, pvc_state* my_state) {
 
     LOG_SET_FUNCTION_NAME("pvc_process_p_read");    
     int bytes;
     int size, consume_size;
 
-    //INKDebug(DEBUG_TAG, "plugin called: pvc_process_p_read with event %d", event);
+    //TSDebug(DEBUG_TAG, "plugin called: pvc_process_p_read with event %d", event);
 
     switch(event) {
-        case INK_EVENT_VCONN_READ_READY:
+        case TS_EVENT_VCONN_READ_READY:
             // Here we need to replace the server request header with client request header
             // print_buffer(my_state->req_reader);
             if (my_state->nbytes_to_consume == -1) {  // -1 is the initial value
-                INKHttpTxnServerReqHdrBytesGet(my_state->http_txnp, &(my_state->nbytes_to_consume));
+                TSHttpTxnServerReqHdrBytesGet(my_state->http_txnp, &(my_state->nbytes_to_consume));
             }
-            size = INKIOBufferReaderAvail(my_state->req_reader);
+            size = TSIOBufferReaderAvail(my_state->req_reader);
             if (my_state->nbytes_to_consume > 0) {
                 consume_size = (my_state->nbytes_to_consume < size)? my_state->nbytes_to_consume : size;
-                INKIOBufferReaderConsume(my_state->req_reader, consume_size);
+                TSIOBufferReaderConsume(my_state->req_reader, consume_size);
                 my_state->nbytes_to_consume -= consume_size;
                 size -= consume_size;
             }
             if (my_state->nbytes_to_consume == 0) {  // the entire server request header has been consumed
                 if (uconfig->use_disk_buffer) {
-                    INKMutexLock(my_state->disk_io_mutex);
-                    if (write_buffer_to_disk(my_state->req_hdr_reader, my_state, contp) == INK_ERROR) {
+                    TSMutexLock(my_state->disk_io_mutex);
+                    if (write_buffer_to_disk(my_state->req_hdr_reader, my_state, contp) == TS_ERROR) {
                         LOG_ERROR("write_buffer_to_disk");
                         uconfig->use_disk_buffer = 0;
                         close(my_state->fd);
                         remove(my_state->filename);
                         my_state->fd = -1;
                     }
-                    INKMutexUnlock(my_state->disk_io_mutex);
+                    TSMutexUnlock(my_state->disk_io_mutex);
                 }
                 if (size > 0) {
                     if (uconfig->use_disk_buffer) {
-                        INKMutexLock(my_state->disk_io_mutex);
-                        if (write_buffer_to_disk(my_state->req_reader, my_state, contp) == INK_ERROR) {
-                            INKDebug(DEBUG_TAG, "Error in writing to disk");
+                        TSMutexLock(my_state->disk_io_mutex);
+                        if (write_buffer_to_disk(my_state->req_reader, my_state, contp) == TS_ERROR) {
+                            TSDebug(DEBUG_TAG, "Error in writing to disk");
                         }
-                        INKMutexUnlock(my_state->disk_io_mutex);
+                        TSMutexUnlock(my_state->disk_io_mutex);
                     }
                     else {
                         // never get chance to test this line, didn't get a test case to fall into this situation
-                        INKIOBufferCopy(my_state->req_hdr_reader, my_state->req_reader, size, 0);
+                        TSIOBufferCopy(my_state->req_hdr_reader, my_state->req_reader, size, 0);
                     }
-                    INKIOBufferReaderConsume(my_state->req_reader, size);
+                    TSIOBufferReaderConsume(my_state->req_reader, size);
                 }
                 if (!uconfig->use_disk_buffer) {
-                    size = INKIOBufferReaderAvail(my_state->req_hdr_reader);
-                    INKIOBufferCopy(my_state->req_buffer, my_state->req_hdr_reader, size, 0);
+                    size = TSIOBufferReaderAvail(my_state->req_hdr_reader);
+                    TSIOBufferCopy(my_state->req_buffer, my_state->req_hdr_reader, size, 0);
                 }
                 my_state->nbytes_to_consume = -2;  // -2 indicates the header replacement is done
             } 
             if (my_state->nbytes_to_consume == -2) {
-                size = INKIOBufferReaderAvail(my_state->req_reader);
+                size = TSIOBufferReaderAvail(my_state->req_reader);
                 if (uconfig->use_disk_buffer) {
                     if (size > 0) {
-                        INKMutexLock(my_state->disk_io_mutex);
-                        if (write_buffer_to_disk(my_state->req_reader, my_state, contp) == INK_ERROR) {
-                            INKDebug(DEBUG_TAG, "Error in writing to disk");
+                        TSMutexLock(my_state->disk_io_mutex);
+                        if (write_buffer_to_disk(my_state->req_reader, my_state, contp) == TS_ERROR) {
+                            TSDebug(DEBUG_TAG, "Error in writing to disk");
                         }
-                        INKIOBufferReaderConsume(my_state->req_reader, size);
-                        INKMutexUnlock(my_state->disk_io_mutex);
+                        TSIOBufferReaderConsume(my_state->req_reader, size);
+                        TSMutexUnlock(my_state->disk_io_mutex);
                     }
                 }
                 else {
                     // if the entire post data had been read in memory, then connect to origin server.
                     if (size >= my_state->req_size) {
-                        if (call_httpconnect(contp, my_state) == INK_ERROR) {
+                        if (call_httpconnect(contp, my_state) == TS_ERROR) {
                             LOG_ERROR("call_httpconnect");
                         }
                     }
@@ -385,27 +385,27 @@ pvc_process_p_read(INKCont contp, INKEve
             }
             
             break;
-        case INK_EVENT_VCONN_READ_COMPLETE:
-        case INK_EVENT_VCONN_EOS:
-        case INK_EVENT_ERROR:
+        case TS_EVENT_VCONN_READ_COMPLETE:
+        case TS_EVENT_VCONN_EOS:
+        case TS_EVENT_ERROR:
         {
             
             /* We're finished reading from the plugin vc */
             int ndone;
 
-            ndone = INKVIONDoneGet(my_state->p_read_vio);
-            if (ndone == INK_ERROR) {
-                LOG_ERROR("INKVIODoneGet");
+            ndone = TSVIONDoneGet(my_state->p_read_vio);
+            if (ndone == TS_ERROR) {
+                LOG_ERROR("TSVIODoneGet");
             }
 
             my_state->p_read_vio = NULL;
             
-            if (INKVConnShutdown(my_state->p_vc, 1, 0) == INK_ERROR) {
-                LOG_ERROR("INKVConnShutdown");
+            if (TSVConnShutdown(my_state->p_vc, 1, 0) == TS_ERROR) {
+                LOG_ERROR("TSVConnShutdown");
             }
 
             // if client aborted the uploading in middle, need to cleanup the file from disk
-            if (event == INK_EVENT_VCONN_EOS && uconfig->use_disk_buffer && my_state->fd != -1) {
+            if (event == TS_EVENT_VCONN_EOS && uconfig->use_disk_buffer && my_state->fd != -1) {
                 close(my_state->fd);
                 remove(my_state->filename);
                 my_state->fd = -1;
@@ -414,47 +414,47 @@ pvc_process_p_read(INKCont contp, INKEve
             break;
         }
         default:
-            INKReleaseAssert(!"Unexpected Event");
+            TSReleaseAssert(!"Unexpected Event");
             break;
     }
 }
 
 static void
-pvc_process_n_write(INKCont contp, INKEvent event, pvc_state* my_state) {
+pvc_process_n_write(TSCont contp, TSEvent event, pvc_state* my_state) {
 
     LOG_SET_FUNCTION_NAME("pvc_process_n_write"); 
     int bytes;
     int size;
 
-    //INKDebug(DEBUG_TAG, "plugin called: pvc_process_n_write with event %d", event);
+    //TSDebug(DEBUG_TAG, "plugin called: pvc_process_n_write with event %d", event);
 
     switch(event) {
-        case INK_EVENT_VCONN_WRITE_READY:
+        case TS_EVENT_VCONN_WRITE_READY:
             // print_buffer(my_state->req_reader);
             if (uconfig->use_disk_buffer) {
-                INKMutexLock(my_state->disk_io_mutex);
+                TSMutexLock(my_state->disk_io_mutex);
                 size = (my_state->req_size - my_state->read_offset) > uconfig->chunk_size ? uconfig->chunk_size : (my_state->req_size - my_state->read_offset);
                 if (size > 0 && !my_state->is_reading_from_disk) {
                     my_state->is_reading_from_disk = 1;
-                    INKAIORead(my_state->fd, my_state->read_offset, my_state->chunk_buffer, size, contp);
+                    TSAIORead(my_state->fd, my_state->read_offset, my_state->chunk_buffer, size, contp);
                     my_state->read_offset += size;
                 }
-                INKMutexUnlock(my_state->disk_io_mutex);
+                TSMutexUnlock(my_state->disk_io_mutex);
             }
             break;
-        case INK_EVENT_ERROR:
+        case TS_EVENT_ERROR:
             if (my_state->p_read_vio) {
-                if (INKVConnShutdown(my_state->p_vc, 1, 0) == INK_ERROR) {
-                    LOG_ERROR("INKVConnShutdown");
+                if (TSVConnShutdown(my_state->p_vc, 1, 0) == TS_ERROR) {
+                    LOG_ERROR("TSVConnShutdown");
                 }
                 my_state->p_read_vio = NULL;
             }
             /* FALL THROUGH */
-        case INK_EVENT_VCONN_WRITE_COMPLETE:
+        case TS_EVENT_VCONN_WRITE_COMPLETE:
             /* We should have already shutdown read pvc side */
-            INKAssert(my_state->p_read_vio == NULL);
-            if (INKVConnShutdown(my_state->net_vc, 0, 1) == INK_ERROR) {
-                LOG_ERROR("INKVConnShutdown");
+            TSAssert(my_state->p_read_vio == NULL);
+            if (TSVConnShutdown(my_state->net_vc, 0, 1) == TS_ERROR) {
+                LOG_ERROR("TSVConnShutdown");
             }
             my_state->req_finished = 1;
 
@@ -467,125 +467,125 @@ pvc_process_n_write(INKCont contp, INKEv
             break;
 
         default:
-            INKReleaseAssert(!"Unexpected Event");
+            TSReleaseAssert(!"Unexpected Event");
             break;
     }
 }
 
 static void
-pvc_process_n_read(INKCont contp, INKEvent event, pvc_state* my_state) {
+pvc_process_n_read(TSCont contp, TSEvent event, pvc_state* my_state) {
 
     LOG_SET_FUNCTION_NAME("pvc_process_n_read"); 
     int bytes;
 
-    //INKDebug(DEBUG_TAG, "plugin called: pvc_process_n_read with event %d", event);
+    //TSDebug(DEBUG_TAG, "plugin called: pvc_process_n_read with event %d", event);
 
     switch(event) {
-        case INK_EVENT_VCONN_READ_READY:
+        case TS_EVENT_VCONN_READ_READY:
             // print_buffer(my_state->resp_reader);
-            if (INKVIOReenable(my_state->p_write_vio) == INK_ERROR) {
-                LOG_ERROR("INKVIOReenable");
+            if (TSVIOReenable(my_state->p_write_vio) == TS_ERROR) {
+                LOG_ERROR("TSVIOReenable");
             }
             break;
-        case INK_EVENT_VCONN_READ_COMPLETE:
-        case INK_EVENT_VCONN_EOS:
-        case INK_EVENT_ERROR:
+        case TS_EVENT_VCONN_READ_COMPLETE:
+        case TS_EVENT_VCONN_EOS:
+        case TS_EVENT_ERROR:
         {
             /* We're finished reading from the plugin vc */
             int ndone;
             int todo;
 
-            ndone = INKVIONDoneGet(my_state->n_read_vio);
-            if (ndone == INK_ERROR) {
-                LOG_ERROR("INKVIODoneGet");
+            ndone = TSVIONDoneGet(my_state->n_read_vio);
+            if (ndone == TS_ERROR) {
+                LOG_ERROR("TSVIODoneGet");
             }
 
             my_state->n_read_vio = NULL;
-            if (INKVIONBytesSet(my_state->p_write_vio, ndone) == INK_ERROR) {
-                LOG_ERROR("INKVIONBytesSet");
+            if (TSVIONBytesSet(my_state->p_write_vio, ndone) == TS_ERROR) {
+                LOG_ERROR("TSVIONBytesSet");
             }
-            if (INKVConnShutdown(my_state->net_vc, 1, 0) == INK_ERROR) {
-                LOG_ERROR("INKVConnShutdown");
+            if (TSVConnShutdown(my_state->net_vc, 1, 0) == TS_ERROR) {
+                LOG_ERROR("TSVConnShutdown");
             }
 
-            todo = INKVIONTodoGet(my_state->p_write_vio);
-            if (todo == INK_ERROR) {
-                LOG_ERROR("INKVIOTodoGet");
+            todo = TSVIONTodoGet(my_state->p_write_vio);
+            if (todo == TS_ERROR) {
+                LOG_ERROR("TSVIOTodoGet");
                 /* Error so set it to 0 to cleanup */
                 todo = 0;
             }
 
             if (todo == 0) {
                 my_state->resp_finished = 1;
-                if (INKVConnShutdown(my_state->p_vc, 0, 1) == INK_ERROR) {
-                    LOG_ERROR("INKVConnShutdown");
+                if (TSVConnShutdown(my_state->p_vc, 0, 1) == TS_ERROR) {
+                    LOG_ERROR("TSVConnShutdown");
                 }
                 pvc_check_done (contp, my_state);
             } else {
-                if (INKVIOReenable(my_state->p_write_vio) == INK_ERROR) {
-                    LOG_ERROR("INKVIOReenable");
+                if (TSVIOReenable(my_state->p_write_vio) == TS_ERROR) {
+                    LOG_ERROR("TSVIOReenable");
                 }
             }
 
             break;
         }
         default:
-            INKReleaseAssert(!"Unexpected Event");
+            TSReleaseAssert(!"Unexpected Event");
             break;
     }
 }
 
 static void
-pvc_process_p_write(INKCont contp, INKEvent event, pvc_state* my_state) {
+pvc_process_p_write(TSCont contp, TSEvent event, pvc_state* my_state) {
 
     LOG_SET_FUNCTION_NAME("pvc_process_p_write");
     int bytes;
 
-    //INKDebug(DEBUG_TAG, "plugin called: pvc_process_p_write with event %d", event);
+    //TSDebug(DEBUG_TAG, "plugin called: pvc_process_p_write with event %d", event);
 
     switch(event) {
-        case INK_EVENT_VCONN_WRITE_READY:
+        case TS_EVENT_VCONN_WRITE_READY:
             if (my_state->n_read_vio) {
-                if (INKVIOReenable(my_state->n_read_vio) == INK_ERROR) {
-                    LOG_ERROR("INKVIOReenable");
+                if (TSVIOReenable(my_state->n_read_vio) == TS_ERROR) {
+                    LOG_ERROR("TSVIOReenable");
                 }
             }
             break;
-        case INK_EVENT_ERROR:
+        case TS_EVENT_ERROR:
             if (my_state->n_read_vio) {
-                if (INKVConnShutdown(my_state->net_vc, 1, 0) == INK_ERROR) {
+                if (TSVConnShutdown(my_state->net_vc, 1, 0) == TS_ERROR) {
                     LOG_ERROR("INVConnShutdown");
                 }
                 my_state->n_read_vio = NULL;
             }
             /* FALL THROUGH */
-        case INK_EVENT_VCONN_WRITE_COMPLETE:
+        case TS_EVENT_VCONN_WRITE_COMPLETE:
             /* We should have already shutdown read net side */
-            INKAssert(my_state->n_read_vio == NULL);
-            if (INKVConnShutdown(my_state->p_vc, 0, 1) == INK_ERROR) {
-                LOG_ERROR("INKVConnShutdown");
+            TSAssert(my_state->n_read_vio == NULL);
+            if (TSVConnShutdown(my_state->p_vc, 0, 1) == TS_ERROR) {
+                LOG_ERROR("TSVConnShutdown");
             }
             my_state->resp_finished = 1;
             pvc_check_done (contp, my_state);
             break;
         default:
-            INKReleaseAssert(!"Unexpected Event");
+            TSReleaseAssert(!"Unexpected Event");
             break;
     }
 }
 
 static int
-pvc_plugin (INKCont contp, INKEvent event, void *edata)
+pvc_plugin (TSCont contp, TSEvent event, void *edata)
 {
-    pvc_state* my_state = INKContDataGet(contp);
+    pvc_state* my_state = TSContDataGet(contp);
 
     if (my_state == NULL) {
-        INKReleaseAssert(!"Unexpected: my_state is NULL");
+        TSReleaseAssert(!"Unexpected: my_state is NULL");
         return 0;
     }
 
-    if (event == INK_EVENT_NET_ACCEPT ||
-        event == INK_EVENT_NET_ACCEPT_FAILED) {
+    if (event == TS_EVENT_NET_ACCEPT ||
+        event == TS_EVENT_NET_ACCEPT_FAILED) {
         pvc_process_accept(contp, event, edata, my_state);
     } else if (edata == my_state->p_read_vio) {
         pvc_process_p_read(contp, event, my_state);
@@ -595,28 +595,28 @@ pvc_plugin (INKCont contp, INKEvent even
         pvc_process_n_read(contp, event, my_state);
     } else if (edata == my_state->n_write_vio) {
         pvc_process_n_write(contp, event, my_state);
-    } else if (event == INK_AIO_EVENT_DONE && uconfig->use_disk_buffer) {
-        INKMutexLock(my_state->disk_io_mutex);
-        int size = INKAIONBytesGet(edata);
-        char* buf = INKAIOBufGet(edata);
+    } else if (event == TS_AIO_EVENT_DONE && uconfig->use_disk_buffer) {
+        TSMutexLock(my_state->disk_io_mutex);
+        int size = TSAIONBytesGet(edata);
+        char* buf = TSAIOBufGet(edata);
         if (buf != my_state->chunk_buffer) {
-            // this INK_AIO_EVENT_DONE event is from INKAIOWrite()
-            INKDebug(DEBUG_TAG, "aio write size: %d", size);
+            // this TS_AIO_EVENT_DONE event is from TSAIOWrite()
+            TSDebug(DEBUG_TAG, "aio write size: %d", size);
             my_state->size_written += size;
             if (buf != NULL) {
-                INKfree(buf);
+                TSfree(buf);
             }
             if (my_state->size_written >= my_state->req_size) {
                 // the entire post data had been written to disk  already, make the connection now
-                if (call_httpconnect(contp, my_state) == INK_ERROR) {
-                    INKDebug(DEBUG_TAG, "call_httpconnect");
+                if (call_httpconnect(contp, my_state) == TS_ERROR) {
+                    TSDebug(DEBUG_TAG, "call_httpconnect");
                 }
             }
         }
         else {
-            // this INK_AIO_EVENT_DONE event is from INKAIORead()
-            INKDebug(DEBUG_TAG, "aio read size: %d", size);
-            INKIOBufferWrite(my_state->req_buffer, my_state->chunk_buffer, size);
+            // this TS_AIO_EVENT_DONE event is from TSAIORead()
+            TSDebug(DEBUG_TAG, "aio read size: %d", size);
+            TSIOBufferWrite(my_state->req_buffer, my_state->chunk_buffer, size);
             my_state->size_read += size;
             if (my_state->size_read >= my_state->req_size && my_state->fd != -1) {
                 close(my_state->fd);
@@ -624,15 +624,15 @@ pvc_plugin (INKCont contp, INKEvent even
                 my_state->fd = -1;
             }
             my_state->is_reading_from_disk = 0;
-            if (INKVIOReenable(my_state->n_write_vio) == INK_ERROR) {
-                INKError("INKVIOReenable");
+            if (TSVIOReenable(my_state->n_write_vio) == TS_ERROR) {
+                TS_ERROR("TSVIOReenable");
             }
         }
-        INKMutexUnlock(my_state->disk_io_mutex);
+        TSMutexUnlock(my_state->disk_io_mutex);
 
     } else {
-        INKDebug(DEBUG_TAG, "event: %d", event);
-        INKReleaseAssert(!"Unexpected Event");
+        TSDebug(DEBUG_TAG, "event: %d", event);
+        TSReleaseAssert(!"Unexpected Event");
     }
 
     return 0;
@@ -642,23 +642,23 @@ pvc_plugin (INKCont contp, INKEvent even
  *  Convert specific URL format
  */
 static void
-convert_url_func (INKMBuffer req_bufp, INKMLoc req_loc)
+convert_url_func (TSMBuffer req_bufp, TSMLoc req_loc)
 {
-    INKMLoc url_loc;
-    INKMLoc field_loc;
+    TSMLoc url_loc;
+    TSMLoc field_loc;
     const char *str;
     int len, port;
 
-    url_loc = INKHttpHdrUrlGet(req_bufp, req_loc);
+    url_loc = TSHttpHdrUrlGet(req_bufp, req_loc);
     if(NOT_VALID_PTR(url_loc))
         return;
 
     char *hostname = (char *)getenv("HOSTNAME");
 
-    // in reverse proxy mode, INKUrlHostGet returns NULL here
-    str = INKUrlHostGet(req_bufp, url_loc, &len);
+    // in reverse proxy mode, TSUrlHostGet returns NULL here
+    str = TSUrlHostGet(req_bufp, url_loc, &len);
 
-    port = INKUrlPortGet(req_bufp, url_loc);
+    port = TSUrlPortGet(req_bufp, url_loc);
 
     // for now we assume the <upload proxy service domain> in the format is the hostname
     // but this needs to be verified later
@@ -666,62 +666,62 @@ convert_url_func (INKMBuffer req_bufp, I
         char *slash;
         char *colon;
         if (VALID_PTR(str)) 
-            INKHandleStringRelease(req_bufp, url_loc, str);
-        str = INKUrlPathGet(req_bufp, url_loc, &len);
+            TSHandleStringRelease(req_bufp, url_loc, str);
+        str = TSUrlPathGet(req_bufp, url_loc, &len);
         slash = strstr(str, "/");
         if (slash == NULL) {
             if (VALID_PTR(str)) 
-                INKHandleStringRelease(req_bufp, url_loc, str);
-            INKHandleMLocRelease(req_bufp, req_loc, url_loc); 
+                TSHandleStringRelease(req_bufp, url_loc, str);
+            TSHandleMLocRelease(req_bufp, req_loc, url_loc); 
             return;
         }
         char pathTmp[len+1];
         memset(pathTmp, 0, sizeof pathTmp);
         memcpy(pathTmp, str, len);
-        INKDebug(DEBUG_TAG, "convert_url_func working on path: %s", pathTmp);
+        TSDebug(DEBUG_TAG, "convert_url_func working on path: %s", pathTmp);
         colon = strstr(str, ":");
         if (colon != NULL && colon < slash) {
-            char *port_str = (char *)INKmalloc(sizeof(char)*(slash-colon));
+            char *port_str = (char *)TSmalloc(sizeof(char)*(slash-colon));
             strncpy(port_str, colon+1, slash-colon-1);
             port_str[slash-colon-1] = '\0';
-            INKUrlPortSet(req_bufp, url_loc, atoi(port_str));
-            INKfree(port_str);
+            TSUrlPortSet(req_bufp, url_loc, atoi(port_str));
+            TSfree(port_str);
         }
         else {
             if (port != 80) {
-                INKUrlPortSet(req_bufp, url_loc, 80);
+                TSUrlPortSet(req_bufp, url_loc, 80);
             }
             colon = slash;
         }
 
-        INKUrlHostSet(req_bufp, url_loc, str, colon-str);
-        INKUrlPathSet(req_bufp, url_loc, slash+1, len-(slash-str)-1);
-        if ((field_loc = INKMimeHdrFieldRetrieve(req_bufp, req_loc, INK_MIME_FIELD_HOST)) != INK_ERROR_PTR && field_loc != NULL) {
-            INKMimeHdrFieldValueStringSet(req_bufp, req_loc, field_loc, 0, str, slash-str);
-            INKHandleMLocRelease(req_bufp, req_loc, field_loc); 
+        TSUrlHostSet(req_bufp, url_loc, str, colon-str);
+        TSUrlPathSet(req_bufp, url_loc, slash+1, len-(slash-str)-1);
+        if ((field_loc = TSMimeHdrFieldRetrieve(req_bufp, req_loc, TS_MIME_FIELD_HOST)) != TS_ERROR_PTR && field_loc != NULL) {
+            TSMimeHdrFieldValueStringSet(req_bufp, req_loc, field_loc, 0, str, slash-str);
+            TSHandleMLocRelease(req_bufp, req_loc, field_loc); 
         }
     }
     else {
         if (VALID_PTR(str)) 
-            INKHandleStringRelease(req_bufp, url_loc, str);
+            TSHandleStringRelease(req_bufp, url_loc, str);
     }
 
-    INKHandleMLocRelease(req_bufp, req_loc, url_loc); 
+    TSHandleMLocRelease(req_bufp, req_loc, url_loc); 
 }
 
 static int
-attach_pvc_plugin (INKCont contp, INKEvent event, void *edata)
+attach_pvc_plugin (TSCont contp, TSEvent event, void *edata)
 {
     LOG_SET_FUNCTION_NAME("attach_pvc_plugin");
 
-    INKHttpTxn txnp = (INKHttpTxn) edata;
-    INKMutex mutex;
-    INKCont new_cont;
+    TSHttpTxn txnp = (TSHttpTxn) edata;
+    TSMutex mutex;
+    TSCont new_cont;
     pvc_state* my_state;
-    INKMBuffer req_bufp;
-    INKMLoc req_loc;
-    INKMLoc field_loc;
-    INKMLoc url_loc;
+    TSMBuffer req_bufp;
+    TSMLoc req_loc;
+    TSMLoc field_loc;
+    TSMLoc url_loc;
     char* url;
     int url_len;
     int value;
@@ -734,141 +734,141 @@ attach_pvc_plugin (INKCont contp, INKEve
     const char *ptr;
     
     switch (event) {
-    case INK_EVENT_HTTP_READ_REQUEST_PRE_REMAP:
+    case TS_EVENT_HTTP_READ_REQUEST_PRE_REMAP:
 
-        // if the request is issued by the INKHttpConnect() in this plugin, don't get in the endless cycle.
-        if (INKHttpIsInternalRequest(txnp)) {
+        // if the request is issued by the TSHttpConnect() in this plugin, don't get in the endless cycle.
+        if (TSHttpIsInternalRequest(txnp)) {
             break;
         }
         
-        if (!INKHttpTxnClientReqGet (txnp, &req_bufp, &req_loc)) {
+        if (!TSHttpTxnClientReqGet (txnp, &req_bufp, &req_loc)) {
             LOG_ERROR("Error while retrieving client request header");
             break;
         }
 
-        method = INKHttpHdrMethodGet(req_bufp, req_loc, &method_len);
+        method = TSHttpHdrMethodGet(req_bufp, req_loc, &method_len);
 
         if (NOT_VALID_PTR(method) || method_len == 0)
         {
-            INKHandleMLocRelease(req_bufp, INK_NULL_MLOC, req_loc);
+            TSHandleMLocRelease(req_bufp, TS_NULL_MLOC, req_loc);
             break;
         }
         
         // only deal with POST method
-        if (method_len != strlen(INK_HTTP_METHOD_POST) || strncasecmp(method, INK_HTTP_METHOD_POST, method_len) != 0)
+        if (method_len != strlen(TS_HTTP_METHOD_POST) || strncasecmp(method, TS_HTTP_METHOD_POST, method_len) != 0)
         {
-            INKHandleStringRelease(req_bufp, req_loc, method);
-            INKHandleMLocRelease(req_bufp, INK_NULL_MLOC, req_loc);
+            TSHandleStringRelease(req_bufp, req_loc, method);
+            TSHandleMLocRelease(req_bufp, TS_NULL_MLOC, req_loc);
             break;
         }
 
-        INKHandleStringRelease(req_bufp, req_loc, method);
+        TSHandleStringRelease(req_bufp, req_loc, method);
 
-        INKDebug(DEBUG_TAG, "Got POST req");
+        TSDebug(DEBUG_TAG, "Got POST req");
         if (uconfig->url_list_file != NULL)
         {
-            INKDebug(DEBUG_TAG, "url_list_file != NULL");
+            TSDebug(DEBUG_TAG, "url_list_file != NULL");
             // check against URL list
-            url_loc = INKHttpHdrUrlGet(req_bufp, req_loc);
-            str = INKUrlHostGet(req_bufp, url_loc, &str_len);
+            url_loc = TSHttpHdrUrlGet(req_bufp, req_loc);
+            str = TSUrlHostGet(req_bufp, url_loc, &str_len);
             if (NOT_VALID_PTR(str) || str_len <= 0) {
                 // reverse proxy mode
-                field_loc=INKMimeHdrFieldFind(req_bufp, req_loc, INK_MIME_FIELD_HOST, -1);
+                field_loc=TSMimeHdrFieldFind(req_bufp, req_loc, TS_MIME_FIELD_HOST, -1);
                 if (NOT_VALID_PTR(field_loc)) {
                     if(VALID_PTR(str))
-                        INKHandleStringRelease(req_bufp, url_loc, str);
+                        TSHandleStringRelease(req_bufp, url_loc, str);
                     LOG_ERROR("Host field not found.");
-                    INKHandleMLocRelease(req_bufp, req_loc, url_loc);
-                    INKHandleMLocRelease(req_bufp, INK_NULL_MLOC, req_loc);
+                    TSHandleMLocRelease(req_bufp, req_loc, url_loc);
+                    TSHandleMLocRelease(req_bufp, TS_NULL_MLOC, req_loc);
                     break;
                 }
-                str=INKMimeHdrFieldValueGet (req_bufp, req_loc, field_loc, 0, &str_len);
+                str=TSMimeHdrFieldValueGet (req_bufp, req_loc, field_loc, 0, &str_len);
                 if (NOT_VALID_PTR(str) || str_len <= 0) {
                     if(VALID_PTR(str))
-                        INKHandleStringRelease(req_bufp, field_loc, str);
-                    INKHandleMLocRelease(req_bufp, req_loc, field_loc);
-                    INKHandleMLocRelease(req_bufp, req_loc, url_loc);
-                    INKHandleMLocRelease(req_bufp, INK_NULL_MLOC, req_loc);
+                        TSHandleStringRelease(req_bufp, field_loc, str);
+                    TSHandleMLocRelease(req_bufp, req_loc, field_loc);
+                    TSHandleMLocRelease(req_bufp, req_loc, url_loc);
+                    TSHandleMLocRelease(req_bufp, TS_NULL_MLOC, req_loc);
                     break;
                 }
 
                 char replacement_host_str[str_len+1];
                 memset(replacement_host_str, 0, sizeof replacement_host_str);
                 memcpy(replacement_host_str, str, str_len);
-                INKDebug(DEBUG_TAG, "Adding host to request url: %s", replacement_host_str);
+                TSDebug(DEBUG_TAG, "Adding host to request url: %s", replacement_host_str);
 
-                INKUrlHostSet(req_bufp, url_loc, str, str_len);
+                TSUrlHostSet(req_bufp, url_loc, str, str_len);
 
-                INKHandleStringRelease(req_bufp, field_loc, str);
-                INKHandleMLocRelease(req_bufp, req_loc, field_loc);
+                TSHandleStringRelease(req_bufp, field_loc, str);
+                TSHandleMLocRelease(req_bufp, req_loc, field_loc);
             }
             else {
-                INKHandleStringRelease(req_bufp, url_loc, str);
+                TSHandleStringRelease(req_bufp, url_loc, str);
             }
 
             int i = uconfig->url_num;
-            url = INKUrlStringGet(req_bufp, url_loc, &url_len);
+            url = TSUrlStringGet(req_bufp, url_loc, &url_len);
             if(VALID_PTR(url))
             {
                 char urlStr[url_len+1];
                 memset(urlStr, 0, sizeof urlStr);
                 memcpy(urlStr, url, url_len);
-                INKDebug(DEBUG_TAG, "Request url: %s", urlStr);
+                TSDebug(DEBUG_TAG, "Request url: %s", urlStr);
                 
                 for (i = 0; i < uconfig->url_num; i++) {
-                    INKDebug(DEBUG_TAG, "uconfig url: %s", uconfig->urls[i]);
+                    TSDebug(DEBUG_TAG, "uconfig url: %s", uconfig->urls[i]);
                     if (strncmp (url, uconfig->urls[i], url_len) == 0) {
                         break;
                     }
                 }
 
-                INKHandleStringRelease(req_bufp, url_loc, url);
+                TSHandleStringRelease(req_bufp, url_loc, url);
             }
-            INKHandleMLocRelease(req_bufp, req_loc, url_loc);
+            TSHandleMLocRelease(req_bufp, req_loc, url_loc);
 
             if (uconfig->url_num > 0 && i == uconfig->url_num) {
-                INKDebug(DEBUG_TAG, "breaking: url_num > 0 and i== url_num, URL match not found");
-                INKHandleMLocRelease(req_bufp, INK_NULL_MLOC, req_loc);
+                TSDebug(DEBUG_TAG, "breaking: url_num > 0 and i== url_num, URL match not found");
+                TSHandleMLocRelease(req_bufp, TS_NULL_MLOC, req_loc);
                 break;
             }
         }
 
         if (uconfig->convert_url) {
-            INKDebug(DEBUG_TAG, "doing convert url");
+            TSDebug(DEBUG_TAG, "doing convert url");
             convert_url_func(req_bufp, req_loc);
         }
         
-        if ((field_loc = INKMimeHdrFieldRetrieve(req_bufp, req_loc, INK_MIME_FIELD_CONTENT_LENGTH)) == INK_ERROR_PTR || field_loc == NULL) {
-            INKHandleMLocRelease(req_bufp, INK_NULL_MLOC, req_loc);
-            LOG_ERROR("INKMimeHdrFieldRetrieve");
+        if ((field_loc = TSMimeHdrFieldRetrieve(req_bufp, req_loc, TS_MIME_FIELD_CONTENT_LENGTH)) == TS_ERROR_PTR || field_loc == NULL) {
+            TSHandleMLocRelease(req_bufp, TS_NULL_MLOC, req_loc);
+            LOG_ERROR("TSMimeHdrFieldRetrieve");
             break;
         }       
 
-        if (INKMimeHdrFieldValueIntGet(req_bufp, req_loc, field_loc, 0, &value) == INK_ERROR) {
-            INKHandleMLocRelease(req_bufp, req_loc, field_loc);
-            INKHandleMLocRelease(req_bufp, INK_NULL_MLOC, req_loc);
-            LOG_ERROR("INKMimeFieldValueGet");
+        if (TSMimeHdrFieldValueIntGet(req_bufp, req_loc, field_loc, 0, &value) == TS_ERROR) {
+            TSHandleMLocRelease(req_bufp, req_loc, field_loc);
+            TSHandleMLocRelease(req_bufp, TS_NULL_MLOC, req_loc);
+            LOG_ERROR("TSMimeFieldValueGet");
         }
         else
             content_length = value;
        
-        mutex = INKMutexCreate();
+        mutex = TSMutexCreate();
         if (NOT_VALID_PTR(mutex)) {
-            INKHandleMLocRelease(req_bufp, req_loc, field_loc);
-            INKHandleMLocRelease(req_bufp, INK_NULL_MLOC, req_loc);
-            LOG_ERROR("INKMutexCreate");
+            TSHandleMLocRelease(req_bufp, req_loc, field_loc);
+            TSHandleMLocRelease(req_bufp, TS_NULL_MLOC, req_loc);
+            LOG_ERROR("TSMutexCreate");
             break;
         }
 
-        new_cont = INKContCreate (pvc_plugin, mutex);
+        new_cont = TSContCreate (pvc_plugin, mutex);
         if (NOT_VALID_PTR(new_cont)) {
-            INKHandleMLocRelease(req_bufp, req_loc, field_loc);
-            INKHandleMLocRelease(req_bufp, INK_NULL_MLOC, req_loc);
-            LOG_ERROR("INKContCreate");
+            TSHandleMLocRelease(req_bufp, req_loc, field_loc);
+            TSHandleMLocRelease(req_bufp, TS_NULL_MLOC, req_loc);
+            LOG_ERROR("TSContCreate");
             break;
         }
 
-        my_state = (pvc_state*) INKmalloc(sizeof(pvc_state));
+        my_state = (pvc_state*) TSmalloc(sizeof(pvc_state));
         my_state->req_size = content_length;
         my_state->p_vc = NULL;
         my_state->p_read_vio = NULL;
@@ -898,41 +898,41 @@ attach_pvc_plugin (INKCont contp, INKEve
         my_state->read_offset = 0;
         my_state->is_reading_from_disk = 0;
 
-        my_state->chunk_buffer = (char *)INKmalloc(sizeof(char)*uconfig->chunk_size);
+        my_state->chunk_buffer = (char *)TSmalloc(sizeof(char)*uconfig->chunk_size);
 
-        my_state->disk_io_mutex = INKMutexCreate();
+        my_state->disk_io_mutex = TSMutexCreate();
         if (NOT_VALID_PTR(my_state->disk_io_mutex)) {
-            LOG_ERROR("INKMutexCreate");
+            LOG_ERROR("TSMutexCreate");
         }
 
         int size;
         
-        my_state->req_hdr_buffer = INKIOBufferCreate();
-        my_state->req_hdr_reader = INKIOBufferReaderAlloc( my_state->req_hdr_buffer ); 
-        INKHttpHdrPrint( req_bufp, req_loc, my_state->req_hdr_buffer );
+        my_state->req_hdr_buffer = TSIOBufferCreate();
+        my_state->req_hdr_reader = TSIOBufferReaderAlloc( my_state->req_hdr_buffer ); 
+        TSHttpHdrPrint( req_bufp, req_loc, my_state->req_hdr_buffer );
         // print_buffer(my_state->req_hdr_reader);
 
-        my_state->req_size += INKIOBufferReaderAvail(my_state->req_hdr_reader);
+        my_state->req_size += TSIOBufferReaderAvail(my_state->req_hdr_reader);
 
         /* Increment upload_vc_count */
-        INKStatIncrement(upload_vc_count);
+        TSStatIncrement(upload_vc_count);
 
         if (!uconfig->use_disk_buffer && my_state->req_size > uconfig->mem_buffer_size) {
-            INKDebug(DEBUG_TAG, "The request size %lu is larger than memory buffer size %lu, bypass upload proxy feature for this request.", 
+            TSDebug(DEBUG_TAG, "The request size %lu is larger than memory buffer size %lu, bypass upload proxy feature for this request.", 
                     my_state->req_size, uconfig->mem_buffer_size); 
 
             pvc_cleanup(new_cont, my_state);
-            INKHandleMLocRelease(req_bufp, req_loc, field_loc);
-            INKHandleMLocRelease(req_bufp, INK_NULL_MLOC, req_loc);
+            TSHandleMLocRelease(req_bufp, req_loc, field_loc);
+            TSHandleMLocRelease(req_bufp, TS_NULL_MLOC, req_loc);
             break;
         }
 
-        if (INKContDataSet(new_cont, my_state) == INK_ERROR) {
-            LOG_ERROR("INKContDataSet");
+        if (TSContDataSet(new_cont, my_state) == TS_ERROR) {
+            LOG_ERROR("TSContDataSet");
 
             pvc_cleanup(new_cont, my_state);
-            INKHandleMLocRelease(req_bufp, req_loc, field_loc);
-            INKHandleMLocRelease(req_bufp, INK_NULL_MLOC, req_loc);
+            TSHandleMLocRelease(req_bufp, req_loc, field_loc);
+            TSHandleMLocRelease(req_bufp, TS_NULL_MLOC, req_loc);
             break;
         }
 
@@ -954,7 +954,7 @@ attach_pvc_plugin (INKCont contp, INKEve
             */
 
             my_state->filename = tempnam(path, NULL);
-            INKDebug(DEBUG_TAG, "temp filename: %s", my_state->filename);
+            TSDebug(DEBUG_TAG, "temp filename: %s", my_state->filename);
 
             my_state->fd = open(my_state->filename, O_RDWR|O_NONBLOCK|O_TRUNC|O_CREAT);
             if (my_state->fd < 0) {
@@ -965,24 +965,24 @@ attach_pvc_plugin (INKCont contp, INKEve
         }
 
 
-        INKDebug(DEBUG_TAG, "calling INKHttpTxnIntercept() ...");
-        if (INKHttpTxnIntercept(new_cont, txnp) == INK_ERROR) {
-            LOG_ERROR("INKHttpTxnIntercept");
+        TSDebug(DEBUG_TAG, "calling TSHttpTxnIntercept() ...");
+        if (TSHttpTxnIntercept(new_cont, txnp) == TS_ERROR) {
+            LOG_ERROR("TSHttpTxnIntercept");
 
             pvc_cleanup(new_cont, my_state);
-            INKHandleMLocRelease(req_bufp, req_loc, field_loc);
-            INKHandleMLocRelease(req_bufp, INK_NULL_MLOC, req_loc);
+            TSHandleMLocRelease(req_bufp, req_loc, field_loc);
+            TSHandleMLocRelease(req_bufp, TS_NULL_MLOC, req_loc);
             break;
         }
 
         break;
     default:
-        INKReleaseAssert(!"Unexpected Event");
+        TSReleaseAssert(!"Unexpected Event");
         break;
     }
 
-    if (INKHttpTxnReenable(txnp, INK_EVENT_HTTP_CONTINUE) == INK_ERROR) {
-        LOG_ERROR_AND_RETURN("INKHttpTxnReenable");
+    if (TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE) == TS_ERROR) {
+        LOG_ERROR_AND_RETURN("TSHttpTxnReenable");
     }
 
     return 0;
@@ -999,26 +999,26 @@ create_directory()
     struct passwd *pwd;
 
     if (getcwd(cwd, 4096) == NULL) {
-        INKError("getcwd fails");
+        TS_ERROR("getcwd fails");
         return 0;
     }
 
     if ((pwd = getpwnam("nobody")) == NULL) {
-        INKError("can't get passwd entry for \"nobody\"");
+        TS_ERROR("can't get passwd entry for \"nobody\"");
         goto error_out;
     }
 
     if (chdir(uconfig->base_dir) < 0) {
         if (mkdir(uconfig->base_dir, S_IRWXU | S_IRWXG | S_IRWXO) < 0) {
-            INKError("Unable to enter or create %s", uconfig->base_dir);
+            TS_ERROR("Unable to enter or create %s", uconfig->base_dir);
             goto error_out;
         }
         if (chown(uconfig->base_dir, pwd->pw_uid, pwd->pw_gid) < 0) {
-            INKError("Unable to chown %s", uconfig->base_dir);
+            TS_ERROR("Unable to chown %s", uconfig->base_dir);
             goto error_out;
         }
         if (chdir(uconfig->base_dir) < 0) {
-            INKError("Unable enter %s", uconfig->base_dir);
+            TS_ERROR("Unable enter %s", uconfig->base_dir);
             goto error_out;
         }
     }
@@ -1026,15 +1026,15 @@ create_directory()
         snprintf(str, 10, "%02X", i);
         if (chdir(str) < 0) {
             if (mkdir(str, S_IRWXU | S_IRWXG | S_IRWXO) < 0) {
-                INKError("Unable to enter or create %s/%s", uconfig->base_dir, str);
+                TS_ERROR("Unable to enter or create %s/%s", uconfig->base_dir, str);
                 goto error_out;
             }
             if (chown(str, pwd->pw_uid, pwd->pw_gid) < 0) {
-                INKError("Unable to chown %s", str);
+                TS_ERROR("Unable to chown %s", str);
                 goto error_out;
             }
             if (chdir(str) < 0) {
-                INKError("Unable to enter %s/%s", uconfig->base_dir, str);
+                TS_ERROR("Unable to enter %s/%s", uconfig->base_dir, str);
                 goto error_out;
             }
         }
@@ -1057,30 +1057,30 @@ error_out:
 static void
 load_urls(char *filename)
 {
-    INKFile file;
+    TSFile file;
     char *url_buf;
     char* eol;
     int i;
 
-    url_buf = (char *)INKmalloc(sizeof(char)*(uconfig->max_url_length + 1));
+    url_buf = (char *)TSmalloc(sizeof(char)*(uconfig->max_url_length + 1));
     url_buf[uconfig->max_url_length] = '\0';
 
     for (i = 0; i < 2; i++) {
-        if ((file = INKfopen(filename, "r")) == NULL) {
-            INKfree(url_buf);
-            INKError("Fail to open %s", filename);
+        if ((file = TSfopen(filename, "r")) == NULL) {
+            TSfree(url_buf);
+            TS_ERROR("Fail to open %s", filename);
             return;
         }
         if (i == 0) {  //first round
             uconfig->url_num = 0;
-            while (INKfgets (file, url_buf, uconfig->max_url_length) != NULL) {
+            while (TSfgets (file, url_buf, uconfig->max_url_length) != NULL) {
                 uconfig->url_num++;
             }
-            uconfig->urls = (char **)INKmalloc(sizeof(char *)*uconfig->url_num);
+            uconfig->urls = (char **)TSmalloc(sizeof(char *)*uconfig->url_num);
         }
         else {   //second round
             int idx = 0;
-            while (INKfgets (file, url_buf, uconfig->max_url_length) != NULL && idx < uconfig->url_num) {
+            while (TSfgets (file, url_buf, uconfig->max_url_length) != NULL && idx < uconfig->url_num) {
                 if ((eol = strstr(url_buf, "\r\n")) != NULL) {
                     /* To handle newlines on Windows */
                     *eol = '\0';
@@ -1090,14 +1090,14 @@ load_urls(char *filename)
                     /* Not a valid line, skip it */
                     continue;
                 }
-                uconfig->urls[idx] = INKstrdup(url_buf);
+                uconfig->urls[idx] = TSstrdup(url_buf);
                 idx++;
             }
             uconfig->url_num = idx;
         }
-        INKfclose(file);
+        TSfclose(file);
     }
-    INKfree(url_buf);
+    TSfree(url_buf);
 }
 
 
@@ -1119,8 +1119,8 @@ parse_config_line( char* line, const str
                         int iv = strtol(tok, &end, 10);
                         if ( end && *end == '\0' ) {
                             *((int*)cv->val) = iv;
-                            INKError("Parsed int config value %s : %d", cv->str, iv);
-                            INKDebug(DEBUG_TAG, "Parsed int config value %s : %d", cv->str, iv);
+                            TS_ERROR("Parsed int config value %s : %d", cv->str, iv);
+                            TSDebug(DEBUG_TAG, "Parsed int config value %s : %d", cv->str, iv);
                         }
                         break;            
                     }
@@ -1129,8 +1129,8 @@ parse_config_line( char* line, const str
                         unsigned int uiv = strtoul(tok, &end, 10);
                         if ( end && *end == '\0' ) {
                             *((unsigned int*)cv->val) = uiv;
-                            INKError("Parsed uint config value %s : %u", cv->str, uiv);
-                            INKDebug(DEBUG_TAG, "Parsed uint config value %s : %u", cv->str, uiv);
+                            TS_ERROR("Parsed uint config value %s : %u", cv->str, uiv);
+                            TSDebug(DEBUG_TAG, "Parsed uint config value %s : %u", cv->str, uiv);
                         }
                         break;
                     }
@@ -1139,8 +1139,8 @@ parse_config_line( char* line, const str
                         long lv = strtol(tok, &end, 10);
                         if ( end && *end == '\0' ) {
                             *((long*)cv->val) = lv;
-                            INKError("Parsed long config value %s : %ld", cv->str, lv);
-                            INKDebug(DEBUG_TAG, "Parsed long config value %s : %ld", cv->str, lv);
+                            TS_ERROR("Parsed long config value %s : %ld", cv->str, lv);
+                            TSDebug(DEBUG_TAG, "Parsed long config value %s : %ld", cv->str, lv);
                         }
                         break;
                     }
@@ -1149,18 +1149,18 @@ parse_config_line( char* line, const str
                         unsigned long ulv = strtoul(tok, &end, 10);
                         if ( end && *end == '\0' ) {
                             *((unsigned long*)cv->val) = ulv;
-                            INKError("Parsed ulong config value %s : %lu", cv->str, ulv);
-                            INKDebug(DEBUG_TAG, "Parsed ulong config value %s : %lu", cv->str, ulv);
+                            TS_ERROR("Parsed ulong config value %s : %lu", cv->str, ulv);
+                            TSDebug(DEBUG_TAG, "Parsed ulong config value %s : %lu", cv->str, ulv);
                         }
                         break;
                     }
                     case TYPE_STRING: {
                         size_t len = strlen( tok );
                         if ( len > 0 ) {
-                            *((char**)cv->val) = (char*)INKmalloc( len+1 );
+                            *((char**)cv->val) = (char*)TSmalloc( len+1 );
                             strcpy( *((char**)cv->val), tok );
-                            INKError("Parsed string config value %s : %s", cv->str, tok);
-                            INKDebug(DEBUG_TAG, "Parsed string config value %s : %s", cv->str, tok);
+                            TS_ERROR("Parsed string config value %s : %s", cv->str, tok);
+                            TSDebug(DEBUG_TAG, "Parsed string config value %s : %s", cv->str, tok);
                         }
                         break;
                     }
@@ -1171,8 +1171,8 @@ parse_config_line( char* line, const str
                                 *((bool*)cv->val) = true;
                             else 
                                 *((bool*)cv->val) = false;
-                            INKError("Parsed bool config value %s : %d", cv->str, *((bool*)cv->val));
-                            INKDebug(DEBUG_TAG, "Parsed bool config value %s : %d", cv->str, *((bool*)cv->val));
+                            TS_ERROR("Parsed bool config value %s : %d", cv->str, *((bool*)cv->val));
+                            TSDebug(DEBUG_TAG, "Parsed bool config value %s : %d", cv->str, *((bool*)cv->val));
                         }
                         break;
                     }
@@ -1189,8 +1189,8 @@ parse_config_line( char* line, const str
 bool
 read_upload_config(const char* file_name)
 {
-    INKDebug(DEBUG_TAG, "read_upload_config: %s", file_name);
-    uconfig = (upload_config *)INKmalloc(sizeof(upload_config));
+    TSDebug(DEBUG_TAG, "read_upload_config: %s", file_name);
+    uconfig = (upload_config *)TSmalloc(sizeof(upload_config));
     uconfig->use_disk_buffer = true;
     uconfig->convert_url = false;
     uconfig->chunk_size = 16*1024;
@@ -1215,25 +1215,25 @@ read_upload_config(const char* file_name
         {"thread_num", TYPE_UINT, &(uconfig->thread_num)},
         {NULL, TYPE_LONG, NULL}
     };
-    INKFile conf_file;
-    conf_file = INKfopen(file_name, "r");
+    TSFile conf_file;
+    conf_file = TSfopen(file_name, "r");
 
     if ( conf_file != NULL ) {
-        INKDebug(DEBUG_TAG, "opened config: %s", file_name);
+        TSDebug(DEBUG_TAG, "opened config: %s", file_name);
         char buf[1024];
-        while ( INKfgets(conf_file, buf, sizeof(buf)-1) != NULL) {
+        while ( TSfgets(conf_file, buf, sizeof(buf)-1) != NULL) {
             if (buf[0] != '#') {
                 parse_config_line(buf, config_vals);
             }
         }
-        INKfclose (conf_file);
+        TSfclose (conf_file);
     } else {
-        INKError("Failed to open upload config file %s", file_name);
+        TS_ERROR("Failed to open upload config file %s", file_name);
         // if fail to open config file, use the default config
     }
 
     if (uconfig->base_dir == NULL) {
-        uconfig->base_dir = INKstrdup("/FOOBAR/var/buffer_upload_tmp");
+        uconfig->base_dir = TSstrdup("/FOOBAR/var/buffer_upload_tmp");
     }
     else {
         // remove the "/" at the end.
@@ -1255,44 +1255,44 @@ read_upload_config(const char* file_name
 }
 
 void
-INKPluginInit (int argc, const char *argv[])
+TSPluginInit (int argc, const char *argv[])
 {
-    LOG_SET_FUNCTION_NAME("INKPluginInit");
+    LOG_SET_FUNCTION_NAME("TSPluginInit");
 
-    INKMLoc field_loc;
+    TSMLoc field_loc;
     const char *p;
     int i;
     int c;
-    INKPluginRegistrationInfo info;
-    INKCont contp;
+    TSPluginRegistrationInfo info;
+    TSCont contp;
     char default_filename[1024];
     const char* conf_filename;
 
     if (argc > 1) { 
         conf_filename = argv[1];
     } else {
-        sprintf(default_filename, "%s/upload.conf", INKPluginDirGet());
+        sprintf(default_filename, "%s/upload.conf", TSPluginDirGet());
         conf_filename = default_filename;
     }
 
     if (!read_upload_config(conf_filename) || !uconfig) {
         if (argc > 1) {
-            INKError("Failed to read upload config %s\n", argv[1]);
+            TS_ERROR("Failed to read upload config %s\n", argv[1]);
         } else {
-            INKError("No config file specified. Specify conf file in plugin.conf: "
+            TS_ERROR("No config file specified. Specify conf file in plugin.conf: "
                                             "'buffer_upload.so /path/to/upload.conf'\n");
         }
     }
 
     // set the num of threads for disk AIO
-    if (INKAIOThreadNumSet(uconfig->thread_num) == INK_ERROR) {
-        INKError("Failed to set thread number.");
+    if (TSAIOThreadNumSet(uconfig->thread_num) == TS_ERROR) {
+        TS_ERROR("Failed to set thread number.");
     }
     
-    INKDebug(DEBUG_TAG, "uconfig->url_list_file: %s", uconfig->url_list_file);
+    TSDebug(DEBUG_TAG, "uconfig->url_list_file: %s", uconfig->url_list_file);
     if (uconfig->url_list_file) {
         load_urls(uconfig->url_list_file);
-        INKDebug(DEBUG_TAG, "loaded uconfig->url_list_file, num urls: %d", uconfig->url_num);
+        TSDebug(DEBUG_TAG, "loaded uconfig->url_list_file, num urls: %d", uconfig->url_num);
     }
 
     info.plugin_name = "buffer_upload";
@@ -1300,26 +1300,26 @@ INKPluginInit (int argc, const char *arg
     info.support_email = "";
 
     if (uconfig->use_disk_buffer && !create_directory()) {
-        INKError("Directory creation failed.");
+        TS_ERROR("Directory creation failed.");
         uconfig->use_disk_buffer = 0;
     }
 
-    if (!INKPluginRegister (INK_SDK_VERSION_2_0 , &info)) {
-        INKError("Plugin registration failed.");
+    if (!TSPluginRegister (TS_SDK_VERSION_2_0 , &info)) {
+        TS_ERROR("Plugin registration failed.");
     }
 
     /* create the statistic variables */
-    upload_vc_count = INKStatCreate ("upload_vc.count", INKSTAT_TYPE_INT64);
-    if (upload_vc_count == INK_ERROR_PTR) {
-        LOG_ERROR("INKStatsCreate");
+    upload_vc_count = TSStatCreate ("upload_vc.count", TSSTAT_TYPE_INT64);
+    if (upload_vc_count == TS_ERROR_PTR) {
+        LOG_ERROR("TSStatsCreate");
     }
 
-    contp = INKContCreate (attach_pvc_plugin, NULL);
-    if (contp == INK_ERROR_PTR) {
-        LOG_ERROR("INKContCreate");
+    contp = TSContCreate (attach_pvc_plugin, NULL);
+    if (contp == TS_ERROR_PTR) {
+        LOG_ERROR("TSContCreate");
     } else {
-        if (INKHttpHookAdd (INK_HTTP_READ_REQUEST_PRE_REMAP_HOOK, contp) == INK_ERROR) {
-            LOG_ERROR("INKHttpHookAdd");
+        if (TSHttpHookAdd (TS_HTTP_READ_REQUEST_PRE_REMAP_HOOK, contp) == TS_ERROR) {
+            LOG_ERROR("TSHttpHookAdd");
         }
     }
 }



Mime
View raw message