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

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

Modified: trafficserver/traffic/branches/wccp/test/plugin/climate/climate.c
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/test/plugin/climate/climate.c?rev=1040383&r1=1040382&r2=1040383&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/test/plugin/climate/climate.c (original)
+++ trafficserver/traffic/branches/wccp/test/plugin/climate/climate.c Tue Nov 30 01:42:55 2010
@@ -30,8 +30,8 @@
 
   Basic design:
 
-  1. INK_HTTP_TXN_START_HOOK is added to the main plug-in
-  continuation as a global hook in INKPluginInit().
+  1. TS_HTTP_TXN_START_HOOK is added to the main plug-in
+  continuation as a global hook in TSPluginInit().
 
   2. global_http_handler() is called for each transaction.
 
@@ -39,10 +39,10 @@
   each transaction, register transaction hooks and
   allocates data.
 
-  4. INK_HTTP_(READ|SEND)_(REQUEST|RESPONSE)_HDR_HOOKs log
+  4. TS_HTTP_(READ|SEND)_(REQUEST|RESPONSE)_HDR_HOOKs log
   timing information.
 
-  5. INK_HTTP_TXN_CLOSE retrieves and logs transaction
+  5. TS_HTTP_TXN_CLOSE retrieves and logs transaction
   information,  client request/server response headers
   and timing information.
 
@@ -53,7 +53,7 @@
 #include <sys/time.h>
 
 #include "ts.h"
-#include "ts_private.h"
+#include "experimental.h"
 
 #include "events.h"
 
@@ -77,7 +77,7 @@ typedef struct
 {
   unsigned int txn_id;
 
-  INKAction pending_action;
+  TSAction pending_action;
 
   unsigned int client_ip;
   char *method;
@@ -120,15 +120,15 @@ typedef struct
 
 
 /* Event handler management */
-typedef int (*TransactionStateHandler) (INKCont contp, INKEvent event, void *edata, TransactionData * data);
+typedef int (*TransactionStateHandler) (TSCont contp, TSEvent event, void *edata, TransactionData * data);
 
 
 
 /* Unique txn ID management */
 static unsigned int id = 0;
-static INKMutex id_mutex;
-#define INIT_TXN_ID {id=0; id_mutex=INKMutexCreate(); }
-#define INC_AND_GET_TXN_ID(_x) {INKMutexLock(id_mutex); _x = id++; INKMutexUnlock(id_mutex); }
+static TSMutex id_mutex;
+#define INIT_TXN_ID {id=0; id_mutex=TSMutexCreate(); }
+#define INC_AND_GET_TXN_ID(_x) {TSMutexLock(id_mutex); _x = id++; TSMutexUnlock(id_mutex); }
 
 
 /* Log stuff */
@@ -136,13 +136,13 @@ static INKMutex id_mutex;
 /* The plugin can roll manually its log if this feature is not enabled in TS */
 #ifdef LOG_ROLL
 #define DEFAULT_LOG_NBMAX_ENTRIES 1000000       /* default number max of entries in one transaction log */
-static INKMutex log_mutex;
+static TSMutex log_mutex;
 static int log_nb_rollover;
 static int log_nb_entries;
 static int log_nbmax_entries;
 #endif /* LOG_ROLL */
 
-static INKTextLogObject log;
+static TSTextLogObject log;
 
 
 /*------------------------------------------------------
@@ -151,20 +151,20 @@ FUNCTIONS
 
 TransactionData *transaction_data_alloc();
 void transaction_data_destroy(TransactionData * data);
-int delete_transaction(INKCont contp, TransactionData * data);
-void INKPluginInit(int argc, const char *argv[]);
+int delete_transaction(TSCont contp, TransactionData * data);
+void TSPluginInit(int argc, const char *argv[]);
 void create_new_log();
-int global_http_handler(INKCont contp, INKEvent event, void *edata);
-void new_transaction(INKHttpTxn txnp);
-int transaction_handler(INKCont contp, INKEvent event, void *edata);
-int read_request_hdr_handler(INKCont contp, INKEvent event, void *edata, TransactionData * data);
-int send_request_hdr_handler(INKCont contp, INKEvent event, void *edata, TransactionData * data);
-int read_response_hdr_handler(INKCont contp, INKEvent event, void *edata, TransactionData * data);
-int send_response_hdr_handler(INKCont contp, INKEvent event, void *edata, TransactionData * data);
-int txn_close_handler(INKCont contp, INKEvent event, void *edata, TransactionData * data);
-int retrieve_transaction_info(INKHttpTxn txnp, TransactionData * data);
-int log_transaction_info(INKCont contp, TransactionData * data);
-void print_mime_headers(INKMBuffer bufp, INKMLoc hdr_loc, char **output_string);
+int global_http_handler(TSCont contp, TSEvent event, void *edata);
+void new_transaction(TSHttpTxn txnp);
+int transaction_handler(TSCont contp, TSEvent event, void *edata);
+int read_request_hdr_handler(TSCont contp, TSEvent event, void *edata, TransactionData * data);
+int send_request_hdr_handler(TSCont contp, TSEvent event, void *edata, TransactionData * data);
+int read_response_hdr_handler(TSCont contp, TSEvent event, void *edata, TransactionData * data);
+int send_response_hdr_handler(TSCont contp, TSEvent event, void *edata, TransactionData * data);
+int txn_close_handler(TSCont contp, TSEvent event, void *edata, TransactionData * data);
+int retrieve_transaction_info(TSHttpTxn txnp, TransactionData * data);
+int log_transaction_info(TSCont contp, TransactionData * data);
+void print_mime_headers(TSMBuffer bufp, TSMLoc hdr_loc, char **output_string);
 
 
 
@@ -175,7 +175,7 @@ transaction_data_alloc()
 {
   TransactionData *data;
 
-  data = (TransactionData *) INKmalloc(sizeof(TransactionData));
+  data = (TransactionData *) TSmalloc(sizeof(TransactionData));
 
   data->txn_id = -1;
 
@@ -225,46 +225,46 @@ transaction_data_destroy(TransactionData
 {
   if (data) {
 
-    if ((data->pending_action) && (!INKActionDone(data->pending_action))) {
-      INKActionCancel(data->pending_action);
+    if ((data->pending_action) && (!TSActionDone(data->pending_action))) {
+      TSActionCancel(data->pending_action);
       data->pending_action = NULL;
     }
 
     if (data->method) {
-      INKfree(data->method);
+      TSfree(data->method);
       data->method = NULL;
     }
 
     if (data->full_url) {
-      INKfree(data->full_url);
+      TSfree(data->full_url);
       data->full_url = NULL;
     }
 
     if (data->content_type) {
-      INKfree(data->content_type);
+      TSfree(data->content_type);
       data->content_type = NULL;
     }
 
     if (data->client_request_header) {
-      INKfree(data->client_request_header);
+      TSfree(data->client_request_header);
     }
 
     if (data->server_response_header) {
-      INKfree(data->server_response_header);
+      TSfree(data->server_response_header);
     }
 
-    INKfree(data);
+    TSfree(data);
   }
 }
 
 
 static int
-delete_transaction(INKCont contp, TransactionData * data)
+delete_transaction(TSCont contp, TransactionData * data)
 {
-  INKDebug(HIGH, "[%u] Transaction shutdown", data->txn_id);
+  TSDebug(HIGH, "[%u] Transaction shutdown", data->txn_id);
 
   transaction_data_destroy(data);
-  INKContDestroy(contp);
+  TSContDestroy(contp);
 
   return SUCCESS;
 }
@@ -275,7 +275,7 @@ delete_transaction(INKCont contp, Transa
  *
  */
 void
-INKPluginInit(int argc, const char *argv[])
+TSPluginInit(int argc, const char *argv[])
 {
 
   INIT_TXN_ID;                  /* init stuff related to unique txn id */
@@ -288,10 +288,10 @@ INKPluginInit(int argc, const char *argv
       log_nbmax_entries = ival;
     }
   }
-  INKDebug(HIGH, "Nb max entries in log set to %d", log_nbmax_entries);
+  TSDebug(HIGH, "Nb max entries in log set to %d", log_nbmax_entries);
 
   /* create mutex, used when we roll over logs */
-  log_mutex = INKMutexCreate();
+  log_mutex = TSMutexCreate();
   log_nb_rollover = 0;
   log_nb_entries = 0;
 #endif /* LOG_ROLL */
@@ -299,7 +299,7 @@ INKPluginInit(int argc, const char *argv
   log = NULL;
   create_new_log();
 
-  INKHttpHookAdd(INK_HTTP_TXN_START_HOOK, INKContCreate(global_http_handler, NULL));
+  TSHttpHookAdd(TS_HTTP_TXN_START_HOOK, TSContCreate(global_http_handler, NULL));
 }
 
 
@@ -315,11 +315,11 @@ create_new_log()
   struct timeval t;
 
 #ifdef LOG_ROLL
-  INKDebug(HIGH, "Rolling over transaction logs");
+  TSDebug(HIGH, "Rolling over transaction logs");
 
   /* If there is an already existing log object, close it. */
   if (log) {
-    INKTextLogObjectDestroy(log);
+    TSTextLogObjectDestroy(log);
   }
 
   /* Then create a new one with a different name */
@@ -333,55 +333,55 @@ create_new_log()
   sprintf(logname, "climate.log");
 #endif /* LOG_ROLL */
 
-  error = INKTextLogObjectCreate(logname, INK_LOG_MODE_ADD_TIMESTAMP, &log);
+  error = TSTextLogObjectCreate(logname, TS_LOG_MODE_ADD_TIMESTAMP, &log);
 }
 
 
 static int
-global_http_handler(INKCont contp, INKEvent event, void *edata)
+global_http_handler(TSCont contp, TSEvent event, void *edata)
 {
-  INKHttpTxn txnp = (INKHttpTxn) edata;
+  TSHttpTxn txnp = (TSHttpTxn) edata;
 
   switch (event) {
 
-  case INK_EVENT_HTTP_TXN_START:
-    INKDebug(LOW, "Event INK_EVENT_HTTP_TXN_START");
+  case TS_EVENT_HTTP_TXN_START:
+    TSDebug(LOW, "Event TS_EVENT_HTTP_TXN_START");
     new_transaction(txnp);
     break;
 
   default:
-    INKAssert(!"Unexpected Event");
+    TSAssert(!"Unexpected Event");
     break;
   }
 
-  INKHttpTxnReenable(txnp, INK_EVENT_HTTP_CONTINUE);
+  TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE);
   return 0;
 }
 
 
 static void
-new_transaction(INKHttpTxn txnp)
+new_transaction(TSHttpTxn txnp)
 {
-  INKCont p_contp;
+  TSCont p_contp;
   TransactionData *p_data;
 
   /* Create transaction structure */
-  p_contp = INKContCreate(transaction_handler, INKMutexCreate());
+  p_contp = TSContCreate(transaction_handler, TSMutexCreate());
   p_data = transaction_data_alloc();
-  INKContDataSet(p_contp, p_data);
+  TSContDataSet(p_contp, p_data);
 
   INC_AND_GET_TXN_ID(p_data->txn_id);
 
   /* Register transaction to HTTP hooks */
-  INKHttpTxnHookAdd(txnp, INK_HTTP_READ_REQUEST_HDR_HOOK, p_contp);
-  INKHttpTxnHookAdd(txnp, INK_HTTP_SEND_REQUEST_HDR_HOOK, p_contp);
-  INKHttpTxnHookAdd(txnp, INK_HTTP_READ_RESPONSE_HDR_HOOK, p_contp);
-  INKHttpTxnHookAdd(txnp, INK_HTTP_SEND_RESPONSE_HDR_HOOK, p_contp);
-  INKHttpTxnHookAdd(txnp, INK_HTTP_TXN_CLOSE_HOOK, p_contp);
+  TSHttpTxnHookAdd(txnp, TS_HTTP_READ_REQUEST_HDR_HOOK, p_contp);
+  TSHttpTxnHookAdd(txnp, TS_HTTP_SEND_REQUEST_HDR_HOOK, p_contp);
+  TSHttpTxnHookAdd(txnp, TS_HTTP_READ_RESPONSE_HDR_HOOK, p_contp);
+  TSHttpTxnHookAdd(txnp, TS_HTTP_SEND_RESPONSE_HDR_HOOK, p_contp);
+  TSHttpTxnHookAdd(txnp, TS_HTTP_TXN_CLOSE_HOOK, p_contp);
 
-  p_data->txn_start_time = INKBasedTimeGetD();
+  p_data->txn_start_time = TSBasedTimeGetD();
 
-  INKDebug(HIGH, "[%u] Added transaction !", p_data->txn_id);
+  TSDebug(HIGH, "[%u] Added transaction !", p_data->txn_id);
 }
 
 
@@ -392,27 +392,27 @@ new_transaction(INKHttpTxn txnp)
   Returns SUCCESS/FAILURE
   -------------------------------------------------------------------------*/
 int
-transaction_handler(INKCont contp, INKEvent event, void *edata)
+transaction_handler(TSCont contp, TSEvent event, void *edata)
 {
   TransactionData *data;
   TransactionStateHandler handler;
 
-  data = (TransactionData *) INKContDataGet(contp);
+  data = (TransactionData *) TSContDataGet(contp);
 
   switch (event) {
-  case INK_EVENT_HTTP_READ_REQUEST_HDR:
+  case TS_EVENT_HTTP_READ_REQUEST_HDR:
     handler = (TransactionStateHandler) & read_request_hdr_handler;
     break;
-  case INK_EVENT_HTTP_SEND_REQUEST_HDR:
+  case TS_EVENT_HTTP_SEND_REQUEST_HDR:
     handler = (TransactionStateHandler) & send_request_hdr_handler;
     break;
-  case INK_EVENT_HTTP_READ_RESPONSE_HDR:
+  case TS_EVENT_HTTP_READ_RESPONSE_HDR:
     handler = (TransactionStateHandler) & read_response_hdr_handler;
     break;
-  case INK_EVENT_HTTP_SEND_RESPONSE_HDR:
+  case TS_EVENT_HTTP_SEND_RESPONSE_HDR:
     handler = (TransactionStateHandler) & send_response_hdr_handler;
     break;
-  case INK_EVENT_HTTP_TXN_CLOSE:
+  case TS_EVENT_HTTP_TXN_CLOSE:
     handler = (TransactionStateHandler) & txn_close_handler;
     break;
   }
@@ -427,11 +427,11 @@ transaction_handler(INKCont contp, INKEv
   Return SUCCESS/FAILURE
   -------------------------------------------------------------------------*/
 static int
-read_request_hdr_handler(INKCont contp, INKEvent event, void *edata, TransactionData * data)
+read_request_hdr_handler(TSCont contp, TSEvent event, void *edata, TransactionData * data)
 {
-  INKHttpTxn txnp = (INKHttpTxn) edata;
-  data->read_request_hdr_time = INKBasedTimeGetD();
-  INKHttpTxnReenable(txnp, INK_EVENT_HTTP_CONTINUE);
+  TSHttpTxn txnp = (TSHttpTxn) edata;
+  data->read_request_hdr_time = TSBasedTimeGetD();
+  TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE);
   return SUCCESS;
 }
 
@@ -441,11 +441,11 @@ read_request_hdr_handler(INKCont contp, 
   Return SUCCESS/FAILURE
   -------------------------------------------------------------------------*/
 static int
-send_request_hdr_handler(INKCont contp, INKEvent event, void *edata, TransactionData * data)
+send_request_hdr_handler(TSCont contp, TSEvent event, void *edata, TransactionData * data)
 {
-  INKHttpTxn txnp = (INKHttpTxn) edata;
-  data->send_request_hdr_time = INKBasedTimeGetD();
-  INKHttpTxnReenable(txnp, INK_EVENT_HTTP_CONTINUE);
+  TSHttpTxn txnp = (TSHttpTxn) edata;
+  data->send_request_hdr_time = TSBasedTimeGetD();
+  TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE);
   return SUCCESS;
 }
 
@@ -456,11 +456,11 @@ send_request_hdr_handler(INKCont contp, 
   Return SUCCESS/FAILURE
   -------------------------------------------------------------------------*/
 static int
-read_response_hdr_handler(INKCont contp, INKEvent event, void *edata, TransactionData * data)
+read_response_hdr_handler(TSCont contp, TSEvent event, void *edata, TransactionData * data)
 {
-  INKHttpTxn txnp = (INKHttpTxn) edata;
-  data->read_response_hdr_time = INKBasedTimeGetD();
-  INKHttpTxnReenable(txnp, INK_EVENT_HTTP_CONTINUE);
+  TSHttpTxn txnp = (TSHttpTxn) edata;
+  data->read_response_hdr_time = TSBasedTimeGetD();
+  TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE);
   return SUCCESS;
 }
 
@@ -471,11 +471,11 @@ read_response_hdr_handler(INKCont contp,
   Return SUCCESS/FAILURE
   -------------------------------------------------------------------------*/
 static int
-send_response_hdr_handler(INKCont contp, INKEvent event, void *edata, TransactionData * data)
+send_response_hdr_handler(TSCont contp, TSEvent event, void *edata, TransactionData * data)
 {
-  INKHttpTxn txnp = (INKHttpTxn) edata;
-  data->send_response_hdr_time = INKBasedTimeGetD();
-  INKHttpTxnReenable(txnp, INK_EVENT_HTTP_CONTINUE);
+  TSHttpTxn txnp = (TSHttpTxn) edata;
+  data->send_response_hdr_time = TSBasedTimeGetD();
+  TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE);
   return SUCCESS;
 }
 
@@ -486,11 +486,11 @@ send_response_hdr_handler(INKCont contp,
   Return SUCCESS/FAILURE
   -------------------------------------------------------------------------*/
 static int
-txn_close_handler(INKCont contp, INKEvent event, void *edata, TransactionData * data)
+txn_close_handler(TSCont contp, TSEvent event, void *edata, TransactionData * data)
 {
-  INKHttpTxn txnp = (INKHttpTxn) edata;
+  TSHttpTxn txnp = (TSHttpTxn) edata;
 
-  data->txn_close_time = INKBasedTimeGetD();
+  data->txn_close_time = TSBasedTimeGetD();
 
   /* Retrieve transaction information and headers */
 
@@ -502,7 +502,7 @@ txn_close_handler(INKCont contp, INKEven
 
   delete_transaction(contp, data);
 
-  INKHttpTxnReenable(txnp, INK_EVENT_HTTP_CONTINUE);
+  TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE);
 
   return SUCCESS;
 }
@@ -515,18 +515,18 @@ txn_close_handler(INKCont contp, INKEven
   Returns SUCCESS/FAILURE
   -------------------------------------------------------------------------*/
 static int
-retrieve_transaction_info(INKHttpTxn txnp, TransactionData * data)
+retrieve_transaction_info(TSHttpTxn txnp, TransactionData * data)
 {
   char *bp_url;
-  INKMBuffer buf_resp, buf_req;
-  INKMLoc hdr_resp_loc, hdr_req_loc, str_loc;
+  TSMBuffer buf_resp, buf_req;
+  TSMLoc hdr_resp_loc, hdr_req_loc, str_loc;
   const char *path;
   const char *host;
   int l_host = 0;
   int l_path = 0;
-  INKMLoc cookie_loc;
+  TSMLoc cookie_loc;
   const char *cookie_value = NULL;
-  INKMLoc ctype_loc;
+  TSMLoc ctype_loc;
   const char *ctype_value = NULL;
   int str_len, cookie_len, ctype_len;
   int req_by_TS, resp_by_TS, req_by_FP, resp_by_FP;
@@ -535,73 +535,73 @@ retrieve_transaction_info(INKHttpTxn txn
 
   /* Retrieve information about the transaction */
 
-  INKHttpTxnStartTimeGetD(txnp, &(data->txn_time_start));
-  INKHttpTxnEndTimeGetD(txnp, &(data->txn_time_end));
+  TSHttpTxnStartTimeGetD(txnp, &(data->txn_time_start));
+  TSHttpTxnEndTimeGetD(txnp, &(data->txn_time_end));
 
   /* Retrieve headers */
 
-  if (!INKHttpTxnClientReqGet(txnp, &buf_req, &hdr_req_loc)) {
-    INKError("Could not access to client's request http header");
+  if (!TSHttpTxnClientReqGet(txnp, &buf_req, &hdr_req_loc)) {
+    TSError("Could not access to client's request http header");
   } else {
     print_mime_headers(buf_req, hdr_req_loc, &(data->client_request_header));
 
     /* Compute HTTP method */
-    str = (char *) INKHttpHdrMethodGet(buf_req, hdr_req_loc, &str_len);
-    data->method = INKmalloc(str_len + 1);
+    str = (char *) TSHttpHdrMethodGet(buf_req, hdr_req_loc, &str_len);
+    data->method = TSmalloc(str_len + 1);
     memcpy(data->method, str, str_len);
     data->method[str_len] = '\0';
-    INKHandleStringRelease(buf_req, hdr_req_loc, str);
+    TSHandleStringRelease(buf_req, hdr_req_loc, str);
 
     /* Get client HTTP version */
-    data->client_version = INKHttpHdrVersionGet(buf_req, hdr_req_loc);
+    data->client_version = TSHttpHdrVersionGet(buf_req, hdr_req_loc);
 
     /* Compute Full URL */
-    str_loc = INKHttpHdrUrlGet(buf_req, hdr_req_loc);
-    str = INKUrlStringGet(buf_req, str_loc, &str_len);
-    data->full_url = INKmalloc(str_len + 1);
+    str_loc = TSHttpHdrUrlGet(buf_req, hdr_req_loc);
+    str = TSUrlStringGet(buf_req, str_loc, &str_len);
+    data->full_url = TSmalloc(str_len + 1);
     memcpy(data->full_url, str, str_len);
     data->full_url[str_len] = '\0';
-    INKfree(str);
+    TSfree(str);
 
-    INKHandleMLocRelease(buf_req, INK_NULL_MLOC, hdr_req_loc);
+    TSHandleMLocRelease(buf_req, TS_NULL_MLOC, hdr_req_loc);
   }
 
-  if (!INKHttpTxnServerRespGet(txnp, &buf_resp, &hdr_resp_loc)) {
-    INKError("Could not access to server response header");
+  if (!TSHttpTxnServerRespGet(txnp, &buf_resp, &hdr_resp_loc)) {
+    TSError("Could not access to server response header");
   } else {
     print_mime_headers(buf_resp, hdr_resp_loc, &(data->server_response_header));
 
     /* Get response status code */
-    data->resp_status_code = INKHttpHdrStatusGet(buf_resp, hdr_resp_loc);
+    data->resp_status_code = TSHttpHdrStatusGet(buf_resp, hdr_resp_loc);
 
     /* Get server HTTP version */
-    data->server_version = INKHttpHdrVersionGet(buf_resp, hdr_resp_loc);
+    data->server_version = TSHttpHdrVersionGet(buf_resp, hdr_resp_loc);
 
-    INKHandleMLocRelease(buf_resp, INK_NULL_MLOC, hdr_resp_loc);
+    TSHandleMLocRelease(buf_resp, TS_NULL_MLOC, hdr_resp_loc);
   }
 
   /* Compute client ip */
-  data->client_ip = INKHttpTxnClientIPGet(txnp);
+  data->client_ip = TSHttpTxnClientIPGet(txnp);
 
   /* Compute server ip */
-  data->server_ip = INKHttpTxnServerIPGet(txnp);
+  data->server_ip = TSHttpTxnServerIPGet(txnp);
 
   /* Get cache lookup status */
-  INKHttpTxnCacheLookupStatusGet(txnp, &(data->cache_lookup_status));
+  TSHttpTxnCacheLookupStatusGet(txnp, &(data->cache_lookup_status));
 
   /* Get client abort */
-  data->client_abort = INKHttpTxnClientAborted(txnp);
+  data->client_abort = TSHttpTxnClientAborted(txnp);
 
   /* Get number of header and body bytes for all transfers */
 
-  INKHttpTxnClientReqHdrBytesGet(txnp, &(data->client_req_hdr_bytes));
-  INKHttpTxnClientReqBodyBytesGet(txnp, &(data->client_req_body_bytes));
-  INKHttpTxnClientRespHdrBytesGet(txnp, &(data->client_resp_hdr_bytes));
-  INKHttpTxnClientRespBodyBytesGet(txnp, &(data->client_resp_body_bytes));
-  INKHttpTxnServerReqHdrBytesGet(txnp, &(data->server_req_hdr_bytes));
-  INKHttpTxnServerReqBodyBytesGet(txnp, &(data->server_req_body_bytes));
-  INKHttpTxnServerRespHdrBytesGet(txnp, &(data->server_resp_hdr_bytes));
-  INKHttpTxnServerRespBodyBytesGet(txnp, &(data->server_resp_body_bytes));
+  TSHttpTxnClientReqHdrBytesGet(txnp, &(data->client_req_hdr_bytes));
+  TSHttpTxnClientReqBodyBytesGet(txnp, &(data->client_req_body_bytes));
+  TSHttpTxnClientRespHdrBytesGet(txnp, &(data->client_resp_hdr_bytes));
+  TSHttpTxnClientRespBodyBytesGet(txnp, &(data->client_resp_body_bytes));
+  TSHttpTxnServerReqHdrBytesGet(txnp, &(data->server_req_hdr_bytes));
+  TSHttpTxnServerReqBodyBytesGet(txnp, &(data->server_req_body_bytes));
+  TSHttpTxnServerRespHdrBytesGet(txnp, &(data->server_resp_hdr_bytes));
+  TSHttpTxnServerRespBodyBytesGet(txnp, &(data->server_resp_body_bytes));
 
 }
 
@@ -613,11 +613,11 @@ retrieve_transaction_info(INKHttpTxn txn
   Returns SUCCESS/FAILURE
   -------------------------------------------------------------------------*/
 static int
-log_transaction_info(INKCont contp, TransactionData * data)
+log_transaction_info(TSCont contp, TransactionData * data)
 {
   double txn_time = 0;
 
-  INKDebug(MED, "[%u] Logging stats", data->txn_id);
+  TSDebug(MED, "[%u] Logging stats", data->txn_id);
 
   if (!log) {
     return FAILURE;
@@ -628,7 +628,7 @@ log_transaction_info(INKCont contp, Tran
   txn_time = txn_time / 1000000.0;      /* convert nanosec to msec */
 
 #ifdef LOG_ROLL
-  INKMutexLock(log_mutex);
+  TSMutexLock(log_mutex);
 
   log_nb_entries++;
   if (log_nb_entries > log_nbmax_entries) {
@@ -636,7 +636,7 @@ log_transaction_info(INKCont contp, Tran
   }
 #endif /* LOG_ROLL */
 
-  INKTextLogObjectWrite(log,
+  TSTextLogObjectWrite(log,
                         "|%d.%d.%d.%d|%s|%d|%s|%d|%d|%d.%d.%d.%d|%d|%d|%s|%d|%d|%d|%d|%d|%d|%d|%d|%ld|%0.f|%0.f|%0.f|%0.f|%0.f|%0.f|%s|%s",
 /*    client                     server               bytes                       time                    */
                         IP_a(data->client_ip), IP_b(data->client_ip),
@@ -670,7 +670,7 @@ log_transaction_info(INKCont contp, Tran
 
 
 #ifdef LOG_ROLL
-  INKMutexUnlock(log_mutex);
+  TSMutexUnlock(log_mutex);
 #endif /* LOG_ROLL */
 
   return SUCCESS;
@@ -683,52 +683,52 @@ log_transaction_info(INKCont contp, Tran
   Outputs the full header to a string
   -------------------------------------------------------------------------*/
 static void
-print_mime_headers(INKMBuffer bufp, INKMLoc hdr_loc, char **output_string)
+print_mime_headers(TSMBuffer bufp, TSMLoc hdr_loc, char **output_string)
 {
 
-  INKIOBuffer output_buffer;
-  INKIOBufferReader reader;
+  TSIOBuffer output_buffer;
+  TSIOBufferReader reader;
   int total_avail;
 
-  INKIOBufferBlock block;
+  TSIOBufferBlock block;
   const char *block_start;
   int block_avail;
 
   int output_len;
   char *line_feed;
 
-  output_buffer = INKIOBufferCreate();
+  output_buffer = TSIOBufferCreate();
 
   if (!output_buffer) {
-    INKError("couldn't allocate IOBuffer\n");
+    TSError("couldn't allocate IOBuffer\n");
   }
 
-  reader = INKIOBufferReaderAlloc(output_buffer);
+  reader = TSIOBufferReaderAlloc(output_buffer);
 
   /* This will print  just MIMEFields and not
      the http request line */
-  INKMimeHdrPrint(bufp, hdr_loc, output_buffer);
+  TSMimeHdrPrint(bufp, hdr_loc, output_buffer);
 
-  INKHandleMLocRelease(bufp, INK_NULL_MLOC, hdr_loc);
+  TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc);
 
   /* Find out how the big the complete header is by
      seeing the total bytes in the buffer.  We need to
      look at the buffer rather than the first block to
      see the size of the entire header */
-  total_avail = INKIOBufferReaderAvail(reader);
+  total_avail = TSIOBufferReaderAvail(reader);
 
   /* Allocate the string with an extra byte for the string
      terminator */
-  *output_string = (char *) INKmalloc(total_avail + 1);
+  *output_string = (char *) TSmalloc(total_avail + 1);
   output_len = 0;
 
   /* We need to loop over all the buffer blocks to make
      sure we get the complete header since the header can
      be in multiple blocks */
-  block = INKIOBufferReaderStart(reader);
+  block = TSIOBufferReaderStart(reader);
   while (block) {
 
-    block_start = INKIOBufferBlockReadStart(block, reader, &block_avail);
+    block_start = TSIOBufferBlockReadStart(block, reader, &block_avail);
 
     /* We'll get a block pointer back even if there is no data
        left to read so check for this condition and break out of
@@ -743,11 +743,11 @@ print_mime_headers(INKMBuffer bufp, INKM
     output_len += block_avail;
 
     /* Consume the data so that we get to the next block */
-    INKIOBufferReaderConsume(reader, block_avail);
+    TSIOBufferReaderConsume(reader, block_avail);
 
     /* Get the next block now that we've consumed the
        data off the last block */
-    block = INKIOBufferReaderStart(reader);
+    block = TSIOBufferReaderStart(reader);
   }
 
   /* Terminate the string */
@@ -774,7 +774,7 @@ print_mime_headers(INKMBuffer bufp, INKM
   }
 
 
-  /* Free up the INKIOBuffer that we used to print out the header */
-  INKIOBufferReaderFree(reader);
-  INKIOBufferDestroy(output_buffer);
+  /* Free up the TSIOBuffer that we used to print out the header */
+  TSIOBufferReaderFree(reader);
+  TSIOBufferDestroy(output_buffer);
 }

Modified: trafficserver/traffic/branches/wccp/test/plugin/climate/events.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/test/plugin/climate/events.h?rev=1040383&r1=1040382&r2=1040383&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/test/plugin/climate/events.h (original)
+++ trafficserver/traffic/branches/wccp/test/plugin/climate/events.h Tue Nov 30 01:42:55 2010
@@ -23,32 +23,32 @@
 
 
 const char *
-INKStrEvent(INKEvent e)
+TSStrEvent(TSEvent e)
 {
   switch (e) {
 #define EVENT(a) case a: return #a
 
-    EVENT(INK_EVENT_NONE);
-    EVENT(INK_EVENT_IMMEDIATE);
-    EVENT(INK_EVENT_TIMEOUT);
-    EVENT(INK_EVENT_ERROR);
-    EVENT(INK_EVENT_CONTINUE);
-
-    EVENT(INK_EVENT_VCONN_READ_READY);
-    EVENT(INK_EVENT_VCONN_WRITE_READY);
-    EVENT(INK_EVENT_VCONN_READ_COMPLETE);
-    EVENT(INK_EVENT_VCONN_WRITE_COMPLETE);
-    EVENT(INK_EVENT_VCONN_EOS);
-
-    EVENT(INK_EVENT_NET_CONNECT);
-    EVENT(INK_EVENT_NET_CONNECT_FAILED);
-    EVENT(INK_EVENT_NET_ACCEPT);
-    EVENT(INK_EVENT_NET_ACCEPT_FAILED);
-
-    EVENT(INK_EVENT_CACHE_OPEN_READ);
-    EVENT(INK_EVENT_CACHE_OPEN_READ_FAILED);
-    EVENT(INK_EVENT_CACHE_OPEN_WRITE);
-    EVENT(INK_EVENT_CACHE_OPEN_WRITE_FAILED);
+    EVENT(TS_EVENT_NONE);
+    EVENT(TS_EVENT_IMMEDIATE);
+    EVENT(TS_EVENT_TIMEOUT);
+    EVENT(TS_EVENT_ERROR);
+    EVENT(TS_EVENT_CONTINUE);
+
+    EVENT(TS_EVENT_VCONN_READ_READY);
+    EVENT(TS_EVENT_VCONN_WRITE_READY);
+    EVENT(TS_EVENT_VCONN_READ_COMPLETE);
+    EVENT(TS_EVENT_VCONN_WRITE_COMPLETE);
+    EVENT(TS_EVENT_VCONN_EOS);
+
+    EVENT(TS_EVENT_NET_CONNECT);
+    EVENT(TS_EVENT_NET_CONNECT_FAILED);
+    EVENT(TS_EVENT_NET_ACCEPT);
+    EVENT(TS_EVENT_NET_ACCEPT_FAILED);
+
+    EVENT(TS_EVENT_CACHE_OPEN_READ);
+    EVENT(TS_EVENT_CACHE_OPEN_READ_FAILED);
+    EVENT(TS_EVENT_CACHE_OPEN_WRITE);
+    EVENT(TS_EVENT_CACHE_OPEN_WRITE_FAILED);
   default:
     return "UNKOWN EVENT";
   }

Modified: trafficserver/traffic/branches/wccp/test/plugin/cluster-RPC/clusterRPC.c
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/test/plugin/cluster-RPC/clusterRPC.c?rev=1040383&r1=1040382&r2=1040383&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/test/plugin/cluster-RPC/clusterRPC.c (original)
+++ trafficserver/traffic/branches/wccp/test/plugin/cluster-RPC/clusterRPC.c Tue Nov 30 01:42:55 2010
@@ -37,7 +37,7 @@
 
 #include <stdio.h>
 #include "ts.h"
-#include "ts_private.h"
+#include "experimental.h"
 
 /****************************************************************************
  *  Declarations.
@@ -46,8 +46,8 @@
 typedef struct hello_msg
 {
   int hm_version;
-  INKNodeHandle_t hm_source_handle;
-  INKNodeHandle_t hm_dest_handle;
+  TSNodeHandle_t hm_source_handle;
+  TSNodeHandle_t hm_dest_handle;
   int hm_instance;
   int hm_data_size;
   int hm_data;
@@ -55,7 +55,7 @@ typedef struct hello_msg
 
 typedef struct msg_log
 {
-  INKNodeHandle_t ml_nh;
+  TSNodeHandle_t ml_nh;
   int ml_msgs_received;
   int ml_last_msgs_received;
   int ml_bytes_received;
@@ -72,16 +72,16 @@ typedef struct msg_log
  *  Global data declarations.
  ****************************************************************************/
 int clusterRPC_plugin_shutdown;
-static INKMutex node_status_mutex;
-static INKClusterStatusHandle_t status_callout_handle;
-static INKClusterRPCHandle_t rpc_wireless_f10_handle;
+static TSMutex node_status_mutex;
+static TSClusterStatusHandle_t status_callout_handle;
+static TSClusterRPCHandle_t rpc_wireless_f10_handle;
 
-static INKCont periodic_event_cont;
-static INKAction periodic_event_action;
+static TSCont periodic_event_cont;
+static TSAction periodic_event_action;
 static int periodic_event_callouts;
 
-static INKNodeHandle_t my_node_handle;
-static INKNodeHandle_t nodes[MAX_CLUSTER_NODES + 1];    /* entry 0 not used */
+static TSNodeHandle_t my_node_handle;
+static TSNodeHandle_t nodes[MAX_CLUSTER_NODES + 1];    /* entry 0 not used */
 static int online_nodes;
 
 static int msg_instance;
@@ -94,7 +94,7 @@ int
 check_ts_version()
 {
 
-  const char *ts_version = INKTrafficServerVersionGet();
+  const char *ts_version = TSTrafficServerVersionGet();
   int result = 0;
 
   if (ts_version) {
@@ -117,20 +117,20 @@ check_ts_version()
 }
 
 void
-INKPluginInit(int argc, const char *argv[])
+TSPluginInit(int argc, const char *argv[])
 {
-  INKPluginRegistrationInfo info;
+  TSPluginRegistrationInfo info;
 
   info.plugin_name = "cluster-RPC";
   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;
   }
   clusterRPC_init();
@@ -139,13 +139,13 @@ INKPluginInit(int argc, const char *argv
 static void
 shutdown()
 {
-  INKActionCancel(periodic_event_action);
-  INKDeleteClusterStatusFunction(&status_callout_handle);
-  INKDeleteClusterRPCFunction(&rpc_wireless_f10_handle);
+  TSActionCancel(periodic_event_action);
+  TSDeleteClusterStatusFunction(&status_callout_handle);
+  TSDeleteClusterRPCFunction(&rpc_wireless_f10_handle);
 }
 
 static int
-find_node_entry(INKNodeHandle_t nh)
+find_node_entry(TSNodeHandle_t nh)
 {
   int n;
 
@@ -174,16 +174,16 @@ find_free_node_entry()
  *  Handler for node status callouts.
  *****************************************************************************/
 static void
-status_callout(INKNodeHandle_t * nhp, INKNodeStatus_t status)
+status_callout(TSNodeHandle_t * nhp, TSNodeStatus_t status)
 {
     /*************************************************************************
      *  Note: Cluster always calls us with 'node_status_mutex' held.
      *************************************************************************/
   int found, n;
-  INKNodeHandle_t nh = *nhp;
+  TSNodeHandle_t nh = *nhp;
   struct in_addr in;
 
-  INKNodeHandleToIPAddr(&nh, &in);
+  TSNodeHandleToIPAddr(&nh, &in);
   found = find_node_entry(nh);
 
   if (status == NODE_ONLINE) {
@@ -193,25 +193,25 @@ status_callout(INKNodeHandle_t * nhp, IN
         nodes[n] = nh;
         online_nodes++;
 
-        INKDebug(PLUGIN_DEBUG_TAG, "Node [%u.%u.%u.%u] online, nodes=%d\n", DOT_SEPARATED(in.s_addr), online_nodes);
+        TSDebug(PLUGIN_DEBUG_TAG, "Node [%u.%u.%u.%u] online, nodes=%d\n", DOT_SEPARATED(in.s_addr), online_nodes);
       } else {
         /* Should never happen */
-        INKDebug(PLUGIN_DEBUG_ERR_TAG, "clusterRPC plugin: No free entries.\n");
+        TSDebug(PLUGIN_DEBUG_ERR_TAG, "clusterRPC plugin: No free entries.\n");
 
-        INKDebug(PLUGIN_DEBUG_TAG,
+        TSDebug(PLUGIN_DEBUG_TAG,
                  "Node [%u.%u.%u.%u] online observed, nodes=%d\n", DOT_SEPARATED(in.s_addr), online_nodes);
       }
     } else {
-      INKDebug(PLUGIN_DEBUG_TAG,
+      TSDebug(PLUGIN_DEBUG_TAG,
                "Duplicate node [%u.%u.%u.%u] online, nodes=%d\n", DOT_SEPARATED(in.s_addr), online_nodes);
     }
   } else {
     if (found) {
       nodes[found] = 0;
       online_nodes--;
-      INKDebug(PLUGIN_DEBUG_TAG, "Node [%u.%u.%u.%u] offline, nodes=%d\n", DOT_SEPARATED(in.s_addr), online_nodes);
+      TSDebug(PLUGIN_DEBUG_TAG, "Node [%u.%u.%u.%u] offline, nodes=%d\n", DOT_SEPARATED(in.s_addr), online_nodes);
     } else {
-      INKDebug(PLUGIN_DEBUG_TAG,
+      TSDebug(PLUGIN_DEBUG_TAG,
                "Unexpected node [%u.%u.%u.%u] offline, nodes=%d\n", DOT_SEPARATED(in.s_addr), online_nodes);
     }
   }
@@ -235,7 +235,7 @@ check_data(char *p, int size)
 
   for (n = 0; n < size; ++n, ++val) {
     if (p[n] != val) {
-      INKDebug(PLUGIN_DEBUG_ERR_TAG, "check_data fail actual %d expected %d n %d data 0x%x\n", p[n], val, n, &p[n]);
+      TSDebug(PLUGIN_DEBUG_ERR_TAG, "check_data fail actual %d expected %d n %d data 0x%x\n", p[n], val, n, &p[n]);
       return 1;
     }
   }
@@ -272,8 +272,8 @@ log_msg(hello_msg_t * h, int msg_data_le
   for (n = 0; n < MAX_CLUSTER_NODES; ++n) {
     if (log[n].ml_nh && (log[n].ml_msgs_received != log[n].ml_last_msgs_received)) {
       log[n].ml_last_msgs_received = log[n].ml_msgs_received;
-      INKNodeHandleToIPAddr(&log[n].ml_nh, &in);
-      INKDebug(PLUGIN_DEBUG_ERR_TAG,
+      TSNodeHandleToIPAddr(&log[n].ml_nh, &in);
+      TSDebug(PLUGIN_DEBUG_ERR_TAG,
                "[%u.%u.%u.%u] msgs rcvd: %d total bytes rcvd: %d\n",
                DOT_SEPARATED(in.s_addr), log[n].ml_msgs_received, log[n].ml_bytes_received);
 
@@ -285,7 +285,7 @@ log_msg(hello_msg_t * h, int msg_data_le
  *  RPC Handler for key RPC_API_WIRELESS_F10.
  *****************************************************************************/
 static void
-rpc_wireless_f10_func(INKNodeHandle_t * nh, INKClusterRPCMsg_t * msg, int msg_data_len)
+rpc_wireless_f10_func(TSNodeHandle_t * nh, TSClusterRPCMsg_t * msg, int msg_data_len)
 {
   hello_msg_t hello_msg;
   struct in_addr in;
@@ -299,37 +299,37 @@ rpc_wireless_f10_func(INKNodeHandle_t * 
         /*********************************************************************
   	 *  Message consistency checks.
 	 *********************************************************************/
-    INKNodeHandleToIPAddr(&hello_msg.hm_source_handle, &in);
+    TSNodeHandleToIPAddr(&hello_msg.hm_source_handle, &in);
     if (hello_msg.hm_version != HELLO_MSG_VERSION) {
-      INKDebug(PLUGIN_DEBUG_ERR_TAG,
+      TSDebug(PLUGIN_DEBUG_ERR_TAG,
                "rpc_wireless_f10_func() vers, actual %d expected %d \n", hello_msg.hm_version, HELLO_MSG_VERSION);
       return;
     }
     if (hello_msg.hm_source_handle != *nh) {
-      INKDebug(PLUGIN_DEBUG_ERR_TAG,
+      TSDebug(PLUGIN_DEBUG_ERR_TAG,
                "rpc_wireless_f10_func() src, actual %d expected %d \n", hello_msg.hm_source_handle, *nh);
       return;
     }
     if (hello_msg.hm_data_size != msg_data_len) {
-      INKDebug(PLUGIN_DEBUG_ERR_TAG,
+      TSDebug(PLUGIN_DEBUG_ERR_TAG,
                "rpc_wireless_f10_func() len, actual %d expected %d \n", msg_data_len, hello_msg.hm_data_size);
       return;
     }
     if (check_data(msg->m_data +
                    sizeof(hello_msg) - sizeof(hello_msg.hm_data_size),
                    msg_data_len - sizeof(hello_msg) + sizeof(hello_msg.hm_data))) {
-      INKDebug(PLUGIN_DEBUG_ERR_TAG,
+      TSDebug(PLUGIN_DEBUG_ERR_TAG,
                "rpc_wireless_f10_func() data check failed, "
                "[%u.%u.%u.%u] len %d data 0x%x\n", DOT_SEPARATED(in.s_addr), msg_data_len, msg->m_data);
     }
     log_msg(&hello_msg, msg_data_len);
-    INKFreeRPCMsg(msg, msg_data_len);
+    TSFreeRPCMsg(msg, msg_data_len);
 
-    INKDebug(PLUGIN_DEBUG_TAG,
+    TSDebug(PLUGIN_DEBUG_TAG,
              "Received hello from [%u.%u.%u.%u] instance %d\n", DOT_SEPARATED(in.s_addr), hello_msg.hm_instance);
   } else {
-    INKFreeRPCMsg(msg, msg_data_len);
-    INKDebug(PLUGIN_DEBUG_ERR_TAG,
+    TSFreeRPCMsg(msg, msg_data_len);
+    TSDebug(PLUGIN_DEBUG_ERR_TAG,
              "rpc_wireless_f10_func() msglen, actual %d expect >= %d \n", msg_data_len, sizeof(hello_msg_t));
   }
 }
@@ -338,20 +338,20 @@ rpc_wireless_f10_func(INKNodeHandle_t * 
  *  Periodic handler to send RPC messages.
  *****************************************************************************/
 static int
-periodic_event(INKCont contp, INKEvent event, void *e)
+periodic_event(TSCont contp, TSEvent event, void *e)
 {
     /*************************************************************************
      *  Note: Event subsystem always calls us with 'node_status_mutex' held.
      *************************************************************************/
   int n, size, ret;
 
-  INKClusterRPCMsg_t *rmsg;
+  TSClusterRPCMsg_t *rmsg;
   hello_msg_t hello_msg;
   struct in_addr in;
 
   if (clusterRPC_plugin_shutdown) {
     shutdown();
-    INKContDestroy(contp);
+    TSContDestroy(contp);
     return 0;
   }
     /*************************************************************************
@@ -359,7 +359,7 @@ periodic_event(INKCont contp, INKEvent e
      *************************************************************************/
   for (n = 1; n <= MAX_CLUSTER_NODES; ++n) {
     if (nodes[n]) {
-      INKNodeHandleToIPAddr(&nodes[n], &in);
+      TSNodeHandleToIPAddr(&nodes[n], &in);
 
       hello_msg.hm_version = HELLO_MSG_VERSION;
       hello_msg.hm_source_handle = my_node_handle;
@@ -370,7 +370,7 @@ periodic_event(INKCont contp, INKEvent e
       if (size < sizeof(hello_msg_t)) {
         size = sizeof(hello_msg_t);
       }
-      rmsg = INKAllocClusterRPCMsg(&rpc_wireless_f10_handle, size);
+      rmsg = TSAllocClusterRPCMsg(&rpc_wireless_f10_handle, size);
       hello_msg.hm_data_size = size;
             /******************************************************************
  	     *  Marshal data into message.
@@ -380,17 +380,17 @@ periodic_event(INKCont contp, INKEvent e
                 sizeof(hello_msg) - sizeof(hello_msg.hm_data_size),
                 size - sizeof(hello_msg) + sizeof(hello_msg.hm_data));
 
-      INKDebug(PLUGIN_DEBUG_TAG,
+      TSDebug(PLUGIN_DEBUG_TAG,
                "Sending hello to [%u.%u.%u.%u] instance %d bytes %d\n",
                DOT_SEPARATED(in.s_addr), hello_msg.hm_instance, size);
 
-      ret = INKSendClusterRPC(&nodes[n], rmsg);
+      ret = TSSendClusterRPC(&nodes[n], rmsg);
       if (ret) {
-        INKDebug(PLUGIN_DEBUG_ERR_TAG, "INKSendClusterRPC failed\n");
+        TSDebug(PLUGIN_DEBUG_ERR_TAG, "TSSendClusterRPC failed\n");
       }
     }
   }
-  periodic_event_action = INKContSchedule(periodic_event_cont, (1 * 1000) /* 1 sec */ );
+  periodic_event_action = TSContSchedule(periodic_event_cont, (1 * 1000) /* 1 sec */ );
   return 0;
 }
 
@@ -398,55 +398,57 @@ static void
 clusterRPC_init()
 {
   int ret;
+  int lock;
 
     /***********************************************************************
      *  Create plugin mutex
      ***********************************************************************/
-  node_status_mutex = INKMutexCreate();
+  node_status_mutex = TSMutexCreate();
   if (!node_status_mutex) {
-    INKDebug(PLUGIN_DEBUG_ERR_TAG, "INKMutexCreate for node_status failed\n");
+    TSDebug(PLUGIN_DEBUG_ERR_TAG, "TSMutexCreate for node_status failed\n");
     return;
   }
-  if (!INKMutexTryLock(node_status_mutex)) {
+  TSMutexLockTry(node_status_mutex, &lock);
+  if (!lock) {
     /* Should never fail */
-    INKDebug(PLUGIN_DEBUG_ERR_TAG, "INKMutexTryLock failed\n");
+    TSDebug(PLUGIN_DEBUG_ERR_TAG, "TSMutexLockTry failed\n");
   }
     /***********************************************************************
      *  Register our RPC handler.
      ***********************************************************************/
-  ret = INKAddClusterRPCFunction(RPC_API_WIRELESS_F10, rpc_wireless_f10_func, &rpc_wireless_f10_handle);
+  ret = TSAddClusterRPCFunction(RPC_API_WIRELESS_F10, rpc_wireless_f10_func, &rpc_wireless_f10_handle);
   if (ret) {
-    INKDebug(PLUGIN_DEBUG_ERR_TAG, "INKAddClusterRPCFunction failed\n");
+    TSDebug(PLUGIN_DEBUG_ERR_TAG, "TSAddClusterRPCFunction failed\n");
     return;
   }
     /***********************************************************************
      *  Subscribe to cluster node status callouts.
      ***********************************************************************/
-  ret = INKAddClusterStatusFunction(status_callout, node_status_mutex, &status_callout_handle);
+  ret = TSAddClusterStatusFunction(status_callout, node_status_mutex, &status_callout_handle);
   if (ret) {
-    INKDebug(PLUGIN_DEBUG_ERR_TAG, "INKAddClusterStatusFunction failed\n");
+    TSDebug(PLUGIN_DEBUG_ERR_TAG, "TSAddClusterStatusFunction failed\n");
     return;
   }
     /***********************************************************************
      *  Perform node status initializations.
      ***********************************************************************/
-  INKGetMyNodeHandle(&my_node_handle);
+  TSGetMyNodeHandle(&my_node_handle);
 
     /***********************************************************************
      *  Enable cluster node status callouts.
      ***********************************************************************/
-  INKEnableClusterStatusCallout(&status_callout_handle);
+  TSEnableClusterStatusCallout(&status_callout_handle);
 
     /***********************************************************************
      *  Establish the periodic event.
      ***********************************************************************/
-  periodic_event_cont = INKContCreate(periodic_event, node_status_mutex);
+  periodic_event_cont = TSContCreate(periodic_event, node_status_mutex);
   if (!periodic_event_cont) {
-    INKDebug(PLUGIN_DEBUG_ERR_TAG, "INKContCreate for periodic_event failed\n");
+    TSDebug(PLUGIN_DEBUG_ERR_TAG, "TSContCreate for periodic_event failed\n");
     return;
   }
-  periodic_event_action = INKContSchedule(periodic_event_cont, (1 * 1000) /* 1 sec */ );
-  INKMutexUnlock(node_status_mutex);
+  periodic_event_action = TSContSchedule(periodic_event_cont, (1 * 1000) /* 1 sec */ );
+  TSMutexUnlock(node_status_mutex);
 }
 
 /*

Modified: trafficserver/traffic/branches/wccp/test/plugin/include_other/macro.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/test/plugin/include_other/macro.h?rev=1040383&r1=1040382&r2=1040383&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/test/plugin/include_other/macro.h (original)
+++ trafficserver/traffic/branches/wccp/test/plugin/include_other/macro.h Tue Nov 30 01:42:55 2010
@@ -28,16 +28,16 @@
 
 #define LOG_AUTO_ERROR(API_NAME, COMMENT) \
 { \
-    INKDebug(AUTO_TAG, "%s %s [%s: line %d] (%s)", PLUGIN_NAME, API_NAME, FUNCTION_NAME, \
+    TSDebug(AUTO_TAG, "%s %s [%s: line %d] (%s)", PLUGIN_NAME, API_NAME, FUNCTION_NAME, \
             __LINE__, COMMENT); \
 }
 #define LOG_API_ERROR(API_NAME) { \
-    INKDebug(DEBUG_TAG, "%s: %s %s [%s] File %s, line number %d", PLUGIN_NAME, API_NAME, "APIFAIL", \
+    TSDebug(DEBUG_TAG, "%s: %s %s [%s] File %s, line number %d", PLUGIN_NAME, API_NAME, "APIFAIL", \
 	     FUNCTION_NAME, __FILE__, __LINE__); \
 }
 
 #define LOG_API_ERROR_COMMENT(API_NAME, COMMENT) { \
-    INKDebug(DEBUG_TAG, "%s: %s %s [%s] File %s, line number %d (%s)", PLUGIN_NAME, API_NAME, "APIFAIL", \
+    TSDebug(DEBUG_TAG, "%s: %s %s [%s] File %s, line number %d (%s)", PLUGIN_NAME, API_NAME, "APIFAIL", \
 	     FUNCTION_NAME, __FILE__, __LINE__, COMMENT); \
 }
 
@@ -54,27 +54,27 @@
 #define LOG_ERROR_AND_REENABLE(API_NAME) \
 { \
     LOG_API_ERROR(API_NAME); \
-    INKHttpTxnReenable(txnp, INK_EVENT_HTTP_CONTINUE); \
+    TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE); \
 }
 
 #define LOG_ERROR_NEG(API_NAME) { \
-    INKDebug(PLUGIN_NAME, "%s: %s %s %s File %s, line number %d",PLUGIN_NAME, API_NAME, "NEGAPIFAIL", \
+    TSDebug(PLUGIN_NAME, "%s: %s %s %s File %s, line number %d",PLUGIN_NAME, API_NAME, "NEGAPIFAIL", \
              FUNCTION_NAME, __FILE__, __LINE__); \
 }
 
 /* added by nkale for internal plugins */
 #define LOG_NEG_ERROR(API_NAME) { \
-    INKDebug(NEG_ERROR_TAG, "%s: %s %s %s File %s, line number %d",PLUGIN_NAME, API_NAME, "NEGAPIFAIL", \
+    TSDebug(NEG_ERROR_TAG, "%s: %s %s %s File %s, line number %d",PLUGIN_NAME, API_NAME, "NEGAPIFAIL", \
              FUNCTION_NAME, __FILE__, __LINE__); \
 }
 
 /* Release macros */
-#define VALID_PTR(X) ((X != NULL) && (X != INK_ERROR_PTR))
+#define VALID_PTR(X) ((X != NULL) && (X != TS_ERROR_PTR))
 
 #define FREE(X) \
 { \
     if (VALID_PTR(X)) { \
-        INKfree((void *)X); \
+        TSfree((void *)X); \
         X = NULL; \
     } \
 } \
@@ -82,10 +82,10 @@
 #define HANDLE_RELEASE(P_BUFFER, P_PARENT, P_MLOC) \
 { \
     if (VALID_PTR(P_MLOC)) { \
-        if (INKHandleMLocRelease(P_BUFFER, P_PARENT, P_MLOC) == INK_ERROR) { \
-            LOG_API_ERROR("INKHandleMLocRelease"); \
+        if (TSHandleMLocRelease(P_BUFFER, P_PARENT, P_MLOC) == TS_ERROR) { \
+            LOG_API_ERROR("TSHandleMLocRelease"); \
         } else { \
-            P_MLOC = (INKMLoc)NULL; \
+            P_MLOC = (TSMLoc)NULL; \
         } \
     } \
 }\
@@ -93,8 +93,8 @@
 #define STR_RELEASE(P_BUFFER, P_PARENT, P_STR) \
 { \
     if (VALID_PTR(P_STR)) { \
-        if (INKHandleStringRelease(P_BUFFER, P_PARENT, P_STR) == INK_ERROR) { \
-            LOG_API_ERROR("INKHandleStringRelease"); \
+        if (TSHandleStringRelease(P_BUFFER, P_PARENT, P_STR) == TS_ERROR) { \
+            LOG_API_ERROR("TSHandleStringRelease"); \
         } else  { \
             P_STR = NULL; \
         } \
@@ -104,24 +104,24 @@
 #define URL_DESTROY(P_BUFFER, P_MLOC) \
 { \
     if (VALID_PTR(P_MLOC)) {\
-        INKUrlDestroy (P_BUFFER, P_MLOC); \
+        TSUrlDestroy (P_BUFFER, P_MLOC); \
     } else { \
-        P_MLOC = (INKMLoc)NULL; \
+        P_MLOC = (TSMLoc)NULL; \
     } \
 }\
 
 #define HDR_DESTROY(P_BUFFER, P_MLOC) \
 { \
     if (VALID_PTR(P_MLOC)) \
-        if (INKHttpHdrDestroy (P_BUFFER, P_MLOC) == INK_ERROR) \
-            LOG_API_ERROR("INKHttpHdrDestroy"); \
+        if (TSHttpHdrDestroy (P_BUFFER, P_MLOC) == TS_ERROR) \
+            LOG_API_ERROR("TSHttpHdrDestroy"); \
 }\
 
 #define BUFFER_DESTROY(P_BUFFER) \
 { \
     if (VALID_PTR(P_BUFFER)) \
-        if (INKMBufferDestroy (P_BUFFER) == INK_ERROR) \
-            LOG_API_ERROR("INKMBufferDestroy"); \
+        if (TSMBufferDestroy (P_BUFFER) == TS_ERROR) \
+            LOG_API_ERROR("TSMBufferDestroy"); \
 }\
 
 #endif