You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2011/03/07 05:32:58 UTC
svn commit: r1078680 - in /trafficserver/traffic/trunk: example/protocol/
example/thread-pool/ iocore/cache/ iocore/eventsystem/ proxy/ proxy/api/ts/
proxy/hdrs/ proxy/http/ tools/
Author: zwoop
Date: Mon Mar 7 04:32:57 2011
New Revision: 1078680
URL: http://svn.apache.org/viewvc?rev=1078680&view=rev
Log:
TS-680 Change many typedef void* types to anonymous structs.
This also fixes several bugs, and bad code related to these
types.
Modified:
trafficserver/traffic/trunk/example/protocol/TxnSM.c
trafficserver/traffic/trunk/example/protocol/TxnSM.h
trafficserver/traffic/trunk/example/thread-pool/psi.c
trafficserver/traffic/trunk/iocore/cache/CachePages.cc
trafficserver/traffic/trunk/iocore/eventsystem/I_IOBuffer.h
trafficserver/traffic/trunk/iocore/eventsystem/P_IOBuffer.h
trafficserver/traffic/trunk/proxy/FetchSM.cc
trafficserver/traffic/trunk/proxy/FetchSM.h
trafficserver/traffic/trunk/proxy/InkAPI.cc
trafficserver/traffic/trunk/proxy/InkAPITest.cc
trafficserver/traffic/trunk/proxy/InkIOCoreAPI.cc
trafficserver/traffic/trunk/proxy/Prefetch.cc
trafficserver/traffic/trunk/proxy/Transform.cc
trafficserver/traffic/trunk/proxy/api/ts/experimental.h
trafficserver/traffic/trunk/proxy/api/ts/ts.h.in
trafficserver/traffic/trunk/proxy/hdrs/HTTP.h
trafficserver/traffic/trunk/proxy/http/HttpSM.h
trafficserver/traffic/trunk/tools/apichecker.pl
Modified: trafficserver/traffic/trunk/example/protocol/TxnSM.c
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/example/protocol/TxnSM.c?rev=1078680&r1=1078679&r2=1078680&view=diff
==============================================================================
--- trafficserver/traffic/trunk/example/protocol/TxnSM.c (original)
+++ trafficserver/traffic/trunk/example/protocol/TxnSM.c Mon Mar 7 04:32:57 2011
@@ -78,7 +78,7 @@ main_handler(TSCont contp, TSEvent event
return prepare_to_die(contp);
}
- if (q_current_handler != &state_interface_with_server) {
+ if (q_current_handler != (TxnSMHandler)&state_interface_with_server) {
if (event == TS_EVENT_VCONN_EOS) {
return prepare_to_die(contp);
}
@@ -168,7 +168,7 @@ state_start(TSCont contp, TSEvent event,
the size of the client request, set the expecting size to be
INT64_MAX, so that we will always get TS_EVENT_VCONN_READ_READY
event, but never TS_EVENT_VCONN_READ_COMPLETE event. */
- set_handler(txn_sm->q_current_handler, &state_interface_with_client);
+ set_handler(txn_sm->q_current_handler, (TxnSMHandler)&state_interface_with_client);
txn_sm->q_client_read_vio = TSVConnRead(txn_sm->q_client_vc, (TSCont) contp, txn_sm->q_client_request_buffer, INT64_MAX);
return TS_SUCCESS;
@@ -231,9 +231,9 @@ state_read_request_from_client(TSCont co
/* Start to do cache lookup */
TSDebug("protocol", "Key material: file name is %d, %s*****", txn_sm->q_file_name, txn_sm->q_file_name);
- txn_sm->q_key = (TSCacheKey) CacheKeyCreate(txn_sm->q_file_name);
+ txn_sm->q_key = (TSCacheKey)CacheKeyCreate(txn_sm->q_file_name);
- set_handler(txn_sm->q_current_handler, &state_handle_cache_lookup);
+ set_handler(txn_sm->q_current_handler, (TxnSMHandler)&state_handle_cache_lookup);
txn_sm->q_pending_action = TSCacheRead(contp, txn_sm->q_key);
return TS_SUCCESS;
@@ -292,7 +292,7 @@ state_handle_cache_lookup(TSCont contp,
}
/* Read doc from the cache. */
- set_handler(txn_sm->q_current_handler, &state_handle_cache_read_response);
+ set_handler(txn_sm->q_current_handler, (TxnSMHandler)&state_handle_cache_read_response);
txn_sm->q_cache_read_vio = TSVConnRead(txn_sm->q_cache_vc, contp, txn_sm->q_cache_read_buffer, response_size);
break;
@@ -306,7 +306,7 @@ state_handle_cache_lookup(TSCont contp,
if (ret_val != TS_SUCCESS)
TSError("fail to write into log");
- set_handler(txn_sm->q_current_handler, &state_handle_cache_prepare_for_write);
+ set_handler(txn_sm->q_current_handler, (TxnSMHandler)&state_handle_cache_prepare_for_write);
txn_sm->q_pending_action = TSCacheWrite(contp, txn_sm->q_key);
break;
@@ -382,7 +382,7 @@ state_handle_cache_read_response(TSCont
/* Open the write_vc, after getting doc from the origin server,
write the doc into the cache. */
- set_handler(txn_sm->q_current_handler, &state_handle_cache_prepare_for_write);
+ set_handler(txn_sm->q_current_handler, (TxnSMHandler)&state_handle_cache_prepare_for_write);
TSAssert(txn_sm->q_pending_action == NULL);
txn_sm->q_pending_action = TSCacheWrite(contp, txn_sm->q_key);
break;
@@ -443,7 +443,7 @@ state_build_and_send_request(TSCont cont
TSIOBufferWrite(txn_sm->q_server_request_buffer, txn_sm->q_client_request, strlen(txn_sm->q_client_request));
/* First thing to do is to get the server IP from the server host name. */
- set_handler(txn_sm->q_current_handler, &state_dns_lookup);
+ set_handler(txn_sm->q_current_handler, (TxnSMHandler)&state_dns_lookup);
TSAssert(txn_sm->q_pending_action == NULL);
txn_sm->q_pending_action = TSHostLookup(contp, txn_sm->q_server_name, strlen(txn_sm->q_server_name));
@@ -471,7 +471,7 @@ state_dns_lookup(TSCont contp, TSEvent e
txn_sm->q_server_ip = TSHostLookupResultIPGet(host_info);
/* Connect to the server using its IP. */
- set_handler(txn_sm->q_current_handler, &state_connect_to_server);
+ set_handler(txn_sm->q_current_handler, (TxnSMHandler)&state_connect_to_server);
TSAssert(txn_sm->q_pending_action == NULL);
txn_sm->q_pending_action = TSNetConnect(contp, txn_sm->q_server_ip, txn_sm->q_server_port);
@@ -499,7 +499,7 @@ state_connect_to_server(TSCont contp, TS
txn_sm->q_server_vc = vc;
/* server_vc will be used to write request and read response. */
- set_handler(txn_sm->q_current_handler, &state_send_request_to_server);
+ set_handler(txn_sm->q_current_handler, (TxnSMHandler)&state_send_request_to_server);
/* Actively write the request to the net_vc. */
txn_sm->q_server_write_vio = TSVConnWrite(txn_sm->q_server_vc, contp,
@@ -524,7 +524,7 @@ state_send_request_to_server(TSCont cont
vio = NULL;
/* Waiting for the incoming response. */
- set_handler(txn_sm->q_current_handler, &state_interface_with_server);
+ set_handler(txn_sm->q_current_handler, (TxnSMHandler)&state_interface_with_server);
txn_sm->q_server_read_vio = TSVConnRead(txn_sm->q_server_vc, contp, txn_sm->q_server_response_buffer, INT64_MAX);
break;
@@ -595,7 +595,7 @@ state_interface_with_server(TSCont contp
TSIOBufferReaderFree(txn_sm->q_cache_response_buffer_reader);
/* Open cache_vc to read data and send to client. */
- set_handler(txn_sm->q_current_handler, &state_handle_cache_lookup);
+ set_handler(txn_sm->q_current_handler, (TxnSMHandler)&state_handle_cache_lookup);
txn_sm->q_pending_action = TSCacheRead(contp, txn_sm->q_key);
} else { /* not done with writing into cache */
@@ -692,7 +692,7 @@ state_write_to_cache(TSCont contp, TSEve
TSIOBufferReaderFree(txn_sm->q_cache_response_buffer_reader);
/* Open cache_vc to read data and send to client. */
- set_handler(txn_sm->q_current_handler, &state_handle_cache_lookup);
+ set_handler(txn_sm->q_current_handler, (TxnSMHandler)&state_handle_cache_lookup);
txn_sm->q_pending_action = TSCacheRead(contp, txn_sm->q_key);
} else { /* not done with writing into cache */
@@ -882,7 +882,7 @@ send_response_to_client(TSCont contp)
TSDebug("protocol", " . resp_len is %d, response_len");
- set_handler(txn_sm->q_current_handler, &state_interface_with_client);
+ set_handler(txn_sm->q_current_handler, (TxnSMHandler)&state_interface_with_client);
txn_sm->q_client_write_vio = TSVConnWrite(txn_sm->q_client_vc, (TSCont) contp,
txn_sm->q_client_response_buffer_reader, response_len);
return TS_SUCCESS;
Modified: trafficserver/traffic/trunk/example/protocol/TxnSM.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/example/protocol/TxnSM.h?rev=1078680&r1=1078679&r2=1078680&view=diff
==============================================================================
--- trafficserver/traffic/trunk/example/protocol/TxnSM.h (original)
+++ trafficserver/traffic/trunk/example/protocol/TxnSM.h Mon Mar 7 04:32:57 2011
@@ -50,7 +50,7 @@ typedef struct _TxnSM
char *q_server_response;
char *q_file_name;
- char *q_key;
+ TSCacheKey q_key;
char *q_server_name;
uint32_t q_server_ip;
Modified: trafficserver/traffic/trunk/example/thread-pool/psi.c
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/example/thread-pool/psi.c?rev=1078680&r1=1078679&r2=1078680&view=diff
==============================================================================
--- trafficserver/traffic/trunk/example/thread-pool/psi.c (original)
+++ trafficserver/traffic/trunk/example/thread-pool/psi.c Mon Mar 7 04:32:57 2011
@@ -919,11 +919,6 @@ transformable(TSHttpTxn txnp)
TSHandleMLocRelease(bufp, hdr_loc, field_loc);
field_loc = TSMimeHdrFieldFind(bufp, hdr_loc, MIME_FIELD_XPSI, -1);
- if (value == TS_NULL_MLOC) {
- TSError("[transformable] Error while searching XPSI field");
- TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc);
- return 0;
- }
TSHandleMLocRelease(bufp, hdr_loc, field_loc);
TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc);
Modified: trafficserver/traffic/trunk/iocore/cache/CachePages.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/cache/CachePages.cc?rev=1078680&r1=1078679&r2=1078680&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/cache/CachePages.cc (original)
+++ trafficserver/traffic/trunk/iocore/cache/CachePages.cc Mon Mar 7 04:32:57 2011
@@ -388,7 +388,7 @@ ShowCache::handleCacheEvent(int event, E
if (!cvio) {
buffer = new_empty_MIOBuffer();
buffer_reader = buffer->alloc_reader();
- content_length = TSVConnCacheObjectSizeGet(cache_vc);
+ content_length = cache_vc->get_object_size();
cvio = cache_vc->do_io_read(this, content_length, buffer);
} else
buffer_reader->consume(buffer_reader->read_avail());
Modified: trafficserver/traffic/trunk/iocore/eventsystem/I_IOBuffer.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/eventsystem/I_IOBuffer.h?rev=1078680&r1=1078679&r2=1078680&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/eventsystem/I_IOBuffer.h (original)
+++ trafficserver/traffic/trunk/iocore/eventsystem/I_IOBuffer.h Mon Mar 7 04:32:57 2011
@@ -754,14 +754,8 @@ public:
*/
char &operator[] (int64_t i);
- MIOBuffer *writer()
- {
- return mbuf;
- }
- MIOBuffer *allocated()
- {
- return mbuf;
- }
+ MIOBuffer *writer() const { return mbuf; }
+ MIOBuffer *allocated() const { return mbuf; }
MIOBufferAccessor *accessor; // pointer back to the accessor
@@ -782,8 +776,9 @@ public:
int64_t start_offset;
int64_t size_limit;
- IOBufferReader():accessor(NULL), mbuf(NULL), start_offset(0), size_limit(INT64_MAX) {
- }
+ IOBufferReader()
+ : accessor(NULL), mbuf(NULL), start_offset(0), size_limit(INT64_MAX)
+ { }
};
/**
Modified: trafficserver/traffic/trunk/iocore/eventsystem/P_IOBuffer.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/eventsystem/P_IOBuffer.h?rev=1078680&r1=1078679&r2=1078680&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/eventsystem/P_IOBuffer.h (original)
+++ trafficserver/traffic/trunk/iocore/eventsystem/P_IOBuffer.h Mon Mar 7 04:32:57 2011
@@ -575,14 +575,14 @@ IOBufferReader::current_low_water()
TS_INLINE IOBufferBlock *
IOBufferReader::get_current_block()
{
- return (block);
+ return block;
}
TS_INLINE char *
IOBufferReader::start()
{
if (block == 0)
- return (0);
+ return 0;
skip_empty_blocks();
return block->start() + start_offset;
}
@@ -591,7 +591,7 @@ TS_INLINE char *
IOBufferReader::end()
{
if (block == 0)
- return (0);
+ return 0;
skip_empty_blocks();
return block->end();
}
@@ -600,7 +600,7 @@ TS_INLINE int64_t
IOBufferReader::block_read_avail()
{
if (block == 0)
- return (0);
+ return 0;
skip_empty_blocks();
return (int64_t) (block->end() - (block->start() + start_offset));
}
Modified: trafficserver/traffic/trunk/proxy/FetchSM.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/FetchSM.cc?rev=1078680&r1=1078679&r2=1078680&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/FetchSM.cc (original)
+++ trafficserver/traffic/trunk/proxy/FetchSM.cc Mon Mar 7 04:32:57 2011
@@ -67,31 +67,30 @@ char* FetchSM::resp_get(int *length) {
int FetchSM::InvokePlugin(int event, void *data)
{
- Continuation *cont = (Continuation*) contp;
EThread *mythread = this_ethread();
- MUTEX_TAKE_LOCK(cont->mutex,mythread);
+ MUTEX_TAKE_LOCK(contp->mutex,mythread);
- int ret = cont->handleEvent(event,data);
+ int ret = contp->handleEvent(event,data);
- MUTEX_UNTAKE_LOCK(cont->mutex,mythread);
+ MUTEX_UNTAKE_LOCK(contp->mutex,mythread);
return ret;
}
void
-FetchSM::get_info_from_buffer(TSIOBufferReader the_reader)
+FetchSM::get_info_from_buffer(IOBufferReader *the_reader)
{
char *info;
// char *info_start;
int64_t read_avail, read_done;
- TSIOBufferBlock blk;
+ IOBufferBlock *blk;
char *buf;
if (!the_reader)
return ;
- read_avail = TSIOBufferReaderAvail(the_reader);
+ read_avail = the_reader->read_avail();
Debug(DEBUG_TAG, "[%s] total avail " PRId64 , __FUNCTION__, read_avail);
//size_t hdr_size = _headers.size();
//info = (char *) xmalloc(sizeof(char) * (read_avail+1) + hdr_size);
@@ -104,22 +103,26 @@ FetchSM::get_info_from_buffer(TSIOBuffer
/* Read the data out of the reader */
while (read_avail > 0) {
- blk = TSIOBufferReaderStart(the_reader);
- buf = (char *) TSIOBufferBlockReadStart(blk, the_reader, &read_done);
- memcpy(info, buf, read_done);
+ if (the_reader->block != NULL)
+ the_reader->skip_empty_blocks();
+ blk = the_reader->block;
+
+ // This is the equivalent of TSIOBufferBlockReadStart()
+ buf = blk->start() + the_reader->start_offset;
+ read_done = blk->read_avail() - the_reader->start_offset;
+
if (read_done > 0) {
- TSIOBufferReaderConsume(the_reader, read_done);
+ memcpy(info, buf, read_done);
+ the_reader->consume(read_done);
read_avail -= read_done;
info += read_done;
}
}
-
}
void
FetchSM::process_fetch_read(int event)
{
-
Debug(DEBUG_TAG, "[%s] I am here read", __FUNCTION__);
int64_t bytes;
int bytes_used;
Modified: trafficserver/traffic/trunk/proxy/FetchSM.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/FetchSM.h?rev=1078680&r1=1078679&r2=1078680&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/FetchSM.h (original)
+++ trafficserver/traffic/trunk/proxy/FetchSM.h Mon Mar 7 04:32:57 2011
@@ -25,7 +25,6 @@
*
* FetchSM.h header file for Fetch Page
*
- *
****************************************************************************/
#ifndef _FETCH_SM_H
@@ -39,9 +38,9 @@ class FetchSM: public Continuation
{
public:
FetchSM()
- {
- };
- void init(TSCont cont, TSFetchWakeUpOptions options, TSFetchEvent events, const char* headers, int length,unsigned int ip, int port)
+ { }
+
+ void init(Continuation* cont, TSFetchWakeUpOptions options, TSFetchEvent events, const char* headers, int length, unsigned int ip, int port)
{
//_headers.assign(headers);
Debug("FetchSM", "[%s] FetchSM initialized for request with headers\n--\n%s\n--", __FUNCTION__, headers);
@@ -71,10 +70,12 @@ public:
void process_fetch_write(int event);
void httpConnect();
void cleanUp();
- void get_info_from_buffer(TSIOBufferReader reader);
+ void get_info_from_buffer(IOBufferReader *reader);
char* resp_get(int* length);
+
private:
int InvokePlugin(int event, void*data);
+
void writeRequest(const char *headers,int length)
{
if(length == -1)
@@ -83,10 +84,7 @@ private:
req_buffer->write(headers,length);
}
- int64_t getReqLen()
- {
- return req_reader->read_avail();
- }
+ int64_t getReqLen() const { return req_reader->read_avail(); }
TSVConn http_vc;
VIO *read_vio;
@@ -99,7 +97,7 @@ private:
int client_bytes;
MIOBuffer *resp_buffer; // response to HttpConnect Call
IOBufferReader *resp_reader;
- TSCont contp;
+ Continuation *contp;
HTTPParser http_parser;
HTTPHdr client_response_hdr;
TSFetchEvent callback_events;
Modified: trafficserver/traffic/trunk/proxy/InkAPI.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/InkAPI.cc?rev=1078680&r1=1078679&r2=1078680&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/InkAPI.cc (original)
+++ trafficserver/traffic/trunk/proxy/InkAPI.cc Mon Mar 7 04:32:57 2011
@@ -938,7 +938,8 @@ INKContInternal::destroy()
INKContAllocator.free(this);
} else {
// TODO: Should this schedule on some other "thread" ?
- TSContSchedule(this, 0, TS_THREAD_POOL_DEFAULT);
+ // TODO: we don't care about the return action?
+ eventProcessor.schedule_imm(this, ET_NET);
}
}
@@ -1151,13 +1152,13 @@ INKVConnInternal::get_data(int id, void
{
switch (id) {
case TS_API_DATA_READ_VIO:
- *((TSVIO *) data) = &m_read_vio;
+ *((TSVIO *) data) = reinterpret_cast<TSVIO>(&m_read_vio);
return true;
case TS_API_DATA_WRITE_VIO:
- *((TSVIO *) data) = &m_write_vio;
+ *((TSVIO *) data) = reinterpret_cast<TSVIO>(&m_write_vio);
return true;
case TS_API_DATA_OUTPUT_VC:
- *((TSVConn *) data) = m_output_vc;
+ *((TSVConn *) data) = reinterpret_cast<TSVConn>(m_output_vc);
return true;
case TS_API_DATA_CLOSED:
*((int *) data) = m_closed;
@@ -2283,7 +2284,7 @@ TSMimeParserCreate(void)
{
TSMimeParser parser;
- parser = xmalloc(sizeof(MIMEParser));
+ parser = reinterpret_cast<TSMimeParser>(xmalloc(sizeof(MIMEParser)));
// TODO: Should remove this when memory allocation can't fail.
sdk_assert(sdk_sanity_check_mime_parser(parser) == TS_SUCCESS);
@@ -2327,7 +2328,7 @@ TSMimeHdrCreate(TSMBuffer bufp, TSMLoc *
if (!isWriteable(bufp))
return TS_ERROR;
- *locp = mime_hdr_create(((HdrHeapSDKHandle *) bufp)->m_heap);
+ *locp = reinterpret_cast<TSMLoc>(mime_hdr_create(((HdrHeapSDKHandle *) bufp)->m_heap));
return TS_SUCCESS;
}
@@ -2583,7 +2584,7 @@ TSMimeHdrFieldGet(TSMBuffer bufp, TSMLoc
MIMEFieldSDKHandle *h = sdk_alloc_field_handle(bufp, mh);
h->field_ptr = f;
- return h;
+ return reinterpret_cast<TSMLoc>(h);
}
TSMLoc
@@ -2606,7 +2607,7 @@ TSMimeHdrFieldFind(TSMBuffer bufp, TSMLo
MIMEFieldSDKHandle *h = sdk_alloc_field_handle(bufp, mh);
h->field_ptr = f;
- return h;
+ return reinterpret_cast<TSMLoc>(h);
}
TSReturnCode
@@ -2739,7 +2740,7 @@ TSMimeHdrFieldCreate(TSMBuffer bufp, TSM
MIMEFieldSDKHandle *h = sdk_alloc_field_handle(bufp, mh);
h->field_ptr = mime_field_create(heap, mh);
- *locp = h;
+ *locp = reinterpret_cast<TSMLoc>(h);
return TS_SUCCESS;
}
@@ -2762,7 +2763,7 @@ TSMimeHdrFieldCreateNamed(TSMBuffer bufp
HdrHeap *heap = (HdrHeap *) (((HdrHeapSDKHandle *) bufp)->m_heap);
MIMEFieldSDKHandle *h = sdk_alloc_field_handle(bufp, mh);
h->field_ptr = mime_field_create_named(heap, mh, name, name_len);
- *locp = h;
+ *locp = reinterpret_cast<TSMLoc>(h);
return TS_SUCCESS;
}
@@ -2901,7 +2902,7 @@ TSMimeHdrFieldNext(TSMBuffer bufp, TSMLo
MIMEFieldSDKHandle *h = sdk_alloc_field_handle(bufp, handle->mh);
h->field_ptr = f;
- return h;
+ return reinterpret_cast<TSMLoc>(h);
}
}
return TS_NULL_MLOC; // Shouldn't happen.
@@ -3323,7 +3324,7 @@ TSHttpParserCreate(void)
TSHttpParser parser;
// xmalloc should be set to not fail IMO.
- parser = xmalloc(sizeof(HTTPParser));
+ parser = reinterpret_cast<TSHttpParser>(xmalloc(sizeof(HTTPParser)));
sdk_assert(sdk_sanity_check_http_parser(parser) == TS_SUCCESS);
http_parser_init((HTTPParser *) parser);
@@ -3899,16 +3900,16 @@ TSCacheHttpInfoCopy(TSCacheHttpInfo info
CacheHTTPInfo *new_info = NEW(new CacheHTTPInfo);
new_info->copy((CacheHTTPInfo *) infop);
- return new_info;
+ return reinterpret_cast<TSCacheHttpInfo>(new_info);
}
void
TSCacheHttpInfoReqGet(TSCacheHttpInfo infop, TSMBuffer *bufp, TSMLoc *obj)
{
- CacheHTTPInfo *info = (CacheHTTPInfo *) infop;
+ CacheHTTPInfo *info = (CacheHTTPInfo *)infop;
- *bufp = info->request_get();
- *obj = info->request_get()->m_http;
+ *(reinterpret_cast<HTTPHdr**>(bufp)) = info->request_get();
+ *obj = reinterpret_cast<TSMLoc>(info->request_get()->m_http);
sdk_sanity_check_mbuffer(*bufp);
}
@@ -3918,8 +3919,8 @@ TSCacheHttpInfoRespGet(TSCacheHttpInfo i
{
CacheHTTPInfo *info = (CacheHTTPInfo *) infop;
- *bufp = info->response_get();
- *obj = info->response_get()->m_http;
+ *(reinterpret_cast<HTTPHdr**>(bufp)) = info->response_get();
+ *obj = reinterpret_cast<TSMLoc>(info->response_get()->m_http);
sdk_sanity_check_mbuffer(*bufp);
}
@@ -3977,7 +3978,7 @@ TSCacheHttpInfoCreate(void)
CacheHTTPInfo *info = new CacheHTTPInfo;
info->create();
- return info;
+ return reinterpret_cast<TSCacheHttpInfo>(info);
}
@@ -3999,7 +4000,7 @@ TSConfigSet(unsigned int id, void *data,
TSConfig
TSConfigGet(unsigned int id)
{
- return configProcessor.get(id);
+ return reinterpret_cast<TSConfig>(configProcessor.get(id));
}
void
@@ -4155,9 +4156,9 @@ TSContSchedule(TSCont contp, ink_hrtime
}
if (timeout == 0) {
- action = eventProcessor.schedule_imm(i, etype);
+ action = reinterpret_cast<TSAction>(eventProcessor.schedule_imm(i, etype));
} else {
- action = eventProcessor.schedule_in(i, HRTIME_MSECONDS(timeout), etype);
+ action = reinterpret_cast<TSAction>(eventProcessor.schedule_in(i, HRTIME_MSECONDS(timeout), etype));
}
/* This is a hack. SHould be handled in ink_types */
@@ -4193,7 +4194,7 @@ TSContScheduleEvery(TSCont contp, ink_hr
break;
}
- action = eventProcessor.schedule_every(i, HRTIME_MSECONDS(every), etype);
+ action = reinterpret_cast<TSAction>(eventProcessor.schedule_every(i, HRTIME_MSECONDS(every), etype));
/* This is a hack. SHould be handled in ink_types */
action = (TSAction) ((uintptr_t) action | 0x1);
@@ -4214,9 +4215,9 @@ TSHttpSchedule(TSCont contp, TSHttpTxn t
sm->set_http_schedule(cont);
if (timeout == 0) {
- action = eventProcessor.schedule_imm(sm, ET_NET);
+ action = reinterpret_cast<TSAction>(eventProcessor.schedule_imm(sm, ET_NET));
} else {
- action = eventProcessor.schedule_in(sm, HRTIME_MSECONDS (timeout), ET_NET);
+ action = reinterpret_cast<TSAction>(eventProcessor.schedule_in(sm, HRTIME_MSECONDS (timeout), ET_NET));
}
action = (TSAction) ((uintptr_t) action | 0x1);
@@ -4235,8 +4236,8 @@ TSContMutexGet(TSCont contp)
{
sdk_assert(sdk_sanity_check_iocore_structure(contp) == TS_SUCCESS);
- Continuation *c = (Continuation *) contp;
- return (TSMutex) ((ProxyMutex *) c->mutex);
+ Continuation *c = (Continuation *)contp;
+ return (TSMutex) ((ProxyMutex *)c->mutex);
}
@@ -4393,8 +4394,8 @@ TSHttpTxnClientReqGet(TSHttpTxn txnp, TS
HTTPHdr *hptr = &(sm->t_state.hdr_info.client_request);
if (hptr->valid()) {
- *bufp = hptr;
- *obj = hptr->m_http;
+ *(reinterpret_cast<HTTPHdr**>(bufp)) = hptr;
+ *obj = reinterpret_cast<TSMLoc>(hptr->m_http);
if (sdk_sanity_check_mbuffer(*bufp) == TS_SUCCESS) {
hptr->mark_target_dirty();
return TS_SUCCESS;;
@@ -4415,7 +4416,7 @@ TSHttpTxnPristineUrlGet(TSHttpTxn txnp,
HTTPHdr *hptr = &(sm->t_state.hdr_info.client_request);
if (hptr->valid()) {
- *bufp = hptr;
+ *(reinterpret_cast<HTTPHdr**>(bufp)) = hptr;
*url_loc = (TSMLoc)sm->t_state.pristine_url.m_url_impl;
if ((sdk_sanity_check_mbuffer(*bufp) == TS_SUCCESS) && (*url_loc))
@@ -4446,8 +4447,8 @@ TSHttpTxnClientRespGet(TSHttpTxn txnp, T
HTTPHdr *hptr = &(sm->t_state.hdr_info.client_response);
if (hptr->valid()) {
- *bufp = hptr;
- *obj = hptr->m_http;
+ *(reinterpret_cast<HTTPHdr**>(bufp)) = hptr;
+ *obj = reinterpret_cast<TSMLoc>(hptr->m_http);
sdk_sanity_check_mbuffer(*bufp);
return TS_SUCCESS;
}
@@ -4467,8 +4468,8 @@ TSHttpTxnServerReqGet(TSHttpTxn txnp, TS
HTTPHdr *hptr = &(sm->t_state.hdr_info.server_request);
if (hptr->valid()) {
- *bufp = hptr;
- *obj = hptr->m_http;
+ *(reinterpret_cast<HTTPHdr**>(bufp)) = hptr;
+ *obj = reinterpret_cast<TSMLoc>(hptr->m_http);
sdk_sanity_check_mbuffer(*bufp);
return TS_SUCCESS;
}
@@ -4487,8 +4488,8 @@ TSHttpTxnServerRespGet(TSHttpTxn txnp, T
HTTPHdr *hptr = &(sm->t_state.hdr_info.server_response);
if (hptr->valid()) {
- *bufp = hptr;
- *obj = hptr->m_http;
+ *(reinterpret_cast<HTTPHdr**>(bufp)) = hptr;
+ *obj = reinterpret_cast<TSMLoc>(hptr->m_http);
sdk_sanity_check_mbuffer(*bufp);
return TS_SUCCESS;
}
@@ -4527,8 +4528,8 @@ TSHttpTxnCachedReqGet(TSHttpTxn txnp, TS
(*handle)->m_heap = cached_hdr->m_heap;
}
- *bufp = *handle;
- *obj = cached_hdr->m_http;
+ *(reinterpret_cast<HdrHeapSDKHandle**>(bufp)) = *handle;
+ *obj = reinterpret_cast<TSMLoc>(cached_hdr->m_http);
sdk_sanity_check_mbuffer(*bufp);
return TS_SUCCESS;
@@ -4565,8 +4566,8 @@ TSHttpTxnCachedRespGet(TSHttpTxn txnp, T
(*handle)->m_heap = cached_hdr->m_heap;
}
- *bufp = *handle;
- *obj = cached_hdr->m_http;
+ *(reinterpret_cast<HdrHeapSDKHandle**>(bufp)) = *handle;
+ *obj = reinterpret_cast<TSMLoc>(cached_hdr->m_http);
sdk_sanity_check_mbuffer(*bufp);
return TS_SUCCESS;
@@ -4599,8 +4600,8 @@ TSHttpTxnCachedRespModifiableGet(TSHttpT
s->api_modifiable_cached_resp = true;
ink_assert(c_resp != NULL && c_resp->valid());
- *bufp = c_resp;
- *obj = c_resp->m_http;
+ *(reinterpret_cast<HTTPHdr**>(bufp)) = c_resp;
+ *obj = reinterpret_cast<TSMLoc>(c_resp->m_http);
sdk_sanity_check_mbuffer(*bufp);
return TS_SUCCESS;
@@ -5071,8 +5072,8 @@ TSHttpTxnTransformRespGet(TSHttpTxn txnp
HTTPHdr *hptr = &(sm->t_state.hdr_info.transform_response);
if (hptr->valid()) {
- *bufp = hptr;
- *obj = hptr->m_http;
+ *(reinterpret_cast<HTTPHdr**>(bufp)) = hptr;
+ *obj = reinterpret_cast<TSMLoc>(hptr->m_http);
sdk_sanity_check_mbuffer(*bufp);
return TS_SUCCESS;
@@ -5687,8 +5688,8 @@ TSHttpAltInfoClientReqGet(TSHttpAltInfo
HttpAltInfo *info = (HttpAltInfo *) infop;
- *bufp = &info->m_client_req;
- *obj = info->m_client_req.m_http;
+ *(reinterpret_cast<HTTPHdr**>(bufp)) = &info->m_client_req;
+ *obj = reinterpret_cast<TSMLoc>(info->m_client_req.m_http);
return sdk_sanity_check_mbuffer(*bufp);
}
@@ -5700,8 +5701,8 @@ TSHttpAltInfoCachedReqGet(TSHttpAltInfo
HttpAltInfo *info = (HttpAltInfo *) infop;
- *bufp = &info->m_cached_req;
- *obj = info->m_cached_req.m_http;
+ *(reinterpret_cast<HTTPHdr**>(bufp)) = &info->m_cached_req;
+ *obj = reinterpret_cast<TSMLoc>(info->m_cached_req.m_http);
return sdk_sanity_check_mbuffer(*bufp);
}
@@ -5713,8 +5714,8 @@ TSHttpAltInfoCachedRespGet(TSHttpAltInfo
HttpAltInfo *info = (HttpAltInfo *) infop;
- *bufp = &info->m_cached_resp;
- *obj = info->m_cached_resp.m_http;
+ *(reinterpret_cast<HTTPHdr**>(bufp)) = &info->m_cached_resp;
+ *obj = reinterpret_cast<TSMLoc>(info->m_cached_resp.m_http);
return sdk_sanity_check_mbuffer(*bufp);
}
@@ -5752,7 +5753,7 @@ TSHttpConnect(unsigned int log_ip, int l
}
}
- return return_vc;
+ return reinterpret_cast<TSVConn>(return_vc);
}
return NULL;
@@ -5820,7 +5821,7 @@ TSVConnCreate(TSEventFunc event_funcp, T
sdk_assert(sdk_sanity_check_null_ptr((void*)i) == TS_SUCCESS);
i->init(event_funcp, mutexp);
- return (TSCont)i;
+ return reinterpret_cast<TSVConn>(i);
}
TSVIO
@@ -5869,7 +5870,8 @@ TSVConnRead(TSVConn connp, TSCont contp,
FORCE_PLUGIN_MUTEX(contp);
VConnection *vc = (VConnection *) connp;
- return vc->do_io(VIO::READ, (INKContInternal *) contp, nbytes, (MIOBuffer *) bufp);
+
+ return reinterpret_cast<TSVIO>(vc->do_io(VIO::READ, (INKContInternal *) contp, nbytes, (MIOBuffer *) bufp));
}
TSVIO
@@ -5882,7 +5884,8 @@ TSVConnWrite(TSVConn connp, TSCont contp
FORCE_PLUGIN_MUTEX(contp);
VConnection *vc = (VConnection *) connp;
- return vc->do_io_write((INKContInternal *) contp, nbytes, (IOBufferReader *) readerp);
+
+ return reinterpret_cast<TSVIO>(vc->do_io_write((INKContInternal *) contp, nbytes, (IOBufferReader *) readerp));
}
void
@@ -5944,8 +5947,9 @@ TSVConn
TSTransformCreate(TSEventFunc event_funcp, TSHttpTxn txnp)
{
sdk_assert(sdk_sanity_check_txn(txnp) == TS_SUCCESS);
-
- return TSVConnCreate(event_funcp, TSContMutexGet(txnp));
+ // TODO: This is somewhat of a leap of faith, but I think a TSHttpTxn is just another
+ // fancy continuation?
+ return TSVConnCreate(event_funcp, TSContMutexGet(reinterpret_cast<TSCont>(txnp)));
}
TSVConn
@@ -6191,7 +6195,7 @@ TSCacheScan(TSCont contp, TSCacheKey key
CacheInfo *info = (CacheInfo *) key;
return (TSAction)cacheProcessor.scan(i, info->hostname, info->len, KB_per_second);
}
- return cacheProcessor.scan(i, 0, 0, KB_per_second);
+ return reinterpret_cast<TSAction>(cacheProcessor.scan(i, 0, 0, KB_per_second));
}
@@ -6717,7 +6721,7 @@ TSMatcherExtractIPRange(char *match_str,
TSMatcherLine
TSMatcherLineCreate(void)
{
- return (void*)xmalloc(sizeof(matcher_line));
+ return reinterpret_cast<TSMatcherLine>(xmalloc(sizeof(matcher_line)));
}
void
@@ -6819,8 +6823,8 @@ TSICPCachedReqGet(TSCont contp, TSMBuffe
(*handle)->m_heap = cached_hdr->m_heap;
}
- *bufp = *handle;
- *obj = cached_hdr->m_http;
+ *(reinterpret_cast<HdrHeapSDKHandle**>(bufp)) = *handle;
+ *obj = reinterpret_cast<TSMLoc>(cached_hdr->m_http);
sdk_sanity_check_mbuffer(*bufp);
return TS_SUCCESS;
@@ -6856,8 +6860,8 @@ TSICPCachedRespGet(TSCont contp, TSMBuff
(*handle)->m_heap = cached_hdr->m_heap;
}
- *bufp = *handle;
- *obj = cached_hdr->m_http;
+ *(reinterpret_cast<HdrHeapSDKHandle**>(bufp)) = *handle;
+ *obj = reinterpret_cast<TSMLoc>(cached_hdr->m_http);
sdk_sanity_check_mbuffer(*bufp);
return TS_SUCCESS;
@@ -6967,8 +6971,8 @@ TSFetchPageRespGet(TSHttpTxn txnp, TSMBu
HTTPHdr *hptr = (HTTPHdr*) txnp;
if (hptr->valid()) {
- *bufp = hptr;
- *obj = hptr->m_http;
+ *(reinterpret_cast<HTTPHdr**>(bufp)) = hptr;
+ *obj = reinterpret_cast<TSMLoc>(hptr->m_http);
if (sdk_sanity_check_mbuffer(*bufp) == TS_SUCCESS)
return TS_SUCCESS;
}
@@ -6987,7 +6991,7 @@ TSFetchPages(TSFetchUrlParams_t *params)
while (myparams != NULL) {
FetchSM *fetch_sm = FetchSMAllocator.alloc();
- fetch_sm->init(myparams->contp, myparams->options,myparams->events, myparams->request, myparams->request_len, myparams->ip, myparams->port);
+ fetch_sm->init((Continuation*)myparams->contp, myparams->options,myparams->events, myparams->request, myparams->request_len, myparams->ip, myparams->port);
fetch_sm->httpConnect();
myparams= myparams->next;
}
@@ -7000,7 +7004,7 @@ TSFetchUrl(const char* headers, int requ
FetchSM *fetch_sm = FetchSMAllocator.alloc();
- fetch_sm->init(contp, callback_options, events, headers, request_len, ip,port);
+ fetch_sm->init((Continuation*)contp, callback_options, events, headers, request_len, ip,port);
fetch_sm->httpConnect();
}
@@ -7025,7 +7029,7 @@ TSAIORead(int fd, off_t offset, char* bu
{
sdk_assert(sdk_sanity_check_iocore_structure(contp) == TS_SUCCESS);
- Continuation* pCont = (Continuation*) contp;
+ Continuation* pCont = (Continuation*)contp;
AIOCallback* pAIO = new_AIOCallback();
if (pAIO == NULL)
@@ -7047,14 +7051,14 @@ TSAIORead(int fd, off_t offset, char* bu
}
char*
-TSAIOBufGet(void *data)
+TSAIOBufGet(TSAIOCallback data)
{
AIOCallback* pAIO = (AIOCallback*)data;
return (char*)pAIO->aiocb.aio_buf;
}
int
-TSAIONBytesGet(void *data)
+TSAIONBytesGet(TSAIOCallback data)
{
AIOCallback* pAIO = (AIOCallback*)data;
return (int)pAIO->aio_result;
@@ -7315,7 +7319,7 @@ TSHttpTxnConfigIntSet(TSHttpTxn txnp, TS
{
sdk_assert(sdk_sanity_check_txn(txnp) == TS_SUCCESS);
- HttpSM *s = static_cast<HttpSM*>(txnp);
+ HttpSM *s = reinterpret_cast<HttpSM*>(txnp);
// If this is the first time we're trying to modify a transaction config, copy it.
if (s->t_state.txn_conf != &s->t_state.my_txn_conf) {
@@ -7362,7 +7366,7 @@ TSHttpTxnConfigFloatSet(TSHttpTxn txnp,
{
sdk_assert(sdk_sanity_check_txn(txnp) == TS_SUCCESS);
- HttpSM *s = static_cast<HttpSM*>(txnp);
+ HttpSM *s = reinterpret_cast<HttpSM*>(txnp);
OverridableDataType type;
// If this is the first time we're trying to modify a transaction config, copy it.
Modified: trafficserver/traffic/trunk/proxy/InkAPITest.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/InkAPITest.cc?rev=1078680&r1=1078679&r2=1078680&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/InkAPITest.cc (original)
+++ trafficserver/traffic/trunk/proxy/InkAPITest.cc Mon Mar 7 04:32:57 2011
@@ -222,14 +222,14 @@ REGRESSION_TEST(SDK_API_TSConfig) (Regre
if (!test_config) {
SDK_RPRINT(test, "TSConfigSet", "TestCase1", TC_FAIL, "can't correctly set global config structure");
SDK_RPRINT(test, "TSConfigGet", "TestCase1", TC_FAIL, "can't correctly get global config structure");
- TSConfigRelease(my_config_id, config);
+ TSConfigRelease(my_config_id, reinterpret_cast<TSConfig>(config));
*pstatus = REGRESSION_TEST_FAILED;
return;
}
if (TSConfigDataGet(test_config) != config) {
SDK_RPRINT(test, "TSConfigDataGet", "TestCase1", TC_FAIL, "failed to get config data");
- TSConfigRelease(my_config_id, config);
+ TSConfigRelease(my_config_id, reinterpret_cast<TSConfig>(config));
*pstatus = REGRESSION_TEST_FAILED;
return;
}
@@ -238,7 +238,7 @@ REGRESSION_TEST(SDK_API_TSConfig) (Regre
SDK_RPRINT(test, "TSConfigSet", "TestCase1", TC_PASS, "ok");
SDK_RPRINT(test, "TSConfigDataGet", "TestCase1", TC_PASS, "ok");
- TSConfigRelease(my_config_id, config);
+ TSConfigRelease(my_config_id, reinterpret_cast<TSConfig>(config));
*pstatus = REGRESSION_TEST_PASSED;
return;
}
@@ -2315,9 +2315,8 @@ checkHttpTxnClientReqGet(SocketTest * te
return TS_EVENT_CONTINUE;
}
-
- if ((bufp == (&((HttpSM *) txnp)->t_state.hdr_info.client_request)) &&
- (mloc == (((HttpSM *) txnp)->t_state.hdr_info.client_request.m_http))) {
+ if ((bufp == reinterpret_cast<TSMBuffer>(&((HttpSM *) txnp)->t_state.hdr_info.client_request)) &&
+ (mloc == reinterpret_cast<TSMLoc>(((HttpSM *)txnp)->t_state.hdr_info.client_request.m_http))) {
test->test_client_req_get = true;
SDK_RPRINT(test->regtest, "TSHttpTxnClientReqGet", "TestCase1", TC_PASS, "ok");
} else {
@@ -2343,8 +2342,8 @@ checkHttpTxnClientRespGet(SocketTest * t
return TS_EVENT_CONTINUE;
}
- if ((bufp == (&((HttpSM *) txnp)->t_state.hdr_info.client_response)) &&
- (mloc == (((HttpSM *) txnp)->t_state.hdr_info.client_response.m_http))) {
+ if ((bufp == reinterpret_cast<TSMBuffer>(&((HttpSM *) txnp)->t_state.hdr_info.client_response)) &&
+ (mloc == reinterpret_cast<TSMLoc>(((HttpSM *) txnp)->t_state.hdr_info.client_response.m_http))) {
test->test_client_resp_get = true;
SDK_RPRINT(test->regtest, "TSHttpTxnClientRespGet", "TestCase1", TC_PASS, "ok");
} else {
@@ -2370,8 +2369,8 @@ checkHttpTxnServerReqGet(SocketTest * te
return TS_EVENT_CONTINUE;
}
- if ((bufp == (&((HttpSM *) txnp)->t_state.hdr_info.server_request)) &&
- (mloc == (((HttpSM *) txnp)->t_state.hdr_info.server_request.m_http))) {
+ if ((bufp == reinterpret_cast<TSMBuffer>(&((HttpSM *) txnp)->t_state.hdr_info.server_request)) &&
+ (mloc == reinterpret_cast<TSMLoc>(((HttpSM *) txnp)->t_state.hdr_info.server_request.m_http))) {
test->test_server_req_get = true;
SDK_RPRINT(test->regtest, "TSHttpTxnServerReqGet", "TestCase1", TC_PASS, "ok");
} else {
@@ -2397,8 +2396,8 @@ checkHttpTxnServerRespGet(SocketTest * t
return TS_EVENT_CONTINUE;
}
- if ((bufp == (&((HttpSM *) txnp)->t_state.hdr_info.server_response)) &&
- (mloc == (((HttpSM *) txnp)->t_state.hdr_info.server_response.m_http))) {
+ if ((bufp == reinterpret_cast<TSMBuffer>(&((HttpSM *) txnp)->t_state.hdr_info.server_response)) &&
+ (mloc == reinterpret_cast<TSMLoc>(((HttpSM *) txnp)->t_state.hdr_info.server_response.m_http))) {
test->test_server_resp_get = true;
SDK_RPRINT(test->regtest, "TSHttpTxnServerRespGet", "TestCase1", TC_PASS, "ok");
} else {
@@ -4890,7 +4889,7 @@ convert_mime_hdr_to_string(TSMBuffer buf
TSReturnCode
compare_field_values(RegressionTest * test, TSMBuffer bufp1, TSMLoc hdr_loc1, TSMLoc field_loc1, TSMBuffer bufp2,
- TSMBuffer hdr_loc2, TSMLoc field_loc2, bool first_time)
+ TSMLoc hdr_loc2, TSMLoc field_loc2, bool first_time)
{
NOWARN_UNUSED(first_time);
int no_of_values1;
@@ -6299,8 +6298,8 @@ cache_hook_handler(TSCont contp, TSEvent
if (TSHttpTxnCachedReqGet(txnp, &reqbuf, &reqhdr) != TS_SUCCESS) {
SDK_RPRINT(data->test, "TSHttpTxnCachedReqGet", "TestCase1", TC_FAIL, "TSHttpTxnCachedReqGet returns 0");
} else {
- if ((reqbuf == (((HttpSM *) txnp)->t_state.cache_req_hdr_heap_handle)) &&
- (reqhdr == ((((HttpSM *) txnp)->t_state.cache_info.object_read->request_get())->m_http))) {
+ if ((reqbuf == reinterpret_cast<TSMBuffer>(((HttpSM *) txnp)->t_state.cache_req_hdr_heap_handle)) &&
+ (reqhdr == reinterpret_cast<TSMLoc>((((HttpSM *) txnp)->t_state.cache_info.object_read->request_get())->m_http))) {
SDK_RPRINT(data->test, "TSHttpTxnCachedReqGet", "TestCase1", TC_PASS, "ok");
data->test_passed_txn_cached_req_get = true;
} else {
@@ -6311,8 +6310,8 @@ cache_hook_handler(TSCont contp, TSEvent
if (TSHttpTxnCachedRespGet(txnp, &respbuf, &resphdr) != TS_SUCCESS) {
SDK_RPRINT(data->test, "TSHttpTxnCachedRespGet", "TestCase1", TC_FAIL, "TSHttpTxnCachedRespGet returns 0");
} else {
- if ((respbuf == (((HttpSM *) txnp)->t_state.cache_resp_hdr_heap_handle)) &&
- (resphdr == ((((HttpSM *) txnp)->t_state.cache_info.object_read->response_get())->m_http))) {
+ if ((respbuf == reinterpret_cast<TSMBuffer>(((HttpSM *) txnp)->t_state.cache_resp_hdr_heap_handle)) &&
+ (resphdr == reinterpret_cast<TSMLoc>((((HttpSM *) txnp)->t_state.cache_info.object_read->response_get())->m_http))) {
SDK_RPRINT(data->test, "TSHttpTxnCachedRespGet", "TestCase1", TC_PASS, "ok");
data->test_passed_txn_cached_resp_get = true;
} else {
@@ -6815,8 +6814,8 @@ transform_hook_handler(TSCont contp, TSE
SDK_RPRINT(data->test, "TSHttpTxnTransformRespGet", "TestCase", TC_FAIL, "TSHttpTxnTransformRespGet returns 0");
data->test_passed_txn_transform_resp_get = false;
} else {
- if ((bufp == &(((HttpSM *) txnp)->t_state.hdr_info.transform_response)) &&
- (hdr == (&(((HttpSM *) txnp)->t_state.hdr_info.transform_response))->m_http)) {
+ if ((bufp == reinterpret_cast<TSMBuffer>(&(((HttpSM *) txnp)->t_state.hdr_info.transform_response))) &&
+ (hdr == reinterpret_cast<TSMLoc>((&(((HttpSM *) txnp)->t_state.hdr_info.transform_response))->m_http))) {
SDK_RPRINT(data->test, "TSHttpTxnTransformRespGet", "TestCase", TC_PASS, "ok");
} else {
SDK_RPRINT(data->test, "TSHttpTxnTransformRespGet", "TestCase", TC_FAIL, "Value's Mismatch");
@@ -7088,8 +7087,8 @@ altinfo_hook_handler(TSCont contp, TSEve
"TSHttpAltInfoClientReqGet doesn't return TS_SUCCESS");
data->test_passed_txn_alt_info_client_req_get = false;
} else {
- if ((clientreqbuf == (&(((HttpAltInfo *) infop)->m_client_req))) &&
- (clientreqhdr == ((HttpAltInfo *) infop)->m_client_req.m_http)) {
+ if ((clientreqbuf == reinterpret_cast<TSMBuffer>(&(((HttpAltInfo *)infop)->m_client_req))) &&
+ (clientreqhdr == reinterpret_cast<TSMLoc>(((HttpAltInfo *)infop)->m_client_req.m_http))) {
SDK_RPRINT(data->test, "TSHttpAltInfoClientReqGet", "TestCase", TC_PASS, "ok");
} else {
SDK_RPRINT(data->test, "TSHttpAltInfoClientReqGet", "TestCase", TC_FAIL, "Value's Mismatch");
@@ -7102,8 +7101,8 @@ altinfo_hook_handler(TSCont contp, TSEve
"TSHttpAltInfoCachedReqGet doesn't return TS_SUCCESS");
data->test_passed_txn_alt_info_cached_req_get = false;
} else {
- if ((cachereqbuf == (&(((HttpAltInfo *) infop)->m_cached_req))) &&
- (cachereqhdr == ((HttpAltInfo *) infop)->m_cached_req.m_http)) {
+ if ((cachereqbuf == reinterpret_cast<TSMBuffer>(&(((HttpAltInfo *) infop)->m_cached_req))) &&
+ (cachereqhdr == reinterpret_cast<TSMLoc>(((HttpAltInfo *) infop)->m_cached_req.m_http))) {
SDK_RPRINT(data->test, "TSHttpAltInfoCachedReqGet", "TestCase", TC_PASS, "ok");
} else {
SDK_RPRINT(data->test, "TSHttpAltInfoCachedReqGet", "TestCase", TC_FAIL, "Value's Mismatch");
@@ -7116,8 +7115,8 @@ altinfo_hook_handler(TSCont contp, TSEve
"TSHttpAltInfoCachedRespGet doesn't return TS_SUCCESS");
data->test_passed_txn_alt_info_cached_resp_get = false;
} else {
- if ((cacherespbuf == (&(((HttpAltInfo *) infop)->m_cached_resp))) &&
- (cacheresphdr == ((HttpAltInfo *) infop)->m_cached_resp.m_http)) {
+ if ((cacherespbuf == reinterpret_cast<TSMBuffer>(&(((HttpAltInfo *) infop)->m_cached_resp))) &&
+ (cacheresphdr == reinterpret_cast<TSMLoc>(((HttpAltInfo *) infop)->m_cached_resp.m_http))) {
SDK_RPRINT(data->test, "TSHttpAltInfoCachedRespGet", "TestCase", TC_PASS, "ok");
} else {
SDK_RPRINT(data->test, "TSHttpAltInfoCachedRespGet", "TestCase", TC_FAIL, "Value's Mismatch");
@@ -7552,7 +7551,7 @@ REGRESSION_TEST(SDK_API_OVERRIDABLE_CONF
TSRecordDataType type;
HttpSM* s = HttpSM::allocate();
bool success = true;
- TSHttpTxn txnp = static_cast<TSHttpTxn>(s); // Convenience ...
+ TSHttpTxn txnp = reinterpret_cast<TSHttpTxn>(s);
TSMgmtInt ival;
TSMgmtFloat fval;
const char* sval;
Modified: trafficserver/traffic/trunk/proxy/InkIOCoreAPI.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/InkIOCoreAPI.cc?rev=1078680&r1=1078679&r2=1078680&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/InkIOCoreAPI.cc (original)
+++ trafficserver/traffic/trunk/proxy/InkIOCoreAPI.cc Mon Mar 7 04:32:57 2011
@@ -157,7 +157,7 @@ TSThreadInit()
thread->set_specific();
- return thread;
+ return reinterpret_cast<TSThread>(thread);
}
void
@@ -206,7 +206,7 @@ TSMutexCreateInternal()
sdk_assert(sdk_sanity_check_mutex((TSMutex)new_mutex) == TS_SUCCESS);
new_mutex->refcount_inc();
- return (TSMutex *)new_mutex;
+ return reinterpret_cast<TSMutex>(new_mutex);
}
int
@@ -260,7 +260,7 @@ TSVIOBufferGet(TSVIO viop)
sdk_assert(sdk_sanity_check_iocore_structure(viop) == TS_SUCCESS);
VIO *vio = (VIO *)viop;
- return vio->get_writer();
+ return reinterpret_cast<TSIOBuffer>(vio->get_writer());
}
TSIOBufferReader
@@ -269,7 +269,7 @@ TSVIOReaderGet(TSVIO viop)
sdk_assert(sdk_sanity_check_iocore_structure(viop) == TS_SUCCESS);
VIO *vio = (VIO *)viop;
- return vio->get_reader();
+ return reinterpret_cast<TSIOBufferReader>(vio->get_reader());
}
int64_t
@@ -362,7 +362,7 @@ INKUDPBind(TSCont contp, unsigned int ip
sdk_assert(sdk_sanity_check_continuation(contp) == TS_SUCCESS);
FORCE_PLUGIN_MUTEX(contp);
- return (udpNet.UDPBind((Continuation *)contp, port, ip, INK_ETHERNET_MTU_SIZE, INK_ETHERNET_MTU_SIZE));
+ return reinterpret_cast<TSAction>(udpNet.UDPBind((Continuation *)contp, port, ip, INK_ETHERNET_MTU_SIZE, INK_ETHERNET_MTU_SIZE));
}
TSAction
@@ -394,7 +394,7 @@ INKUDPSendTo(TSCont contp, INKUDPConn ud
failed assert `!m_conn` */
/* packet->setConnection ((UDPConnection *)udp); */
- return conn->send((Continuation *)contp, packet);
+ return reinterpret_cast<TSAction>(conn->send((Continuation *)contp, packet));
}
@@ -405,7 +405,7 @@ INKUDPRecvFrom(TSCont contp, INKUDPConn
FORCE_PLUGIN_MUTEX(contp);
UDPConnection *conn = (UDPConnection *)udp;
- return conn->recv((Continuation *)contp);
+ return reinterpret_cast<TSAction>(conn->recv((Continuation *)contp));
}
int
@@ -494,7 +494,7 @@ TSIOBufferCreate()
// TODO: Should remove this when memory allocations can't fail.
sdk_assert(sdk_sanity_check_iocore_structure(b) == TS_SUCCESS);
- return (TSIOBuffer *)b;
+ return reinterpret_cast<TSIOBuffer>(b);
}
TSIOBuffer
@@ -506,7 +506,7 @@ TSIOBufferSizedCreate(TSIOBufferSizeInde
// TODO: Should remove this when memory allocations can't fail.
sdk_assert(sdk_sanity_check_iocore_structure(b) == TS_SUCCESS);
- return (TSIOBuffer *)b;
+ return reinterpret_cast<TSIOBuffer>(b);
}
void
@@ -665,9 +665,8 @@ TSIOBufferBlockReadStart(TSIOBufferBlock
char *p;
p = blk->start();
- if (avail) {
+ if (avail)
*avail = blk->read_avail();
- }
if (blk == reader->block) {
p += reader->start_offset;
@@ -784,7 +783,7 @@ TSIOBufferReaderStart(TSIOBufferReader r
if (r->block != NULL)
r->skip_empty_blocks();
- return (TSIOBufferBlock)r->block;
+ return reinterpret_cast<TSIOBufferBlock>(r->get_current_block());
}
void
Modified: trafficserver/traffic/trunk/proxy/Prefetch.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/Prefetch.cc?rev=1078680&r1=1078679&r2=1078680&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/Prefetch.cc (original)
+++ trafficserver/traffic/trunk/proxy/Prefetch.cc Mon Mar 7 04:32:57 2011
@@ -288,8 +288,9 @@ ClassAllocator<PrefetchUrlEntry> prefetc
(((status) == HTTP_STATUS_TEMPORARY_REDIRECT))))
-PrefetchTransform::PrefetchTransform(HttpSM * sm, HTTPHdr * resp)
- : INKVConnInternal(NULL, sm->mutex), m_output_buf(NULL), m_output_vio(NULL), m_sm(sm)
+PrefetchTransform::PrefetchTransform(HttpSM *sm, HTTPHdr *resp)
+ : INKVConnInternal(NULL, reinterpret_cast<TSMutex>((ProxyMutex*)sm->mutex)),
+ m_output_buf(NULL), m_output_vio(NULL), m_sm(sm)
{
refcount_inc();
@@ -457,7 +458,7 @@ PrefetchTransform::handle_event(int even
}
int
-PrefetchTransform::redirect(HTTPHdr * resp)
+PrefetchTransform::redirect(HTTPHdr *resp)
{
HTTPHdr *req = NULL;
int response_status = 0;
@@ -535,7 +536,7 @@ PrefetchTransform::redirect(HTTPHdr * re
}
int
-PrefetchTransform::parse_data(IOBufferReader * reader)
+PrefetchTransform::parse_data(IOBufferReader *reader)
{
char *url_start = NULL, *url_end = NULL;
@@ -586,7 +587,7 @@ PrefetchTransform::hash_add(char *s)
(req_ip) == htonl((127<<24)|1))
static void
-check_n_attach_prefetch_transform(HttpSM * sm, HTTPHdr * resp, bool from_cache)
+check_n_attach_prefetch_transform(HttpSM *sm, HTTPHdr *resp, bool from_cache)
{
INKVConnInternal *prefetch_trans;
@@ -643,10 +644,10 @@ check_n_attach_prefetch_transform(HttpSM
TSPrefetchInfo info;
HTTPHdr *req = &sm->t_state.hdr_info.client_request;
- info.request_buf = req;
- info.request_loc = req->m_http;
- info.response_buf = resp;
- info.response_loc = resp->m_http;
+ info.request_buf = reinterpret_cast<TSMBuffer>(req);
+ info.request_loc = reinterpret_cast<TSMLoc>(req->m_http);
+ info.response_buf = reinterpret_cast<TSMBuffer>(resp);
+ info.response_loc = reinterpret_cast<TSMLoc>(resp->m_http);
info.client_ip = client_ip;
info.embedded_url = 0;
@@ -667,7 +668,7 @@ check_n_attach_prefetch_transform(HttpSM
if (prefetch_trans) {
Debug("PrefetchParser", "Adding Prefetch Parser 0x%p\n", prefetch_trans);
- TSHttpTxnHookAdd(sm, TS_HTTP_RESPONSE_TRANSFORM_HOOK, prefetch_trans);
+ TSHttpTxnHookAdd(reinterpret_cast<TSHttpTxn>(sm), TS_HTTP_RESPONSE_TRANSFORM_HOOK, reinterpret_cast<TSCont>(prefetch_trans));
DUMP_HEADER("PrefetchParserHdrs", &sm->t_state.hdr_info.client_request, (int64_t)0,
"Request Header given for Prefetch Parser");
@@ -715,7 +716,7 @@ PrefetchPlugin(TSCont contp, TSEvent eve
if (resp && resp->valid())
check_n_attach_prefetch_transform(sm, resp, from_cache);
- TSHttpTxnReenable(sm, TS_EVENT_HTTP_CONTINUE);
+ TSHttpTxnReenable(reinterpret_cast<TSHttpTxn>(sm), TS_EVENT_HTTP_CONTINUE);
//Debug("PrefetchPlugin", "Returning after check_n_attach_prefetch_transform()\n");
@@ -835,7 +836,7 @@ PrefetchUrlBlaster::free()
}
void
-PrefetchUrlBlaster::writeBuffer(MIOBuffer * buf)
+PrefetchUrlBlaster::writeBuffer(MIOBuffer *buf)
{
//reverse the list:
PrefetchUrlEntry *entry = NULL;
@@ -917,7 +918,7 @@ PrefetchUrlBlaster::udpUrlBlaster(int ev
ClassAllocator<PrefetchBlaster> prefetchBlasterAllocator("PrefetchBlasterAllocator");
int
-PrefetchBlaster::init(PrefetchUrlEntry * entry, HTTPHdr * req_hdr, PrefetchTransform * p_trans)
+PrefetchBlaster::init(PrefetchUrlEntry *entry, HTTPHdr *req_hdr, PrefetchTransform *p_trans)
{
mutex = new_ProxyMutex();
@@ -1053,7 +1054,7 @@ PrefetchBlaster::free()
}
bool
-isCookieUnique(HTTPHdr * req, const char *move_cookie, int move_cookie_len)
+isCookieUnique(HTTPHdr *req, const char *move_cookie, int move_cookie_len)
{
// another double for loop for multiple Cookie headers
MIMEField *o_cookie = req->field_find(MIME_FIELD_COOKIE, MIME_LEN_COOKIE);
@@ -1115,8 +1116,8 @@ cookie_debug(const char *level, const ch
// resp_hdr is the server response for the top page
void
-PrefetchBlaster::handleCookieHeaders(HTTPHdr * req_hdr,
- HTTPHdr * resp_hdr,
+PrefetchBlaster::handleCookieHeaders(HTTPHdr *req_hdr,
+ HTTPHdr *resp_hdr,
const char *domain_start,
const char *domain_end, const char *thost_start, int thost_len, bool no_dot)
{
@@ -1463,7 +1464,7 @@ PrefetchBlaster::handleEvent(int event,
}
static int
-copy_header(MIOBuffer * buf, HTTPHdr * hdr, const char *hdr_tail)
+copy_header(MIOBuffer *buf, HTTPHdr *hdr, const char *hdr_tail)
{
//copy the http header into to the buffer
int64_t done = 0;
@@ -1715,8 +1716,8 @@ PrefetchBlaster::invokeBlaster()
TSPrefetchInfo info;
- info.request_buf = request;
- info.request_loc = request->m_http;
+ info.request_buf = reinterpret_cast<TSMBuffer>(request);
+ info.request_loc = reinterpret_cast<TSMLoc>(request->m_http);
info.response_buf = 0;
info.response_loc = 0;
@@ -1973,7 +1974,7 @@ KeepAliveConnTable::ip_hash(unsigned int
}
inline int
-KeepAliveConn::append(IOBufferReader * rdr)
+KeepAliveConn::append(IOBufferReader *rdr)
{
int64_t size = rdr->read_avail();
@@ -2011,7 +2012,7 @@ KeepAliveConnTable::free()
ClassAllocator<KeepAliveLockHandler> prefetchLockHandlerAllocator("prefetchLockHandlerAllocator");
int
-KeepAliveConnTable::append(unsigned int ip, MIOBuffer * buf, IOBufferReader * reader)
+KeepAliveConnTable::append(unsigned int ip, MIOBuffer *buf, IOBufferReader *reader)
{
int index = ip_hash(ip);
@@ -2046,7 +2047,7 @@ KeepAliveConnTable::append(unsigned int
}
int
-KeepAliveConn::init(unsigned int xip, MIOBuffer * xbuf, IOBufferReader * xreader)
+KeepAliveConn::init(unsigned int xip, MIOBuffer *xbuf, IOBufferReader *xreader)
{
mutex = g_conn_table->arr[KeepAliveConnTable::ip_hash(xip)].mutex;
Modified: trafficserver/traffic/trunk/proxy/Transform.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/Transform.cc?rev=1078680&r1=1078679&r2=1078680&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/Transform.cc (original)
+++ trafficserver/traffic/trunk/proxy/Transform.cc Mon Mar 7 04:32:57 2011
@@ -593,7 +593,8 @@ TransformControl::handle_event(int event
-------------------------------------------------------------------------*/
NullTransform::NullTransform(ProxyMutex *_mutex)
- : INKVConnInternal(NULL, _mutex), m_output_buf(NULL), m_output_reader(NULL), m_output_vio(NULL)
+ : INKVConnInternal(NULL, reinterpret_cast<TSMutex>(_mutex)),
+ m_output_buf(NULL), m_output_reader(NULL), m_output_vio(NULL)
{
SET_HANDLER(&NullTransform::handle_event);
@@ -761,7 +762,7 @@ num_chars_for_int(int64_t i)
-------------------------------------------------------------------------*/
RangeTransform::RangeTransform(ProxyMutex *mut, MIMEField *range_field, HTTPInfo *cache_obj, HTTPHdr *transform_resp)
- : INKVConnInternal(NULL, mut),
+ : INKVConnInternal(NULL, reinterpret_cast<TSMutex>(mut)),
m_output_buf(NULL),
m_output_reader(NULL),
m_range_field(range_field),
Modified: trafficserver/traffic/trunk/proxy/api/ts/experimental.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/api/ts/experimental.h?rev=1078680&r1=1078679&r2=1078680&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/api/ts/experimental.h (original)
+++ trafficserver/traffic/trunk/proxy/api/ts/experimental.h Mon Mar 7 04:32:57 2011
@@ -54,8 +54,8 @@ extern "C"
tsapi TSReturnCode TSHttpTxnHookRegisteredFor(TSHttpTxn txnp, TSHttpHookID id, TSEventFunc funcp);
/* IP Lookup */
- typedef void *TSIPLookup;
- typedef void *TSIPLookupState;
+ typedef struct tsapi_iplookup* TSIPLookup;
+ typedef struct tsapi_iplookupstate* TSIPLookupState;
typedef void (*TSIPLookupPrintFunc) (void *data);
tsapi void TSIPLookupPrint(TSIPLookup iplu, TSIPLookupPrintFunc pf);
@@ -236,7 +236,7 @@ extern "C"
/* ===== Matcher Utils ===== */
#define TS_MATCHER_LINE_INVALID 0
- typedef void *TSMatcherLine;
+ typedef struct tsapi_matcheline* TSMatcherLine;
/****************************************************************************
* ??
@@ -389,7 +389,7 @@ extern "C"
typedef void (*TSClusterStatusFunction) (TSNodeHandle_t *node, TSNodeStatus_t s);
/****************************************************************************
- * Subscribe to node up/down status notification. *
+ * Subscribe to node up/down status notification. *
* Return == 0 Success *
* Return != 0 Failure *
* contact: OXY, DY
@@ -404,7 +404,7 @@ extern "C"
tsapi int TSDeleteClusterStatusFunction(TSClusterStatusHandle_t *h);
/****************************************************************************
- * Get the struct in_addr associated with the TSNodeHandle_t. *
+ * Get the struct in_addr associated with the TSNodeHandle_t. *
* Return == 0 Success *
* Return != 0 Failure *
* contact: OXY, DY
@@ -412,7 +412,7 @@ extern "C"
tsapi int TSNodeHandleToIPAddr(TSNodeHandle_t *h, struct in_addr *in);
/****************************************************************************
- * Get the TSNodeHandle_t for the local node. *
+ * Get the TSNodeHandle_t for the local node. *
* contact: OXY, DY
****************************************************************************/
tsapi void TSGetMyNodeHandle(TSNodeHandle_t *h);
@@ -433,8 +433,8 @@ extern "C"
tsapi int TSAddClusterRPCFunction(TSClusterRPCKey_t k, TSClusterRPCFunction RPC_Function, TSClusterRPCHandle_t *h);
/****************************************************************************
- * Delete the key to function association created via *
- * TSAddClusterRPCFunction(). *
+ * Delete the key to function association created via *
+ * TSAddClusterRPCFunction(). *
* Return == 0 Success *
* Return != 0 Failure *
* contact: OXY, DY
@@ -456,7 +456,7 @@ extern "C"
tsapi TSClusterRPCMsg_t *TSAllocClusterRPCMsg(TSClusterRPCHandle_t *h, int data_size);
/****************************************************************************
- * Send the RPC message to the specified node. *
+ * Send the RPC message to the specified node. *
* Cluster frees the given memory on send. *
* RPC function frees memory on receive. *
* Return == 0 Success *
Modified: trafficserver/traffic/trunk/proxy/api/ts/ts.h.in
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/api/ts/ts.h.in?rev=1078680&r1=1078679&r2=1078680&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/api/ts/ts.h.in (original)
+++ trafficserver/traffic/trunk/proxy/api/ts/ts.h.in Mon Mar 7 04:32:57 2011
@@ -569,31 +569,32 @@ extern "C"
typedef float TSMgmtFloat;
typedef char* TSMgmtString;
- typedef void* TSFile;
+ typedef struct tsapi_file* TSFile;
- typedef void* TSMLoc;
- typedef void* TSMBuffer;
- typedef void* TSHttpSsn;
- typedef void* TSHttpTxn;
- typedef void* TSHttpAltInfo;
- typedef void* TSMimeParser;
- typedef void* TSHttpParser;
- typedef void* TSCacheKey;
- typedef void* TSCacheHttpInfo;
- typedef void* TSCacheTxn;
-
- typedef void* TSVIO;
- typedef void* TSThread;
- typedef void* TSMutex;
- typedef void* TSConfig;
- typedef void* TSCont;
- typedef void* TSAction;
- typedef void* TSVConn;
- typedef void* TSIOBuffer;
- typedef void* TSIOBufferData;
- typedef void* TSIOBufferBlock;
- typedef void* TSIOBufferReader;
- typedef void* TSHostLookupResult;
+ typedef struct tsapi_mloc* TSMLoc;
+ typedef struct tsapi_mbuffer* TSMBuffer;
+ typedef struct tsapi_httpssn* TSHttpSsn;
+ typedef struct tsapi_httptxn* TSHttpTxn;
+ typedef struct tsapi_httpaltinfo* TSHttpAltInfo;
+ typedef struct tsapi_mimeparser* TSMimeParser;
+ typedef struct tsapi_httpparser* TSHttpParser;
+ typedef struct tsapi_cachekey* TSCacheKey;
+ typedef struct tsapi_cachehttpinfo* TSCacheHttpInfo;
+ typedef struct tsapi_cachetxn* TSCacheTxn;
+
+ typedef struct tsapi_vio* TSVIO;
+ typedef struct tsapi_thread* TSThread;
+ typedef struct tsapi_mutex* TSMutex;
+ typedef struct tsapi_config* TSConfig;
+ typedef struct tsapi_cont* TSCont;
+ typedef struct tsapi_cont* TSVConn; /* a VConn is really a specialized TSCont */
+ typedef struct tsapi_action* TSAction;
+ typedef struct tsapi_iobuffer* TSIOBuffer;
+ typedef struct tsapi_iobufferdata* TSIOBufferData;
+ typedef struct tsapi_bufferblock* TSIOBufferBlock;
+ typedef struct tsapi_bufferreader* TSIOBufferReader;
+ typedef struct tsapi_hostlookupresult* TSHostLookupResult;
+ typedef struct tsapi_aiocallback* TSAIOCallback;
typedef void *(*TSThreadFunc) (void* data);
typedef int (*TSEventFunc) (TSCont contp, TSEvent event, void* edata);
@@ -2010,13 +2011,6 @@ extern "C"
tsapi TSReturnCode TSCacheUrlSet(TSHttpTxn txnp, const char* url, int length);
/* --------------------------------------------------------------------------
- cache plugin */
- tsapi TSReturnCode TSCacheKeyGet(TSCacheTxn txnp, void** key, int* length);
- tsapi TSReturnCode TSCacheHeaderKeyGet(TSCacheTxn txnp, void** key, int* length);
- tsapi TSIOBufferReader TSCacheBufferReaderGet(TSCacheTxn txnp);
- tsapi TSHttpTxn TSCacheGetStateMachine(TSCacheTxn txnp);
-
- /* --------------------------------------------------------------------------
Configuration */
tsapi unsigned int TSConfigSet(unsigned int id, void* data, TSConfigDestroyFunc funcp);
tsapi TSConfig TSConfigGet(unsigned int id);
@@ -2650,7 +2644,7 @@ extern "C"
log file using TSTextLogObjectWrite().
*/
- typedef void* TSTextLogObject;
+ typedef struct tsapi_textlogobject* TSTextLogObject;
typedef void (*TSRecordDumpCb) (TSRecordType rec_type, void* edata, int registered, const char* name, TSRecordDataType data_type, TSRecordData* datum);
@@ -2782,14 +2776,14 @@ extern "C"
@return char* to the buffer
*/
- tsapi char* TSAIOBufGet(void* data);
+ tsapi char* TSAIOBufGet(TSAIOCallback data);
/**
Async disk IO get number of bytes
@return the number of bytes
*/
- tsapi int TSAIONBytesGet(void* data);
+ tsapi int TSAIONBytesGet(TSAIOCallback data);
/**
Async disk IO write
Modified: trafficserver/traffic/trunk/proxy/hdrs/HTTP.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/hdrs/HTTP.h?rev=1078680&r1=1078679&r2=1078680&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/hdrs/HTTP.h (original)
+++ trafficserver/traffic/trunk/proxy/hdrs/HTTP.h Mon Mar 7 04:32:57 2011
@@ -282,12 +282,12 @@ struct HTTPHdrImpl:public HdrHeapObjImpl
MIMEHdrImpl *m_fields_impl;
// Marshaling Functions
- int marshal(MarshalXlate * ptr_xlate, int num_ptr, MarshalXlate * str_xlate, int num_str);
+ int marshal(MarshalXlate *ptr_xlate, int num_ptr, MarshalXlate *str_xlate, int num_str);
void unmarshal(intptr_t offset);
- void move_strings(HdrStrHeap * new_heap);
+ void move_strings(HdrStrHeap *new_heap);
// Sanity Check Functions
- void check_strings(HeapCheck * heaps, int num_heaps);
+ void check_strings(HeapCheck *heaps, int num_heaps);
};
struct HTTPValAccept
@@ -445,45 +445,45 @@ extern int HTTP_LEN_S_MAXAGE;
extern int HTTP_LEN_NEED_REVALIDATE_ONCE;
/* Private */
-void http_hdr_adjust(HTTPHdrImpl * hdrp, int32_t offset, int32_t length, int32_t delta);
+void http_hdr_adjust(HTTPHdrImpl *hdrp, int32_t offset, int32_t length, int32_t delta);
/* Public */
void http_init();
-inkcoreapi HTTPHdrImpl *http_hdr_create(HdrHeap * heap, HTTPType polarity);
-void http_hdr_init(HdrHeap * heap, HTTPHdrImpl * hh, HTTPType polarity);
-HTTPHdrImpl *http_hdr_clone(HTTPHdrImpl * s_hh, HdrHeap * s_heap, HdrHeap * d_heap);
-void http_hdr_copy_onto(HTTPHdrImpl * s_hh, HdrHeap * s_heap, HTTPHdrImpl * d_hh, HdrHeap * d_heap, bool inherit_strs);
+inkcoreapi HTTPHdrImpl *http_hdr_create(HdrHeap *heap, HTTPType polarity);
+void http_hdr_init(HdrHeap *heap, HTTPHdrImpl *hh, HTTPType polarity);
+HTTPHdrImpl *http_hdr_clone(HTTPHdrImpl *s_hh, HdrHeap *s_heap, HdrHeap *d_heap);
+void http_hdr_copy_onto(HTTPHdrImpl *s_hh, HdrHeap *s_heap, HTTPHdrImpl *d_hh, HdrHeap *d_heap, bool inherit_strs);
-inkcoreapi int http_hdr_print(HdrHeap * heap, HTTPHdrImpl * hh, char *buf, int bufsize, int *bufindex, int *dumpoffset);
+inkcoreapi int http_hdr_print(HdrHeap *heap, HTTPHdrImpl *hh, char *buf, int bufsize, int *bufindex, int *dumpoffset);
-void http_hdr_describe(HdrHeapObjImpl * obj, bool recurse = true);
+void http_hdr_describe(HdrHeapObjImpl *obj, bool recurse = true);
-int http_hdr_length_get(HTTPHdrImpl * hh);
+int http_hdr_length_get(HTTPHdrImpl *hh);
// HTTPType http_hdr_type_get (HTTPHdrImpl *hh);
// int32_t http_hdr_version_get (HTTPHdrImpl *hh);
-inkcoreapi void http_hdr_version_set(HTTPHdrImpl * hh, int32_t ver);
+inkcoreapi void http_hdr_version_set(HTTPHdrImpl *hh, int32_t ver);
-const char *http_hdr_method_get(HTTPHdrImpl * hh, int *length);
-inkcoreapi void http_hdr_method_set(HdrHeap * heap, HTTPHdrImpl * hh,
+const char *http_hdr_method_get(HTTPHdrImpl *hh, int *length);
+inkcoreapi void http_hdr_method_set(HdrHeap *heap, HTTPHdrImpl *hh,
const char *method, int16_t method_wks_idx, int method_length, bool must_copy);
-void http_hdr_url_set(HdrHeap * heap, HTTPHdrImpl * hh, URLImpl * url);
+void http_hdr_url_set(HdrHeap *heap, HTTPHdrImpl *hh, URLImpl *url);
// HTTPStatus http_hdr_status_get (HTTPHdrImpl *hh);
-void http_hdr_status_set(HTTPHdrImpl * hh, HTTPStatus status);
-const char *http_hdr_reason_get(HTTPHdrImpl * hh, int *length);
-void http_hdr_reason_set(HdrHeap * heap, HTTPHdrImpl * hh, const char *value, int length, bool must_copy);
+void http_hdr_status_set(HTTPHdrImpl *hh, HTTPStatus status);
+const char *http_hdr_reason_get(HTTPHdrImpl *hh, int *length);
+void http_hdr_reason_set(HdrHeap *heap, HTTPHdrImpl *hh, const char *value, int length, bool must_copy);
const char *http_hdr_reason_lookup(HTTPStatus status);
-void http_parser_init(HTTPParser * parser);
-void http_parser_clear(HTTPParser * parser);
-MIMEParseResult http_parser_parse_req(HTTPParser * parser, HdrHeap * heap,
- HTTPHdrImpl * hh, const char **start,
+void http_parser_init(HTTPParser *parser);
+void http_parser_clear(HTTPParser *parser);
+MIMEParseResult http_parser_parse_req(HTTPParser *parser, HdrHeap *heap,
+ HTTPHdrImpl *hh, const char **start,
const char *end, bool must_copy_strings, bool eof);
-MIMEParseResult http_parser_parse_resp(HTTPParser * parser, HdrHeap * heap,
- HTTPHdrImpl * hh, const char **start,
+MIMEParseResult http_parser_parse_resp(HTTPParser *parser, HdrHeap *heap,
+ HTTPHdrImpl *hh, const char **start,
const char *end, bool must_copy_strings, bool eof);
HTTPStatus http_parse_status(const char *start, const char *end);
int32_t http_parse_version(const char *start, const char *end);
@@ -498,7 +498,7 @@ HTTPValCacheControl* http_parse_cache_
const char* http_parse_cache_directive (const char **buf);
HTTPValRange* http_parse_range (const char *buf, Arena *arena);
*/
-HTTPValTE *http_parse_te(const char *buf, int len, Arena * arena);
+HTTPValTE *http_parse_te(const char *buf, int len, Arena *arena);
class HTTPVersion
@@ -528,7 +528,7 @@ class IOBufferReader;
class HTTPHdr: public MIMEHdr
{
public:
- HTTPHdrImpl * m_http;
+ HTTPHdrImpl *m_http;
// This is all cached data and so is mutable.
mutable URL m_url_cached;
mutable int m_host_length; ///< Length of hostname.
@@ -547,13 +547,13 @@ public:
int valid() const;
- void create(HTTPType polarity, HdrHeap * heap = NULL);
+ void create(HTTPType polarity, HdrHeap *heap = NULL);
void clear();
void reset();
- void copy(const HTTPHdr * hdr);
- void copy_shallow(const HTTPHdr * hdr);
+ void copy(const HTTPHdr *hdr);
+ void copy_shallow(const HTTPHdr *hdr);
- int unmarshal(char *buf, int len, RefCountObj * block_ref);
+ int unmarshal(char *buf, int len, RefCountObj *block_ref);
int print(char *buf, int bufsize, int *bufindex, int *dumpoffset);
@@ -568,10 +568,10 @@ public:
int method_get_wksidx();
void method_set(const char *value, int length);
- URL *url_create(URL * url);
+ URL *url_create(URL *url);
URL *url_get() const;
- URL *url_get(URL * url);
+ URL *url_get(URL *url);
/** Get a string with the effective URL in it.
If @a length is not @c NULL then the length of the string
is stored in the int pointed to by @a length.
@@ -585,8 +585,8 @@ public:
int* length = 0 ///< Store string length here.
);
- void url_set(URL * url);
- void url_set_as_server_url(URL * url);
+ void url_set(URL *url);
+ void url_set_as_server_url(URL *url);
void url_set(const char *str, int length);
/** Get the target host name.
@@ -630,11 +630,11 @@ public:
const char *reason_get(int *length);
void reason_set(const char *value, int length);
- MIMEParseResult parse_req(HTTPParser * parser, const char **start, const char *end, bool eof);
- MIMEParseResult parse_resp(HTTPParser * parser, const char **start, const char *end, bool eof);
+ MIMEParseResult parse_req(HTTPParser *parser, const char **start, const char *end, bool eof);
+ MIMEParseResult parse_resp(HTTPParser *parser, const char **start, const char *end, bool eof);
- MIMEParseResult parse_req(HTTPParser * parser, IOBufferReader * r, int *bytes_used, bool eof);
- MIMEParseResult parse_resp(HTTPParser * parser, IOBufferReader * r, int *bytes_used, bool eof);
+ MIMEParseResult parse_req(HTTPParser *parser, IOBufferReader *r, int *bytes_used, bool eof);
+ MIMEParseResult parse_resp(HTTPParser *parser, IOBufferReader *r, int *bytes_used, bool eof);
public:
// Utility routines
@@ -798,7 +798,7 @@ HTTPHdr::valid() const
-------------------------------------------------------------------------*/
inline void
-HTTPHdr::create(HTTPType polarity, HdrHeap * heap)
+HTTPHdr::create(HTTPType polarity, HdrHeap *heap)
{
if (heap) {
m_heap = heap;
@@ -835,7 +835,7 @@ HTTPHdr::reset()
-------------------------------------------------------------------------*/
inline void
-HTTPHdr::copy(const HTTPHdr * hdr)
+HTTPHdr::copy(const HTTPHdr *hdr)
{
ink_debug_assert(hdr->valid());
@@ -852,7 +852,7 @@ HTTPHdr::copy(const HTTPHdr * hdr)
-------------------------------------------------------------------------*/
inline void
-HTTPHdr::copy_shallow(const HTTPHdr * hdr)
+HTTPHdr::copy_shallow(const HTTPHdr *hdr)
{
ink_debug_assert(hdr->valid());
@@ -945,7 +945,7 @@ HTTPHdr::mark_target_dirty() const
-------------------------------------------------------------------------*/
inline HTTPType
-http_hdr_type_get(HTTPHdrImpl * hh)
+http_hdr_type_get(HTTPHdrImpl *hh)
{
return (hh->m_polarity);
}
@@ -964,7 +964,7 @@ HTTPHdr::type_get() const
-------------------------------------------------------------------------*/
inline int32_t
-http_hdr_version_get(HTTPHdrImpl * hh)
+http_hdr_version_get(HTTPHdrImpl *hh)
{
return (hh->m_version);
}
@@ -1029,7 +1029,7 @@ HTTPHdr::method_set(const char *value, i
-------------------------------------------------------------------------*/
inline URL *
-HTTPHdr::url_create(URL * u)
+HTTPHdr::url_create(URL *u)
{
ink_debug_assert(valid());
ink_debug_assert(m_http->m_polarity == HTTP_TYPE_REQUEST);
@@ -1065,7 +1065,7 @@ HTTPHdr::url_get() const
-------------------------------------------------------------------------*/
inline URL *
-HTTPHdr::url_get(URL * url)
+HTTPHdr::url_get(URL *url)
{
ink_debug_assert(valid());
ink_debug_assert(m_http->m_polarity == HTTP_TYPE_REQUEST);
@@ -1079,7 +1079,7 @@ HTTPHdr::url_get(URL * url)
-------------------------------------------------------------------------*/
inline void
-HTTPHdr::url_set(URL * url)
+HTTPHdr::url_set(URL *url)
{
ink_debug_assert(valid());
ink_debug_assert(m_http->m_polarity == HTTP_TYPE_REQUEST);
@@ -1092,7 +1092,7 @@ HTTPHdr::url_set(URL * url)
-------------------------------------------------------------------------*/
inline void
-HTTPHdr::url_set_as_server_url(URL * url)
+HTTPHdr::url_set_as_server_url(URL *url)
{
ink_debug_assert(valid());
ink_debug_assert(m_http->m_polarity == HTTP_TYPE_REQUEST);
@@ -1121,7 +1121,7 @@ HTTPHdr::url_set(const char *str, int le
-------------------------------------------------------------------------*/
inline HTTPStatus
-http_hdr_status_get(HTTPHdrImpl * hh)
+http_hdr_status_get(HTTPHdrImpl *hh)
{
ink_debug_assert(hh->m_polarity == HTTP_TYPE_RESPONSE);
return (HTTPStatus) hh->u.resp.m_status;
@@ -1179,7 +1179,7 @@ HTTPHdr::reason_set(const char *value, i
-------------------------------------------------------------------------*/
inline MIMEParseResult
-HTTPHdr::parse_req(HTTPParser * parser, const char **start, const char *end, bool eof)
+HTTPHdr::parse_req(HTTPParser *parser, const char **start, const char *end, bool eof)
{
ink_debug_assert(valid());
ink_debug_assert(m_http->m_polarity == HTTP_TYPE_REQUEST);
@@ -1191,7 +1191,7 @@ HTTPHdr::parse_req(HTTPParser * parser,
-------------------------------------------------------------------------*/
inline MIMEParseResult
-HTTPHdr::parse_resp(HTTPParser * parser, const char **start, const char *end, bool eof)
+HTTPHdr::parse_resp(HTTPParser *parser, const char **start, const char *end, bool eof)
{
ink_debug_assert(valid());
ink_debug_assert(m_http->m_polarity == HTTP_TYPE_RESPONSE);
@@ -1242,7 +1242,7 @@ enum
struct HTTPCacheAlt
{
HTTPCacheAlt();
- void copy(HTTPCacheAlt * to_copy);
+ void copy(HTTPCacheAlt *to_copy);
void destroy();
uint32_t m_magic;
@@ -1280,93 +1280,63 @@ struct HTTPCacheAlt
class HTTPInfo
{
public:
- HTTPCacheAlt * m_alt;
+ HTTPCacheAlt *m_alt;
- HTTPInfo();
- ~HTTPInfo();
+ HTTPInfo()
+ : m_alt(NULL)
+ { }
+
+ ~HTTPInfo()
+ {
+ clear();
+ }
+
+ void clear() { m_alt = NULL; }
+ bool valid() const { return (m_alt != NULL); }
void create();
- void clear();
void destroy();
- bool valid();
- void copy(HTTPInfo * to_copy);
- void copy_shallow(HTTPInfo * info);
- HTTPInfo & operator =(const HTTPInfo & m);
+ void copy(HTTPInfo *to_copy);
+ void copy_shallow(HTTPInfo *info) { m_alt = info->m_alt; }
+ HTTPInfo & operator =(const HTTPInfo & m);
inkcoreapi int marshal_length();
inkcoreapi int marshal(char *buf, int len);
- static int unmarshal(char *buf, int len, RefCountObj * block_ref);
- void set_buffer_reference(RefCountObj * block_ref);
+ static int unmarshal(char *buf, int len, RefCountObj *block_ref);
+ void set_buffer_reference(RefCountObj *block_ref);
int get_handle(char *buf, int len);
- int32_t id_get()
- {
- return m_alt->m_id;
- };
- int32_t rid_get()
- {
- return m_alt->m_rid;
- };
+ int32_t id_get() const { return m_alt->m_id; }
+ int32_t rid_get() { return m_alt->m_rid; }
+
+ void id_set(int32_t id) { m_alt->m_id = id; }
+ void rid_set(int32_t id) { m_alt->m_rid = id; }
+
INK_MD5 object_key_get();
void object_key_get(INK_MD5 *);
bool compare_object_key(const INK_MD5 *);
int64_t object_size_get();
- void request_get(HTTPHdr * hdr)
- {
- hdr->copy_shallow(&m_alt->m_request_hdr);
- };
- void response_get(HTTPHdr * hdr)
- {
- hdr->copy_shallow(&m_alt->m_response_hdr);
- };
- HTTPHdr *request_get()
- {
- return &m_alt->m_request_hdr;
- };
- HTTPHdr *response_get()
- {
- return &m_alt->m_response_hdr;
- };
- URL *request_url_get(URL * url = NULL) {
- return m_alt->m_request_hdr.url_get(url);
- };
- time_t request_sent_time_get()
- {
- return m_alt->m_request_sent_time;
- };
- time_t response_received_time_get()
- {
- return m_alt->m_response_received_time;
- };
+ void request_get(HTTPHdr *hdr) { hdr->copy_shallow(&m_alt->m_request_hdr); }
+ void response_get(HTTPHdr *hdr) { hdr->copy_shallow(&m_alt->m_response_hdr); }
+
+ HTTPHdr *request_get() { return &m_alt->m_request_hdr; }
+ HTTPHdr *response_get() { return &m_alt->m_response_hdr; }
+
+ URL *request_url_get(URL *url = NULL) { return m_alt->m_request_hdr.url_get(url); }
+
+ time_t request_sent_time_get() { return m_alt->m_request_sent_time; }
+ time_t response_received_time_get() { return m_alt->m_response_received_time; }
- void id_set(int32_t id)
- {
- m_alt->m_id = id;
- };
- void rid_set(int32_t id)
- {
- m_alt->m_rid = id;
- };
void object_key_set(INK_MD5 & md5);
void object_size_set(int64_t size);
- void request_set(const HTTPHdr * req)
- {
- m_alt->m_request_hdr.copy(req);
- };
- void response_set(const HTTPHdr * resp)
- {
- m_alt->m_response_hdr.copy(resp);
- };
- void request_sent_time_set(time_t t)
- {
- m_alt->m_request_sent_time = t;
- };
- void response_received_time_set(time_t t)
- {
- m_alt->m_response_received_time = t;
- };
+
+ void request_set(const HTTPHdr *req) { m_alt->m_request_hdr.copy(req); }
+ void response_set(const HTTPHdr *resp) { m_alt->m_response_hdr.copy(resp); }
+
+ void request_sent_time_set(time_t t) { m_alt->m_request_sent_time = t; }
+ void response_received_time_set(time_t t) { m_alt->m_response_received_time = t; }
// Sanity check functions
static bool check_marshalled(char *buf, int len);
@@ -1375,25 +1345,6 @@ private:
HTTPInfo(const HTTPInfo & h);
};
-inline
-HTTPInfo::HTTPInfo():
-m_alt(NULL)
-{
-}
-
-inline
-HTTPInfo::~
-HTTPInfo()
-{
- clear();
-}
-
-inline void
-HTTPInfo::clear()
-{
- m_alt = NULL;
-}
-
inline void
HTTPInfo::destroy()
{
@@ -1409,18 +1360,6 @@ HTTPInfo::destroy()
clear();
}
-inline bool
-HTTPInfo::valid()
-{
- return (m_alt != NULL);
-}
-
-inline void
-HTTPInfo::copy_shallow(HTTPInfo * hi)
-{
- m_alt = hi->m_alt;
-}
-
inline HTTPInfo &
HTTPInfo::operator =(const HTTPInfo & m)
{
@@ -1442,7 +1381,7 @@ HTTPInfo::object_key_get()
}
inline void
-HTTPInfo::object_key_get(INK_MD5 * md5)
+HTTPInfo::object_key_get(INK_MD5 *md5)
{
((int32_t *) md5)[0] = m_alt->m_object_key[0];
((int32_t *) md5)[1] = m_alt->m_object_key[1];
@@ -1451,7 +1390,7 @@ HTTPInfo::object_key_get(INK_MD5 * md5)
}
inline bool
-HTTPInfo::compare_object_key(const INK_MD5 * md5)
+HTTPInfo::compare_object_key(const INK_MD5 *md5)
{
return ((m_alt->m_object_key[0] == ((int32_t *) md5)[0]) &&
(m_alt->m_object_key[1] == ((int32_t *) md5)[1]) &&
Modified: trafficserver/traffic/trunk/proxy/http/HttpSM.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http/HttpSM.h?rev=1078680&r1=1078679&r2=1078680&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http/HttpSM.h (original)
+++ trafficserver/traffic/trunk/proxy/http/HttpSM.h Mon Mar 7 04:32:57 2011
@@ -185,7 +185,7 @@ enum HttpPluginTunnel_t
class CoreUtils;
class PluginVCCore;
-class HttpSM:public Continuation
+class HttpSM: public Continuation
{
friend class HttpPagesHandler;
friend class CoreUtils;
Modified: trafficserver/traffic/trunk/tools/apichecker.pl
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/tools/apichecker.pl?rev=1078680&r1=1078679&r2=1078680&view=diff
==============================================================================
--- trafficserver/traffic/trunk/tools/apichecker.pl (original)
+++ trafficserver/traffic/trunk/tools/apichecker.pl Mon Mar 7 04:32:57 2011
@@ -89,6 +89,7 @@ my $W_CHAR_NOT_NULL = "returns the char*
my $W_TIME_T = "returns the time_t directly";
my $W_NOT_NULL_LEN = "the length parameter can no longer be a NULL pointer";
my $W_TSCACHEKEY = "returns a TSCacheKey directly";
+my $W_TSAIOCALLBACK = "uses the new TSAIOCallback data type";
my $W_NO_NULL_LENGTH = "1";
my $W_NO_ERROR_PTR = "2";
@@ -222,11 +223,11 @@ my %TWO_2_THREE = (
"TSMimeHdrFieldNameGet" => [$W_NO_NULL_LENGTH],
"TSHttpHdrMethodGet" => [$W_NO_NULL_LENGTH],
"TSHttpHdrReasonGet" => [$W_NO_NULL_LENGTH],
- "TSCacheKeyGet" => [$W_NO_NULL_LENGTH],
- "TSCacheHeaderKeyGet" => [$W_NO_NULL_LENGTH],
"TSFetchRespGet" => [$W_NO_NULL_LENGTH],
"TSHttpTxnConfigStringGet" => [$W_NO_NULL_LENGTH],
"TS_ERROR_PTR" => [$W_NO_ERROR_PTR]
+ "TSAIOBufGet" => [$W_TSAIOCALLBACK],
+ "TSAIONBytesGet" => [$W_TSAIOCALLBACK],
);