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 2012/02/22 17:16:11 UTC
[7/8] TS-995 changes.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/proxy/ICP.cc
----------------------------------------------------------------------
diff --git a/proxy/ICP.cc b/proxy/ICP.cc
index 56e35c5..4a92ed6 100644
--- a/proxy/ICP.cc
+++ b/proxy/ICP.cc
@@ -405,7 +405,7 @@ ICPPeerReadCont::StaleCheck(int event, Event * e)
Debug("icp-stale", "Stale check res=%d for id=%d, [%s] from [%s]",
event, _state->_rICPmsg->h.requestno,
- _state->_rICPmsg->un.query.URL, ink_inet_nptop(&_state->_sender, ipb, sizeof(ipb)));
+ _state->_rICPmsg->un.query.URL, ats_ip_nptop(&_state->_sender, ipb, sizeof(ipb)));
switch (event) {
case ICP_STALE_OBJECT:
@@ -438,7 +438,7 @@ ICPPeerReadCont::ICPPeerQueryEvent(int event, Event * e)
NOWARN_UNUSED(e);
Debug("icp", "Remote Query lookup res=%d for id=%d, [%s] from [%s]",
event, _state->_rICPmsg->h.requestno,
- _state->_rICPmsg->un.query.URL, ink_inet_nptop(&_state->_sender, ipb, sizeof(ipb)));
+ _state->_rICPmsg->un.query.URL, ats_ip_nptop(&_state->_sender, ipb, sizeof(ipb)));
if (pluginFreshnessCalcFunc) {
switch (event) {
case CACHE_EVENT_OPEN_READ:
@@ -482,7 +482,7 @@ ICPPeerReadCont::ICPPeerQueryCont(int event, Event * e)
Debug("icp", "Remote Query for id=%d, [%s] from [%s]",
_state->_rICPmsg->h.requestno,
_state->_rICPmsg->un.query.URL,
- ink_inet_nptop(&_state->_sender, ipb, sizeof(ipb))
+ ats_ip_nptop(&_state->_sender, ipb, sizeof(ipb))
);
SET_HANDLER((ICPPeerReadContHandler) & ICPPeerReadCont::ICPPeerQueryEvent);
@@ -693,7 +693,7 @@ ICPPeerReadCont::PeerReadStateMachine(PeerReadData * s, Event * e)
}
// Validate receiver and convert the received sockaddr
// to internal sockaddr format.
- ts_ip_endpoint from;
+ IpEndpoint from;
if (!s->_peer->ExtToIntRecvSockAddr(&s->_peer->fromaddr.sa, &from.sa)) {
int status;
ICPConfigData *cfg = _ICPpr->GetConfig()->globalConfig();
@@ -722,11 +722,11 @@ ICPPeerReadCont::PeerReadStateMachine(PeerReadData * s, Event * e)
int icp_reply_port = cfg->ICPDefaultReplyPort();
if (!icp_reply_port) {
- icp_reply_port = ntohs(ink_inet_port_cast(&s->_peer->fromaddr));
+ icp_reply_port = ntohs(ats_ip_port_cast(&s->_peer->fromaddr));
}
PeerConfigData *Pcfg = NEW(new PeerConfigData(
PeerConfigData::CTYPE_SIBLING,
- InkInetAddr(s->_peer->fromaddr),
+ IpAddr(s->_peer->fromaddr),
0,
icp_reply_port
));
@@ -739,7 +739,7 @@ ICPPeerReadCont::PeerReadStateMachine(PeerReadData * s, Event * e)
P->GetChan()->setRemote(P->GetIP());
// coverity[uninit_use_in_call]
- Note("ICP Peer added ip=%s", ink_inet_nptop(P->GetIP(), ipb, sizeof(ipb)));
+ Note("ICP Peer added ip=%s", ats_ip_nptop(P->GetIP(), ipb, sizeof(ipb)));
from = s->_peer->fromaddr;
} else {
invalid_message:
@@ -748,7 +748,7 @@ ICPPeerReadCont::PeerReadStateMachine(PeerReadData * s, Event * e)
//
ICP_INCREMENT_DYN_STAT(invalid_sender_stat);
Debug("icp", "Received msg from invalid sender [%s]",
- ink_inet_nptop(&s->_peer->fromaddr, ipb, sizeof(ipb)));
+ ats_ip_nptop(&s->_peer->fromaddr, ipb, sizeof(ipb)));
s->_peer->buf = NULL;
s->_next_state = READ_NOT_ACTIVE;
@@ -771,7 +771,7 @@ ICPPeerReadCont::PeerReadStateMachine(PeerReadData * s, Event * e)
&& (s->_rICPmsg->h.version != ICP_VERSION_3)) {
ICP_INCREMENT_DYN_STAT(read_not_v2_icp_stat);
Debug("icp", "Received (v=%d) !v2 && !v3 msg from sender [%s]",
- (uint32_t) s->_rICPmsg->h.version, ink_inet_nptop(&from, ipb, sizeof(ipb)));
+ (uint32_t) s->_rICPmsg->h.version, ats_ip_nptop(&from, ipb, sizeof(ipb)));
s->_rICPmsg = NULL;
s->_buf = NULL;
@@ -797,7 +797,7 @@ ICPPeerReadCont::PeerReadStateMachine(PeerReadData * s, Event * e)
} else {
// We have a response message for an ICP query.
Debug("icp", "Response for Id=%d, from [%s]",
- s->_rICPmsg->h.requestno, ink_inet_nptop(&s->_sender, ipb, sizeof(ipb)));
+ s->_rICPmsg->h.requestno, ats_ip_nptop(&s->_sender, ipb, sizeof(ipb)));
ICP_INCREMENT_DYN_STAT(icp_remote_responses_stat);
s->_next_state = GET_ICP_REQUEST;
RECORD_ICP_STATE_CHANGE(s, 0, GET_ICP_REQUEST);
@@ -818,7 +818,7 @@ ICPPeerReadCont::PeerReadStateMachine(PeerReadData * s, Event * e)
if (s->_queryResult == CACHE_EVENT_LOOKUP) {
// Use the received ICP data buffer for the response message
Debug("icp", "Sending ICP_OP_HIT for id=%d, [%.*s] to [%s]",
- s->_rICPmsg->h.requestno, datalen, (const char *)data, ink_inet_nptop(&s->_sender, ipb, sizeof(ipb)));
+ s->_rICPmsg->h.requestno, datalen, (const char *)data, ats_ip_nptop(&s->_sender, ipb, sizeof(ipb)));
ICP_INCREMENT_DYN_STAT(icp_cache_lookup_success_stat);
status = ICPRequestCont::BuildICPMsg(ICP_OP_HIT,
s->_rICPmsg->h.requestno, 0 /* optflags */ , 0 /* optdata */ ,
@@ -827,7 +827,7 @@ ICPPeerReadCont::PeerReadStateMachine(PeerReadData * s, Event * e)
} else if (s->_queryResult == CACHE_EVENT_LOOKUP_FAILED) {
// Use the received ICP data buffer for response message
Debug("icp", "Sending ICP_OP_MISS for id=%d, [%.*s] to [%s]",
- s->_rICPmsg->h.requestno, datalen, (const char *)data, ink_inet_nptop(&s->_sender, ipb, sizeof(ipb)));
+ s->_rICPmsg->h.requestno, datalen, (const char *)data, ats_ip_nptop(&s->_sender, ipb, sizeof(ipb)));
ICP_INCREMENT_DYN_STAT(icp_cache_lookup_fail_stat);
status = ICPRequestCont::BuildICPMsg(ICP_OP_MISS,
s->_rICPmsg->h.requestno, 0 /* optflags */ , 0 /* optdata */ ,
@@ -882,7 +882,7 @@ ICPPeerReadCont::PeerReadStateMachine(PeerReadData * s, Event * e)
ICP_INCREMENT_DYN_STAT(query_response_partial_write_stat);
// coverity[uninit_use_in_call]
Debug("icp_warn", "ICP response send, sent=%d res=%d, ip=%s",
- ntohs(s->_rICPmsg->h.msglen), -1, ink_inet_ntop(&s->_sender, ipb, sizeof(ipb)));
+ ntohs(s->_rICPmsg->h.msglen), -1, ats_ip_ntop(&s->_sender, ipb, sizeof(ipb)));
s->_next_state = READ_NOT_ACTIVE;
RECORD_ICP_STATE_CHANGE(s, 0, READ_NOT_ACTIVE);
break;
@@ -909,7 +909,7 @@ ICPPeerReadCont::PeerReadStateMachine(PeerReadData * s, Event * e)
ICP_INCREMENT_DYN_STAT(query_response_partial_write_stat);
// coverity[uninit_use_in_call]
Debug("icp_warn", "ICP response send, sent=%d res=%d, ip=%s",
- ntohs(s->_rICPmsg->h.msglen), len, ink_inet_ntop(&s->_sender, ipb, sizeof(ipb)));
+ ntohs(s->_rICPmsg->h.msglen), len, ats_ip_ntop(&s->_sender, ipb, sizeof(ipb)));
}
// Processing complete, perform completion actions
s->_next_state = READ_NOT_ACTIVE;
@@ -1338,7 +1338,7 @@ ICPRequestCont::ICPStateMachine(int event, void *d)
}
P->LogSendMsg(&_ICPmsg, NULL); // log as send query
Debug("icp", "[ICP_QUEUE_REQUEST] Id=%d send query to [%s]",
- _sequence_number, ink_inet_nptop(P->GetIP(), ipb, sizeof(ipb)));
+ _sequence_number, ats_ip_nptop(P->GetIP(), ipb, sizeof(ipb)));
} else {
_expected_replies_list.ClearBit(P->GetPeerID());
_expected_replies -= was_expected;
@@ -1347,7 +1347,7 @@ ICPRequestCont::ICPStateMachine(int event, void *d)
// coverity[uninit_use_in_call]
Debug("icp_warn",
"ICP query send, res=%d, ip=%s", ntohs(_ICPmsg.h.msglen),
- ink_inet_ntop(P->GetIP(), ipb, sizeof(ipb)));
+ ats_ip_ntop(P->GetIP(), ipb, sizeof(ipb)));
}
SendPeers--;
}
@@ -1511,15 +1511,15 @@ ICPRequestCont::ICPResponseMessage(int event, ICPMsg_t * m, int ICPMsg_len, Peer
pp = _ICPpr->GetNthParentPeer(0, _ICPpr->GetStartingParentPeerBias());
if (pp && !_expected_replies_list.IsBitSet(pp->GetPeerID())
&& pp->isUp()) {
- ink_inet_copy(&_ret_sockaddr.sa, pp->GetIP());
+ ats_ip_copy(&_ret_sockaddr.sa, pp->GetIP());
_ret_sockaddr.port() = htons(static_cast<ParentSiblingPeer*>(pp)->GetProxyPort());
_ret_status = ICP_LOOKUP_FOUND;
Debug("icp",
"ICP timeout using parent Id=%d from [%s] return [%s]",
_sequence_number,
- ink_inet_nptop(pp->GetIP(), ipb, sizeof(ipb)),
- ink_inet_nptop(&_ret_sockaddr, ipb2, sizeof(ipb2))
+ ats_ip_nptop(pp->GetIP(), ipb, sizeof(ipb)),
+ ats_ip_nptop(&_ret_sockaddr, ipb2, sizeof(ipb2))
);
return EVENT_DONE;
}
@@ -1546,15 +1546,15 @@ ICPRequestCont::ICPResponseMessage(int event, ICPMsg_t * m, int ICPMsg_len, Peer
ICP_INCREMENT_DYN_STAT(icp_query_hits_stat);
++_received_replies;
- ink_inet_copy(&_ret_sockaddr, peer->GetIP());
+ ats_ip_copy(&_ret_sockaddr, peer->GetIP());
_ret_sockaddr.port() = htons(static_cast<ParentSiblingPeer*>(peer)->GetProxyPort());
_ret_status = ICP_LOOKUP_FOUND;
Debug("icp",
"ICP Response HIT for Id=%d from [%s] return [%s]",
_sequence_number,
- ink_inet_nptop(peer->GetIP(), ipb, sizeof(ipb)),
- ink_inet_nptop(&_ret_sockaddr, ipb2, sizeof(ipb2))
+ ats_ip_nptop(peer->GetIP(), ipb, sizeof(ipb)),
+ ats_ip_nptop(&_ret_sockaddr, ipb2, sizeof(ipb2))
);
return EVENT_DONE;
}
@@ -1564,7 +1564,7 @@ ICPRequestCont::ICPResponseMessage(int event, ICPMsg_t * m, int ICPMsg_len, Peer
case ICP_OP_DENIED:
{
Debug("icp", "ICP MISS response for Id=%d from [%s]",
- _sequence_number, ink_inet_nptop(peer->GetIP(), ipb, sizeof(ipb)));
+ _sequence_number, ats_ip_nptop(peer->GetIP(), ipb, sizeof(ipb)));
// "received_replies" is only for Peers who we expect a reply
// from (Peers which are in the expected_replies_list).
int Id = peer->GetPeerID();
@@ -1606,17 +1606,17 @@ ICPRequestCont::ICPResponseMessage(int event, ICPMsg_t * m, int ICPMsg_len, Peer
}
}
if (p) {
- ink_inet_copy(&_ret_sockaddr, p->GetIP());
+ ats_ip_copy(&_ret_sockaddr, p->GetIP());
_ret_sockaddr.port() = htons(static_cast<ParentSiblingPeer*>(p)->GetProxyPort());
_ret_status = ICP_LOOKUP_FOUND;
Debug("icp", "ICP ALL MISS(1) for Id=%d return [%s]",
- _sequence_number, ink_inet_nptop(&_ret_sockaddr, ipb, sizeof(ipb)));
+ _sequence_number, ats_ip_nptop(&_ret_sockaddr, ipb, sizeof(ipb)));
return EVENT_DONE;
}
}
Debug("icp", "ICP ALL MISS(2) for Id=%d return [%s]",
- _sequence_number, ink_inet_nptop(&_ret_sockaddr, ipb, sizeof(ipb)));
+ _sequence_number, ats_ip_nptop(&_ret_sockaddr, ipb, sizeof(ipb)));
return EVENT_DONE;
}
default:
@@ -1624,7 +1624,7 @@ ICPRequestCont::ICPResponseMessage(int event, ICPMsg_t * m, int ICPMsg_len, Peer
ICP_INCREMENT_DYN_STAT(invalid_icp_query_response_stat);
// coverity[uninit_use_in_call]
Warning("Invalid ICP response, op=%d reqno=%d ip=%s",
- m->h.opcode, m->h.requestno, ink_inet_ntop(peer->GetIP(), ipb, sizeof(ipb)));
+ m->h.opcode, m->h.requestno, ats_ip_ntop(peer->GetIP(), ipb, sizeof(ipb)));
return EVENT_CONT; // wait for more responses
}
@@ -2030,7 +2030,7 @@ ICPProcessor::BuildPeerList()
Pcfg->_ctype = PeerConfigData::CTYPE_LOCAL;
// Get IP address for given interface
- ts_ip_endpoint tmp_ip;
+ IpEndpoint tmp_ip;
if (!mgmt_getAddrForIntr(GetConfig()->globalConfig()->ICPinterface(), &tmp_ip.sa)) {
Pcfg->_ip_addr._family = AF_UNSPEC;
// No IP address for given interface
@@ -2214,8 +2214,8 @@ ICPProcessor::SetupListenSockets()
// coverity[uninit_use_in_call]
Warning("ICP MC send setup failed, res=%d, ip=%s bind_ip=%s",
status,
- ink_inet_nptop(pMC->GetIP(), ipb, sizeof(ipb)),
- ink_inet_nptop(_LocalPeer->GetIP(), ipb2, sizeof(ipb2))
+ ats_ip_nptop(pMC->GetIP(), ipb, sizeof(ipb)),
+ ats_ip_nptop(_LocalPeer->GetIP(), ipb2, sizeof(ipb2))
);
REC_SignalWarning(REC_SIGNAL_CONFIG_ERROR, "ICP MC send setup failed");
return 1; // Failed
@@ -2226,7 +2226,7 @@ ICPProcessor::SetupListenSockets()
if (status) {
// coverity[uninit_use_in_call]
Warning("ICP MC recv setup failed, res=%d, ip=%s",
- status, ink_inet_nptop(pMC->GetIP(), ipb, sizeof(ipb)));
+ status, ats_ip_nptop(pMC->GetIP(), ipb, sizeof(ipb)));
REC_SignalWarning(REC_SIGNAL_CONFIG_ERROR, "ICP MC recv setup failed");
return 1; // Failed
}
@@ -2406,14 +2406,14 @@ ICPProcessor::CancelPendingReads()
}
Peer *
-ICPProcessor::GenericFindListPeer(InkInetAddr const& ip, uint16_t port, int validListItems, Ptr<Peer> *List)
+ICPProcessor::GenericFindListPeer(IpAddr const& ip, uint16_t port, int validListItems, Ptr<Peer> *List)
{
Peer *P;
port = htons(port);
for (int n = 0; n < validListItems; ++n) {
if ((P = List[n])) {
if ((P->GetIP() == ip)
- && ((port == 0) || (ink_inet_port_cast(P->GetIP()) == port)))
+ && ((port == 0) || (ats_ip_port_cast(P->GetIP()) == port)))
return P;
}
}
@@ -2421,14 +2421,14 @@ ICPProcessor::GenericFindListPeer(InkInetAddr const& ip, uint16_t port, int vali
}
Peer *
-ICPProcessor::FindPeer(InkInetAddr const& ip, uint16_t port)
+ICPProcessor::FindPeer(IpAddr const& ip, uint16_t port)
{
// Find (Peer *) with the given (ip,port) on the global list (PeerList)
return GenericFindListPeer(ip, port, (_nPeerList + 1), _PeerList);
}
Peer *
-ICPProcessor::FindSendListPeer(InkInetAddr const& ip, uint16_t port)
+ICPProcessor::FindSendListPeer(IpAddr const& ip, uint16_t port)
{
// Find (Peer *) with the given (ip,port) on the
// scheduler list (SendPeerList)
@@ -2436,7 +2436,7 @@ ICPProcessor::FindSendListPeer(InkInetAddr const& ip, uint16_t port)
}
Peer *
-ICPProcessor::FindRecvListPeer(InkInetAddr const& ip, uint16_t port)
+ICPProcessor::FindRecvListPeer(IpAddr const& ip, uint16_t port)
{
// Find (Peer *) with the given (ip,port) on the
// receive list (RecvPeerList)
@@ -2456,7 +2456,7 @@ ICPProcessor::AddPeer(Peer * P)
if (FindPeer(P->GetIP())) {
ip_port_text_buffer x;
// coverity[uninit_use_in_call]
- Warning("bad icp.config, multiple peer definitions for ip=%s", ink_inet_nptop(P->GetIP(), x, sizeof(x)));
+ Warning("bad icp.config, multiple peer definitions for ip=%s", ats_ip_nptop(P->GetIP(), x, sizeof(x)));
REC_SignalWarning(REC_SIGNAL_CONFIG_ERROR, "bad icp.config, multiple peer definitions");
return 0; // Not added
@@ -2481,7 +2481,7 @@ ICPProcessor::AddPeerToRecvList(Peer * P)
// Returns 1 - added; 0 - Not added
// Assert that no duplicate exists
- ink_assert(FindRecvListPeer(InkInetAddr(P->GetIP()), ink_inet_get_port(P->GetIP())) == 0);
+ ink_assert(FindRecvListPeer(IpAddr(P->GetIP()), ats_ip_port_host_order(P->GetIP())) == 0);
if (_nRecvPeerList + 1 < RECV_PEER_LIST_SIZE) {
_nRecvPeerList++;
@@ -2500,7 +2500,7 @@ ICPProcessor::AddPeerToSendList(Peer * P)
// Returns 1 - added; 0 - Not added
// Assert that no duplicate exists
- ink_assert(FindSendListPeer(InkInetAddr(P->GetIP()), ink_inet_get_port(P->GetIP())) == 0);
+ ink_assert(FindSendListPeer(IpAddr(P->GetIP()), ats_ip_port_host_order(P->GetIP())) == 0);
if (_nSendPeerList + 1 < SEND_PEER_LIST_SIZE) {
_nSendPeerList++;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/proxy/ICP.h
----------------------------------------------------------------------
diff --git a/proxy/ICP.h b/proxy/ICP.h
index d7ecba0..492dfb7 100644
--- a/proxy/ICP.h
+++ b/proxy/ICP.h
@@ -315,7 +315,7 @@ class PeerConfigData
public:
PeerConfigData();
- PeerConfigData(int ctype, InkInetAddr const& ip_addr, int proxy_port, int icp_port)
+ PeerConfigData(int ctype, IpAddr const& ip_addr, int proxy_port, int icp_port)
: _ctype(ctype), _ip_addr(ip_addr),
_proxy_port(proxy_port), _icp_port(icp_port), _mc_member(0), _mc_ttl(0),
_my_ip_addr(ip_addr)
@@ -334,7 +334,7 @@ public:
{
return _ctype;
}
- inline InkInetAddr const& GetIPAddr()
+ inline IpAddr const& GetIPAddr()
{
return _my_ip_addr;
}
@@ -350,7 +350,7 @@ public:
{
return _mc_member;
}
- inline InkInetAddr const& GetMultiCastIPAddr()
+ inline IpAddr const& GetMultiCastIPAddr()
{
return _mc_ip_addr;
}
@@ -361,7 +361,7 @@ public:
// Static member functions
static PeerType_t CTypeToPeerType_t(int);
- static int GetHostIPByName(char *, InkInetAddr&);
+ static int GetHostIPByName(char *, IpAddr&);
enum
{ HOSTNAME_SIZE = 256 };
@@ -378,20 +378,20 @@ private:
//---------------------------------------------------------
char _hostname[HOSTNAME_SIZE];
int _ctype;
- InkInetAddr _ip_addr;
+ IpAddr _ip_addr;
int _proxy_port;
int _icp_port;
//-------------------
// MultiCast data
//-------------------
int _mc_member;
- InkInetAddr _mc_ip_addr;
+ IpAddr _mc_ip_addr;
int _mc_ttl;
//----------------------------------------------
// Computed data not subject to "==" test
//----------------------------------------------
- InkInetAddr _my_ip_addr;
+ IpAddr _my_ip_addr;
};
//---------------------------------------------------------------
@@ -568,7 +568,7 @@ public:
// these shouldn't be public
// this is for delayed I/O
Ptr<IOBufferBlock> buf;
- ts_ip_endpoint fromaddr;
+ IpEndpoint fromaddr;
socklen_t fromaddrlen;
int notFirstRead; // priming the reads
Action *readAction; // outstanding read
@@ -646,7 +646,7 @@ public:
private:
// Class data declarations
PeerConfigData * _pconfig; // associated config data
- ts_ip_endpoint _ip; ///< Cache for GetIP().
+ IpEndpoint _ip; ///< Cache for GetIP().
Connection _chan;
};
@@ -656,7 +656,7 @@ private:
class MultiCastPeer:public Peer
{
public:
- MultiCastPeer(InkInetAddr const&, uint16_t, int, ICPProcessor *);
+ MultiCastPeer(IpAddr const&, uint16_t, int, ICPProcessor *);
~MultiCastPeer()
{
}
@@ -666,7 +666,7 @@ public:
If @a port is 0 the port is not checked.
*/
Peer *FindMultiCastChild(
- InkInetAddr const& ip, ///< IP address.
+ IpAddr const& ip, ///< IP address.
uint16_t port = 0 ///< Port (host order).
);
@@ -689,10 +689,10 @@ public:
}
inline virtual int ExtToIntRecvSockAddr(sockaddr const* in, sockaddr* out)
{
- Peer *P = FindMultiCastChild(InkInetAddr(in));
+ Peer *P = FindMultiCastChild(IpAddr(in));
if (P) {
- ink_inet_copy(out, in);
- ink_inet_port_cast(out) = ink_inet_port_cast(P->GetIP());
+ ats_ip_copy(out, in);
+ ats_ip_port_cast(out) = ats_ip_port_cast(P->GetIP());
return 1;
} else {
return 0;
@@ -706,7 +706,7 @@ private:
//---------------------------
// Multicast specific data
//---------------------------
- ts_ip_endpoint _mc_ip;
+ IpEndpoint _mc_ip;
int _mc_ttl;
struct multicast_data
{
@@ -767,12 +767,12 @@ public:
} ReconfigState_t;
ReconfigState_t ReconfigureStateMachine(ReconfigState_t, int, int);
- Peer *FindPeer(InkInetAddr const& ip, uint16_t port = 0);
- Peer *FindPeer(ts_ip_endpoint const& ip) {
- return this->FindPeer(InkInetAddr(&ip), ink_inet_get_port(&ip));
+ Peer *FindPeer(IpAddr const& ip, uint16_t port = 0);
+ Peer *FindPeer(IpEndpoint const& ip) {
+ return this->FindPeer(IpAddr(&ip), ats_ip_port_host_order(&ip));
}
Peer *FindPeer(sockaddr const* ip) {
- return this->FindPeer(InkInetAddr(ip), ink_inet_get_port(ip));
+ return this->FindPeer(IpAddr(ip), ats_ip_port_host_order(ip));
}
inline Peer *GetLocalPeer()
@@ -847,9 +847,9 @@ private:
_PendingIcpQueries--;
}
- Peer *GenericFindListPeer(InkInetAddr const&, uint16_t, int, Ptr<Peer> *);
- Peer *FindSendListPeer(InkInetAddr const&, uint16_t);
- Peer *FindRecvListPeer(InkInetAddr const&, uint16_t);
+ Peer *GenericFindListPeer(IpAddr const&, uint16_t, int, Ptr<Peer> *);
+ Peer *FindSendListPeer(IpAddr const&, uint16_t);
+ Peer *FindRecvListPeer(IpAddr const&, uint16_t);
int AddPeer(Peer *);
int AddPeerToSendList(Peer *);
int AddPeerToRecvList(Peer *);
@@ -1077,7 +1077,7 @@ public:
Ptr<IOBufferBlock> _buf; // the buffer with the ICP message in it
ICPMsg_t *_rICPmsg;
int _rICPmsg_len;
- ts_ip_endpoint _sender; // sender of rICPmsg
+ IpEndpoint _sender; // sender of rICPmsg
URL _cachelookupURL;
int _queryResult;
ICPRequestCont *_ICPReqCont;
@@ -1199,7 +1199,7 @@ private:
URL *_url;
// Return data
- ts_ip_endpoint _ret_sockaddr;
+ IpEndpoint _ret_sockaddr;
ICPreturn_t _ret_status;
class Action _act;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/proxy/ICPConfig.cc
----------------------------------------------------------------------
diff --git a/proxy/ICPConfig.cc b/proxy/ICPConfig.cc
index a1082ae..0d8eb7a 100644
--- a/proxy/ICPConfig.cc
+++ b/proxy/ICPConfig.cc
@@ -302,7 +302,7 @@ PeerType_t PeerConfigData::CTypeToPeerType_t(int ctype)
}
int
-PeerConfigData::GetHostIPByName(char *hostname, InkInetAddr& rip)
+PeerConfigData::GetHostIPByName(char *hostname, IpAddr& rip)
{
// Short circuit NULL hostname case
if (0 == hostname || 0 == *hostname)
@@ -319,8 +319,8 @@ PeerConfigData::GetHostIPByName(char *hostname, InkInetAddr& rip)
for ( addrinfo *spot = ai ; spot ; spot = spot->ai_next) {
// If current address is valid, and either we don't have one yet
// or this address is less than our current, set it as current.
- if (ink_inet_is_ip(spot->ai_addr) &&
- (!best || -1 == ink_inet_cmp(spot->ai_addr, best))
+ if (ats_is_ip(spot->ai_addr) &&
+ (!best || -1 == ats_ip_addr_cmp(spot->ai_addr, best))
) {
best = spot->ai_addr;
}
@@ -843,7 +843,7 @@ Peer::LogRecvMsg(ICPMsg_t * m, int valid)
_state |= PEER_UP;
_stats.total_received = _stats.total_sent; // restart timeout count
- Debug("icp", "Peer [%s] now back online", ink_inet_nptop(this->GetIP(), ipb, sizeof(ipb)));
+ Debug("icp", "Peer [%s] now back online", ats_ip_nptop(this->GetIP(), ipb, sizeof(ipb)));
}
}
@@ -854,7 +854,7 @@ Peer::LogRecvMsg(ICPMsg_t * m, int valid)
ParentSiblingPeer::ParentSiblingPeer(PeerType_t t, PeerConfigData * p, ICPProcessor * icpPr, bool dynamic_peer)
:Peer(t, icpPr, dynamic_peer), _pconfig(p)
{
- ink_inet_ip_set(&_ip.sa, _pconfig->GetIPAddr(), htons(_pconfig->GetICPPort()));
+ ats_ip_set(&_ip.sa, _pconfig->GetIPAddr(), htons(_pconfig->GetICPPort()));
}
int
@@ -880,17 +880,17 @@ ParentSiblingPeer::SendMsg_re(Continuation * cont, void *token, struct msghdr *
if (to) {
// Send to specified host
- Peer *p = _ICPpr->FindPeer(InkInetAddr(to), ntohs(ink_inet_port_cast(to)));
+ Peer *p = _ICPpr->FindPeer(IpAddr(to), ntohs(ats_ip_port_cast(to)));
ink_assert(p);
msg->msg_name = &p->GetSendChan()->addr;
- msg->msg_namelen = ink_inet_ip_size(&p->GetSendChan()->addr);
+ msg->msg_namelen = ats_ip_size(&p->GetSendChan()->addr);
Action *a = udpNet.sendmsg_re(cont, token, lp->GetSendFD(), msg);
return a;
} else {
// Send to default host
msg->msg_name = & _chan.addr;
- msg->msg_namelen = ink_inet_ip_size(&_chan.addr.sa);
+ msg->msg_namelen = ats_ip_size(&_chan.addr.sa);
Action *a = udpNet.sendmsg_re(cont, token, lp->GetSendFD(), msg);
return a;
}
@@ -928,7 +928,7 @@ ParentSiblingPeer::ExpectedReplies(BitMap * expected_replies_list)
if (_state & PEER_UP) {
ip_port_text_buffer ipb;
_state &= ~PEER_UP;
- Debug("icp", "Peer [%s] marked offline", ink_inet_nptop(this->GetIP(), ipb, sizeof(ipb)));
+ Debug("icp", "Peer [%s] marked offline", ats_ip_nptop(this->GetIP(), ipb, sizeof(ipb)));
}
//
// We will continue to send messages, but will not wait for a reply
@@ -962,8 +962,8 @@ ParentSiblingPeer::ValidSender(sockaddr* fr)
// Make sure the sockaddr_in corresponds to this peer
// Need to update once we have support for comparing address
// and port in a socakddr.
- if (ink_inet_eq(this->GetIP(), fr) &&
- (ink_inet_port_cast(this->GetIP()) == ink_inet_port_cast(fr))
+ if (ats_ip_addr_eq(this->GetIP(), fr) &&
+ (ats_ip_port_cast(this->GetIP()) == ats_ip_port_cast(fr))
) {
return 1; // Sender is this peer
} else {
@@ -987,10 +987,10 @@ ParentSiblingPeer::LogSendMsg(ICPMsg_t * m, sockaddr const* sa)
int
ParentSiblingPeer::ExtToIntRecvSockAddr(sockaddr const* in, sockaddr *out)
{
- Peer *p = _ICPpr->FindPeer(InkInetAddr(in));
+ Peer *p = _ICPpr->FindPeer(IpAddr(in));
if (p && (p->GetType() != PEER_LOCAL)) {
// Map from received (ip, port) to defined (ip, port).
- ink_inet_copy(out, p->GetIP());
+ ats_ip_copy(out, p->GetIP());
return 1;
} else {
return 0;
@@ -1001,10 +1001,10 @@ ParentSiblingPeer::ExtToIntRecvSockAddr(sockaddr const* in, sockaddr *out)
// Class MultiCastPeer (derived from Peer) member functions
// ICP object describing MultiCast Peers.
//-----------------------------------------------------------
-MultiCastPeer::MultiCastPeer(InkInetAddr const& addr, uint16_t mc_port, int ttl, ICPProcessor * icpPr)
+MultiCastPeer::MultiCastPeer(IpAddr const& addr, uint16_t mc_port, int ttl, ICPProcessor * icpPr)
:Peer(PEER_MULTICAST, icpPr), _mc_ttl(ttl)
{
- ink_inet_ip_set(&_mc_ip.sa, addr, htons(mc_port));
+ ats_ip_set(&_mc_ip.sa, addr, htons(mc_port));
memset(&this->_mc, 0, sizeof(this->_mc));
}
@@ -1027,7 +1027,7 @@ MultiCastPeer::SendMsg_re(Continuation * cont, void *token, struct msghdr * msg,
if (to) {
// Send to MultiCast group member (UniCast)
- Peer *p = FindMultiCastChild(InkInetAddr(to), ink_inet_get_port(to));
+ Peer *p = FindMultiCastChild(IpAddr(to), ats_ip_port_host_order(to));
ink_assert(p);
a = ((ParentSiblingPeer *) p)->SendMsg_re(cont, token, msg, 0);
} else {
@@ -1085,8 +1085,8 @@ MultiCastPeer::ValidSender(sockaddr* sa)
// MultiCast group.
Peer *P = _next;
while (P) {
- if (ink_inet_eq(P->GetIP(), sa) &&
- (ink_inet_port_cast(P->GetIP()) == ink_inet_port_cast(sa))
+ if (ats_ip_addr_eq(P->GetIP(), sa) &&
+ (ats_ip_port_cast(P->GetIP()) == ats_ip_port_cast(sa))
) {
return 1;
} else {
@@ -1105,7 +1105,7 @@ MultiCastPeer::LogSendMsg(ICPMsg_t * m, sockaddr const* sa)
// target Peer.
//
Peer *p;
- p = FindMultiCastChild(InkInetAddr(sa), ink_inet_get_port(sa));
+ p = FindMultiCastChild(IpAddr(sa), ats_ip_port_host_order(sa));
if (p)
((ParentSiblingPeer *) p)->LogSendMsg(m, sa);
@@ -1135,9 +1135,9 @@ MultiCastPeer::AddMultiCastChild(Peer * P)
// Add (Peer *) to the given MultiCast structure.
// Make sure child (ip,port) is unique.
sockaddr const* ip = P->GetIP();
- if (FindMultiCastChild(InkInetAddr(ip), ink_inet_get_port(ip))) {
+ if (FindMultiCastChild(IpAddr(ip), ats_ip_port_host_order(ip))) {
ip_text_buffer x;
- Warning("bad icp.config, multiple multicast child definitions for ip=%s", ink_inet_ntop(ip, x, sizeof(x)));
+ Warning("bad icp.config, multiple multicast child definitions for ip=%s", ats_ip_ntop(ip, x, sizeof(x)));
return 0; // Not added, already exists
} else {
P->SetNext(this->_next);
@@ -1148,7 +1148,7 @@ MultiCastPeer::AddMultiCastChild(Peer * P)
}
Peer *
-MultiCastPeer::FindMultiCastChild(InkInetAddr const& addr, uint16_t port)
+MultiCastPeer::FindMultiCastChild(IpAddr const& addr, uint16_t port)
{
// Locate child (Peer *) with the given (ip,port). This is split out
// rather than using a sockaddr so we can indicate the port is to not
@@ -1157,7 +1157,7 @@ MultiCastPeer::FindMultiCastChild(InkInetAddr const& addr, uint16_t port)
while (curP) {
sockaddr const* peer_ip = curP->GetIP();
if (addr == peer_ip &&
- (!port || port == ink_inet_get_port(peer_ip))
+ (!port || port == ats_ip_port_host_order(peer_ip))
) {
return curP;
} else {
@@ -1490,12 +1490,12 @@ ICPProcessor::DumpICPConfig()
} // End of switch
if (*str_type == 'M') {
- Debug("icp", "[%d]: Type=%s IP=%s", id, str_type, ink_inet_nptop(P->GetIP(), ipb, sizeof(ipb)));
+ Debug("icp", "[%d]: Type=%s IP=%s", id, str_type, ats_ip_nptop(P->GetIP(), ipb, sizeof(ipb)));
} else {
ParentSiblingPeer *Pps = static_cast<ParentSiblingPeer *>(P);
Debug("icp",
"[%d]: Type=%s IP=%s PPort=%d Host=%s",
- id, str_type, ink_inet_nptop(P->GetIP(), ipb, sizeof(ipb)),
+ id, str_type, ats_ip_nptop(P->GetIP(), ipb, sizeof(ipb)),
Pps->GetConfig()->GetProxyPort(), Pps->GetConfig()->GetHostname());
Debug("icp",
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/proxy/IPAllow.cc
----------------------------------------------------------------------
diff --git a/proxy/IPAllow.cc b/proxy/IPAllow.cc
index c9585d6..315a8e5 100644
--- a/proxy/IPAllow.cc
+++ b/proxy/IPAllow.cc
@@ -178,10 +178,10 @@ IpAllow::Print() {
s << std::endl << " Line " << ar->_src_line << ": "
<< (ACL_OP_ALLOW == ar->_op ? "allow " : "deny ")
- << ink_inet_ntop(spot->min(), text, sizeof text)
+ << ats_ip_ntop(spot->min(), text, sizeof text)
;
- if (0 != ink_inet_cmp(spot->min(), spot->max())) {
- s << " - " << ink_inet_ntop(spot->max(), text, sizeof text);
+ if (0 != ats_ip_addr_cmp(spot->min(), spot->max())) {
+ s << " - " << ats_ip_ntop(spot->max(), text, sizeof text);
}
}
Debug("ip-allow", "%s", s.str().c_str());
@@ -196,8 +196,8 @@ IpAllow::BuildTable()
char errBuf[1024];
char *file_buf = NULL;
int line_num = 0;
- ts_ip_endpoint addr1;
- ts_ip_endpoint addr2;
+ IpEndpoint addr1;
+ IpEndpoint addr2;
matcher_line line_info;
bool alarmAlready = false;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/proxy/IPAllow.h
----------------------------------------------------------------------
diff --git a/proxy/IPAllow.h b/proxy/IPAllow.h
index a3a00aa..753289a 100644
--- a/proxy/IPAllow.h
+++ b/proxy/IPAllow.h
@@ -68,7 +68,7 @@ public:
int BuildTable();
void Print();
bool match(in_addr_t addr) const;
- bool match(ts_ip_endpoint const* ip) const;
+ bool match(IpEndpoint const* ip) const;
bool match(sockaddr const* ip) const;
/// @return The global instance.
@@ -106,7 +106,7 @@ IpAllow::match(in_addr_t addr) const {
}
inline bool
-IpAllow::match(ts_ip_endpoint const* ip) const {
+IpAllow::match(IpEndpoint const* ip) const {
return this->match(&ip->sa);
}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/proxy/InkAPI.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index 210ffba..20e8fbb 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -5271,7 +5271,7 @@ TSHttpTxnClientIPGet(TSHttpTxn txnp)
sdk_assert(sdk_sanity_check_txn(txnp) == TS_SUCCESS);
HttpSM *sm = (HttpSM *) txnp;
- return ink_inet_ip4_addr_cast(&sm->t_state.client_info.addr);
+ return ats_ip4_addr_cast(&sm->t_state.client_info.addr);
}
sockaddr const*
@@ -5299,7 +5299,7 @@ TSHttpTxnClientIncomingPortGet(TSHttpTxn txnp)
sdk_assert(sdk_sanity_check_txn(txnp) == TS_SUCCESS);
HttpSM *sm = (HttpSM *) txnp;
- return ink_inet_get_port(&sm->t_state.client_info.addr);
+ return ats_ip_port_host_order(&sm->t_state.client_info.addr);
}
sockaddr const*
@@ -5317,7 +5317,7 @@ TSHttpTxnServerIPGet(TSHttpTxn txnp)
sdk_assert(sdk_sanity_check_txn(txnp) == TS_SUCCESS);
HttpSM *sm = (HttpSM *) txnp;
- return ink_inet_ip4_addr_cast(&sm->t_state.server_info.addr.sa);
+ return ats_ip4_addr_cast(&sm->t_state.server_info.addr.sa);
}
// [amc] This might use the port. The code path should do that but it
@@ -5328,11 +5328,11 @@ TSHttpTxnOutgoingAddrSet(TSHttpTxn txnp, const struct sockaddr *addr, socklen_t
sdk_assert(sdk_sanity_check_txn(txnp) == TS_SUCCESS);
HttpSM *sm = (HttpSM *) txnp;
- sm->ua_session->outbound_port = ink_inet_get_port(addr);
+ sm->ua_session->outbound_port = ats_ip_port_host_order(addr);
- if (ink_inet_is_ip4(addr)) {
+ if (ats_is_ip4(addr)) {
sm->ua_session->outbound_ip4.assign(addr);
- } else if (ink_inet_is_ip6(addr)) {
+ } else if (ats_is_ip6(addr)) {
sm->ua_session->outbound_ip6.assign(addr);
} else {
sm->ua_session->outbound_ip4.invalidate();
@@ -5368,7 +5368,7 @@ TSHttpTxnNextHopIPGet(TSHttpTxn txnp)
*/
if (sm->t_state.current.server == NULL)
return 0;
- return ink_inet_ip4_addr_cast(&sm->t_state.current.server->addr.sa);
+ return ats_ip4_addr_cast(&sm->t_state.current.server->addr.sa);
}
int
@@ -5380,7 +5380,7 @@ TSHttpTxnNextHopPortGet(TSHttpTxn txnp)
int port = 0;
if (sm && sm->t_state.current.server)
- port = ink_inet_get_port(&sm->t_state.current.server->addr);
+ port = ats_ip_port_host_order(&sm->t_state.current.server->addr);
return port;
}
@@ -5995,8 +5995,8 @@ TSHttpConnect(sockaddr const* addr)
{
sdk_assert(addr);
- sdk_assert(ink_inet_is_ip(addr));
- sdk_assert(ink_inet_port_cast(addr));
+ sdk_assert(ats_is_ip(addr));
+ sdk_assert(ats_ip_port_cast(addr));
if (plugin_http_accept) {
PluginVCCore *new_pvc = PluginVCCore::alloc();
@@ -6023,12 +6023,12 @@ TSHttpConnect(sockaddr const* addr)
TSVConn
TSHttpConnectTransparent(sockaddr const* client_addr, sockaddr const* server_addr)
{
- sdk_assert(ink_inet_is_ip(client_addr));
- sdk_assert(ink_inet_is_ip(server_addr));
- sdk_assert(!ink_inet_is_any(client_addr));
- sdk_assert(ink_inet_port_cast(client_addr));
- sdk_assert(!ink_inet_is_any(server_addr));
- sdk_assert(ink_inet_port_cast(server_addr));
+ sdk_assert(ats_is_ip(client_addr));
+ sdk_assert(ats_is_ip(server_addr));
+ sdk_assert(!ats_is_ip_any(client_addr));
+ sdk_assert(ats_ip_port_cast(client_addr));
+ sdk_assert(!ats_is_ip_any(server_addr));
+ sdk_assert(ats_ip_port_cast(server_addr));
if (plugin_http_transparent_accept) {
PluginVCCore *new_pvc = PluginVCCore::alloc();
@@ -6377,7 +6377,7 @@ TSAction
TSNetConnect(TSCont contp, sockaddr const* addr)
{
sdk_assert(sdk_sanity_check_continuation(contp) == TS_SUCCESS);
- sdk_assert(ink_inet_is_ip(addr));
+ sdk_assert(ats_is_ip(addr));
FORCE_PLUGIN_MUTEX(contp);
@@ -6435,7 +6435,7 @@ in_addr_t
TSHostLookupResultIpGet(TSHostLookupResult lookup_result)
{
sdk_assert(sdk_sanity_check_hostlookup_structure(lookup_result) == TS_SUCCESS);
- return ink_inet_ip4_addr_cast(((HostDBInfo *)lookup_result)->ip());
+ return ats_ip4_addr_cast(((HostDBInfo *)lookup_result)->ip());
}
void
@@ -6446,7 +6446,7 @@ TSOSIpSet(TSHttpTxn txnp, unsigned int ip)
HttpTransact::State *s = &(sm->t_state);
s->dns_info.lookup_success = true;
- ink_inet_ip4_set(s->host_db_info.ip(), ip);
+ ats_ip4_set(s->host_db_info.ip(), ip);
}
/*
@@ -7282,9 +7282,9 @@ TSFetchPages(TSFetchUrlParams_t *params)
while (myparams != NULL) {
FetchSM *fetch_sm = FetchSMAllocator.alloc();
- sockaddr* addr = ink_inet_sa_cast(&myparams->ip);
- in_addr_t ip = ink_inet_ip4_addr_cast(addr);
- uint16_t port = ink_inet_get_port(addr);
+ sockaddr* addr = ats_ip_sa_cast(&myparams->ip);
+ in_addr_t ip = ats_ip4_addr_cast(addr);
+ uint16_t port = ats_ip_port_host_order(addr);
fetch_sm->init((Continuation*)myparams->contp, myparams->options,myparams->events, myparams->request, myparams->request_len, ip, port);
fetch_sm->httpConnect();
@@ -7298,11 +7298,11 @@ TSFetchUrl(const char* headers, int request_len, sockaddr const* ip , TSCont con
if (callback_options != NO_CALLBACK) {
sdk_assert(sdk_sanity_check_continuation(contp) == TS_SUCCESS);
}
- sdk_assert(ink_inet_is_ip4(ip));
+ sdk_assert(ats_is_ip4(ip));
FetchSM *fetch_sm = FetchSMAllocator.alloc();
- in_addr_t addr = ink_inet_ip4_addr_cast(ip);
- unsigned short port = ink_inet_port_cast(ip);
+ in_addr_t addr = ats_ip4_addr_cast(ip);
+ unsigned short port = ats_ip_port_cast(ip);
fetch_sm->init((Continuation*)contp, callback_options, events, headers, request_len, addr, port);
fetch_sm->httpConnect();
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/proxy/InkAPITest.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPITest.cc b/proxy/InkAPITest.cc
index bdfa0b8..dca65c8 100644
--- a/proxy/InkAPITest.cc
+++ b/proxy/InkAPITest.cc
@@ -281,15 +281,15 @@ client_handler(TSCont contp, TSEvent event, void *data)
SDK_RPRINT(SDK_NetVConn_test, "TSNetConnect", "TestCase1", TC_PASS, "ok");
sockaddr const* addr = TSNetVConnRemoteAddrGet(static_cast<TSVConn>(data));
- uint16_t input_server_port = ink_inet_get_port(addr);
+ uint16_t input_server_port = ats_ip_port_host_order(addr);
- if (!ink_inet_is_loopback(addr)) {
+ if (!ats_is_ip_loopback(addr)) {
ip_text_buffer s, ipb;
- ts_ip_endpoint loopback;
- ink_inet_ip4_set(&loopback, htonl(INADDR_LOOPBACK));
+ IpEndpoint loopback;
+ ats_ip4_set(&loopback, htonl(INADDR_LOOPBACK));
SDK_RPRINT(SDK_NetVConn_test, "TSNetVConnRemoteIPGet", "TestCase1", TC_FAIL, "server ip [%s] is incorrect - expected [%s]",
- ink_inet_ntop(addr, s, sizeof s),
- ink_inet_ntop(&loopback.sa, ipb, sizeof ipb)
+ ats_ip_ntop(addr, s, sizeof s),
+ ats_ip_ntop(&loopback.sa, ipb, sizeof ipb)
);
TSContDestroy(contp);
@@ -333,8 +333,8 @@ REGRESSION_TEST(SDK_API_TSNetVConn) (RegressionTest * test, int atype, int *psta
TSNetAccept(server_cont, server_port, -1, 0);
- ts_ip_endpoint addr;
- ink_inet_ip4_set(&addr, htonl(INADDR_LOOPBACK), htons(server_port));
+ IpEndpoint addr;
+ ats_ip4_set(&addr, htonl(INADDR_LOOPBACK), htons(server_port));
TSNetConnect(client_cont, &addr.sa);
}
@@ -2163,7 +2163,7 @@ checkHttpTxnClientIPGet(SocketTest * test, void *data)
in_addr_t actual_ip = htonl(INADDR_LOOPBACK); /* 127.0.0.1 is expected because the client is on the same machine */
ptr = TSHttpTxnClientAddrGet(txnp);
- if (ptr == 0 || INADDR_ANY == (ip = ink_inet_ip4_addr_cast(ptr))) {
+ if (ptr == 0 || INADDR_ANY == (ip = ats_ip4_addr_cast(ptr))) {
test->test_client_ip_get = false;
SDK_RPRINT(test->regtest, "TSHttpTxnClientIPGet", "TestCase1", TC_FAIL, "TSHttpTxnClientIPGet returns 0 %s", ptr ? "address" : "pointer");
return TS_EVENT_CONTINUE;
@@ -2190,7 +2190,7 @@ checkHttpTxnNextHopIPGet(SocketTest * test, void *data)
in_addr_t nexthopip;
ptr = TSHttpTxnNextHopAddrGet(txnp);
- if (ptr == 0 || (nexthopip = ink_inet_ip4_addr_cast(ptr)) == 0) {
+ if (ptr == 0 || (nexthopip = ats_ip4_addr_cast(ptr)) == 0) {
test->test_next_hop_ip_get = false;
SDK_RPRINT(test->regtest, "TSHttpTxnNextHopIPGet", "TestCase1", TC_FAIL, "TSHttpTxnNextHopIPGet returns 0 %s", ptr ? "address" : "pointer" );
return TS_EVENT_CONTINUE;
@@ -2219,7 +2219,7 @@ checkHttpTxnServerIPGet(SocketTest * test, void *data)
in_addr_t actual_ip = htonl(INADDR_LOOPBACK); /* 127.0.0.1 is expected because the client is on the same machine */
ptr = TSHttpTxnServerAddrGet(txnp);
- if (0 == ptr || 0 == (ip = ink_inet_ip4_addr_cast(ptr))) {
+ if (0 == ptr || 0 == (ip = ats_ip4_addr_cast(ptr))) {
test->test_server_ip_get = false;
SDK_RPRINT(test->regtest, "TSHttpTxnServerIPGet", "TestCase1", TC_FAIL, "TSHttpTxnServerIPGet returns 0 %s", ptr ? "address" : "pointer");
return TS_EVENT_CONTINUE;
@@ -2259,7 +2259,7 @@ checkHttpTxnClientIncomingPortGet(SocketTest * test, void *data)
test->test_client_incoming_port_get = false;
return TS_EVENT_CONTINUE;
}
- port = ink_inet_get_port(ptr);
+ port = ats_ip_port_host_order(ptr);
TSDebug(UTDBG_TAG, "TS HTTP port = %x, Txn incoming client port %x", proxy_port->m_port, port);
@@ -2293,7 +2293,7 @@ checkHttpTxnClientRemotePortGet(SocketTest * test, void *data)
return TS_EVENT_CONTINUE;
}
- port = ink_inet_get_port(ptr);
+ port = ats_ip_port_host_order(ptr);
TSDebug(UTDBG_TAG, "Browser port = %x, Txn remote port = %x", browser_port, port);
if (port == browser_port) {
@@ -7451,8 +7451,8 @@ EXCLUSIVE_REGRESSION_TEST(SDK_API_TSHttpConnectIntercept) (RegressionTest * test
/* ip and log do not matter as it is used for logging only */
sockaddr_in addr;
- ink_inet_ip4_set(&addr, 1, 1);
- data->vc = TSHttpConnect(ink_inet_sa_cast(&addr));
+ ats_ip4_set(&addr, 1, 1);
+ data->vc = TSHttpConnect(ats_ip_sa_cast(&addr));
synclient_txn_send_request_to_vc(data->browser, data->request, data->vc);
/* Wait until transaction is done */
@@ -7492,8 +7492,8 @@ EXCLUSIVE_REGRESSION_TEST(SDK_API_TSHttpConnectServerIntercept) (RegressionTest
/* ip and log do not matter as it is used for logging only */
sockaddr_in addr;
- ink_inet_ip4_set(&addr, 2, 2);
- data->vc = TSHttpConnect(ink_inet_sa_cast(&addr));
+ ats_ip4_set(&addr, 2, 2);
+ data->vc = TSHttpConnect(ats_ip_sa_cast(&addr));
synclient_txn_send_request_to_vc(data->browser, data->request, data->vc);
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/proxy/InkAPITestTool.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPITestTool.cc b/proxy/InkAPITestTool.cc
index 666efaf..0dcc087 100644
--- a/proxy/InkAPITestTool.cc
+++ b/proxy/InkAPITestTool.cc
@@ -503,8 +503,8 @@ synclient_txn_send_request(ClientTxn * txn, char *request)
cont = TSContCreate(synclient_txn_main_handler, TSMutexCreate());
TSContDataSet(cont, txn);
- ink_inet_ip4_set(&addr, txn->connect_ip, htons(txn->connect_port));
- TSNetConnect(cont, ink_inet_sa_cast(&addr));
+ ats_ip4_set(&addr, txn->connect_ip, htons(txn->connect_port));
+ TSNetConnect(cont, ats_ip_sa_cast(&addr));
return 1;
}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/proxy/InkIOCoreAPI.cc
----------------------------------------------------------------------
diff --git a/proxy/InkIOCoreAPI.cc b/proxy/InkIOCoreAPI.cc
index 10e93a9..35b55be 100644
--- a/proxy/InkIOCoreAPI.cc
+++ b/proxy/InkIOCoreAPI.cc
@@ -364,9 +364,9 @@ INKUDPBind(TSCont contp, unsigned int ip, int port)
FORCE_PLUGIN_MUTEX(contp);
struct sockaddr_in addr;
- ink_inet_ip4_set(&addr, ip, htons(port));
+ ats_ip4_set(&addr, ip, htons(port));
- return reinterpret_cast<TSAction>(udpNet.UDPBind((Continuation *)contp, ink_inet_sa_cast(&addr), INK_ETHERNET_MTU_SIZE, INK_ETHERNET_MTU_SIZE));
+ return reinterpret_cast<TSAction>(udpNet.UDPBind((Continuation *)contp, ats_ip_sa_cast(&addr), INK_ETHERNET_MTU_SIZE, INK_ETHERNET_MTU_SIZE));
}
TSAction
@@ -378,7 +378,7 @@ INKUDPSendTo(TSCont contp, INKUDPConn udp, unsigned int ip, int port, char *data
UDPPacket *packet = new_UDPPacket();
UDPConnection *conn = (UDPConnection *)udp;
- ink_inet_ip4_set(&packet->to, ip, htons(port));
+ ats_ip4_set(&packet->to, ip, htons(port));
IOBufferBlock *blockp = new_IOBufferBlock();
blockp->alloc(BUFFER_SIZE_INDEX_32K);
@@ -440,7 +440,7 @@ INKUDPPacketFromAddressGet(INKUDPPacket packet)
sdk_assert(sdk_sanity_check_null_ptr((void*)packet) == TS_SUCCESS);
UDPPacket *p = (UDPPacket *)packet;
- return ink_inet_ip4_addr_cast(&p->from);
+ return ats_ip4_addr_cast(&p->from);
}
int
@@ -449,7 +449,7 @@ INKUDPPacketFromPortGet(INKUDPPacket packet)
sdk_assert(sdk_sanity_check_null_ptr((void*)packet) == TS_SUCCESS);
UDPPacket *p = (UDPPacket *)packet;
- return ink_inet_get_port(&p->from);
+ return ats_ip_port_host_order(&p->from);
}
INKUDPConn
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/proxy/Main.cc
----------------------------------------------------------------------
diff --git a/proxy/Main.cc b/proxy/Main.cc
index 73f2598..3161a98 100644
--- a/proxy/Main.cc
+++ b/proxy/Main.cc
@@ -1551,7 +1551,7 @@ main(int argc, char **argv)
/* Set up the machine with the outbound address if that's set,
or the inbound address if set, otherwise let it default.
*/
- ts_ip_endpoint machine_addr;
+ IpEndpoint machine_addr;
ink_zero(machine_addr);
if (HttpConfig::m_master.outbound_ip4.isValid())
machine_addr.assign(HttpConfig::m_master.outbound_ip4);
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/proxy/ParentSelection.cc
----------------------------------------------------------------------
diff --git a/proxy/ParentSelection.cc b/proxy/ParentSelection.cc
index 978a8cf..09a936a 100644
--- a/proxy/ParentSelection.cc
+++ b/proxy/ParentSelection.cc
@@ -511,10 +511,10 @@ ParentRecord::FindParent(bool first_call, ParentResult * result, RD * rdata, Par
// INKqa12817 - make sure to convert to host byte order
// Why was it important to do host order here? And does this have any
// impact with the transition to IPv6? The IPv4 functionality is
- // preserved for now anyway as ink_inet_hash returns the 32-bit address in
+ // preserved for now anyway as ats_ip_hash returns the 32-bit address in
// that case.
if (rdata->get_client_ip() != NULL) {
- cur_index = ntohl(ink_inet_hash(rdata->get_client_ip())) % num_parents;
+ cur_index = ntohl(ats_ip_hash(rdata->get_client_ip())) % num_parents;
} else {
cur_index = 0;
}
@@ -1056,9 +1056,9 @@ request_to_data(HttpRequestData * req, sockaddr const* srcip, sockaddr const* ds
HTTPParser parser;
ink_zero(req->src_ip);
- ink_inet_copy(&req->src_ip.sa, srcip);
+ ats_ip_copy(&req->src_ip.sa, srcip);
ink_zero(req->dest_ip);
- ink_inet_copy(&req->dest_ip.sa, dstip);
+ ats_ip_copy(&req->dest_ip.sa, dstip);
req->hdr = NEW(new HTTPHdr);
@@ -1146,11 +1146,11 @@ EXCLUSIVE_REGRESSION_TEST(PARENTSELECTION) (RegressionTest * t, int intensity_le
T("dest_host=pluto scheme=HTTP parent=strategy:80\n") /* L16 */
REBUILD
// Test 3
- ts_ip_endpoint ip;
- ink_inet_pton(TEST_IP4_ADDR, &ip.sa);
+ IpEndpoint ip;
+ ats_ip_pton(TEST_IP4_ADDR, &ip.sa);
ST(3) REINIT br(request, "numeric_host", &ip.sa);
FP RE(verify(result, PARENT_SPECIFIED, "cat", 37) + verify(result, PARENT_SPECIFIED, "dog", 24), 3)
- ink_inet_pton(TEST_IP6_ADDR, &ip.sa);
+ ats_ip_pton(TEST_IP6_ADDR, &ip.sa);
ST(4) REINIT br(request, "numeric_host", &ip.sa);
FP RE(verify(result, PARENT_SPECIFIED, "zwoop", 37) + verify(result, PARENT_SPECIFIED, "jMCg", 24), 4)
// Test 5
@@ -1309,7 +1309,7 @@ br(HttpRequestData * h, const char *os_hostname, sockaddr const* dest_ip)
h->xact_start = time(NULL);
ink_zero(h->src_ip);
ink_zero(h->dest_ip);
- ink_inet_copy(&h->dest_ip.sa, dest_ip);
+ ats_ip_copy(&h->dest_ip.sa, dest_ip);
h->incoming_port = 80;
h->api_info = new _HttpApiInfo();
}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/proxy/PluginVC.cc
----------------------------------------------------------------------
diff --git a/proxy/PluginVC.cc b/proxy/PluginVC.cc
index 2907fd0..1346c66 100644
--- a/proxy/PluginVC.cc
+++ b/proxy/PluginVC.cc
@@ -879,10 +879,10 @@ void
PluginVC::set_local_addr()
{
if (vc_type == PLUGIN_VC_ACTIVE) {
- ink_inet_copy(&local_addr, &core_obj->active_addr_struct);
+ ats_ip_copy(&local_addr, &core_obj->active_addr_struct);
// local_addr = core_obj->active_addr_struct;
} else {
- ink_inet_copy(&local_addr, &core_obj->passive_addr_struct);
+ ats_ip_copy(&local_addr, &core_obj->passive_addr_struct);
// local_addr = core_obj->passive_addr_struct;
}
}
@@ -891,9 +891,9 @@ void
PluginVC::set_remote_addr()
{
if (vc_type == PLUGIN_VC_ACTIVE) {
- ink_inet_copy(&remote_addr, &core_obj->passive_addr_struct);
+ ats_ip_copy(&remote_addr, &core_obj->passive_addr_struct);
} else {
- ink_inet_copy(&remote_addr, &core_obj->active_addr_struct);
+ ats_ip_copy(&remote_addr, &core_obj->active_addr_struct);
}
}
@@ -1147,7 +1147,7 @@ PluginVCCore::kill_no_connect()
void
PluginVCCore::set_passive_addr(in_addr_t ip, int port)
{
- ink_inet_ip4_set(&passive_addr_struct, htonl(ip), htons(port));
+ ats_ip4_set(&passive_addr_struct, htonl(ip), htons(port));
}
void
@@ -1159,7 +1159,7 @@ PluginVCCore::set_passive_addr(sockaddr const* ip)
void
PluginVCCore::set_active_addr(in_addr_t ip, int port)
{
- ink_inet_ip4_set(&active_addr_struct, htonl(ip), htons(port));
+ ats_ip4_set(&active_addr_struct, htonl(ip), htons(port));
}
void
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/proxy/PluginVC.h
----------------------------------------------------------------------
diff --git a/proxy/PluginVC.h b/proxy/PluginVC.h
index f58e5d2..7a6245e 100644
--- a/proxy/PluginVC.h
+++ b/proxy/PluginVC.h
@@ -219,8 +219,8 @@ private:
MIOBuffer *a_to_p_buffer;
IOBufferReader *a_to_p_reader;
- ts_ip_endpoint passive_addr_struct;
- ts_ip_endpoint active_addr_struct;
+ IpEndpoint passive_addr_struct;
+ IpEndpoint active_addr_struct;
void *passive_data;
void *active_data;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/proxy/Prefetch.cc
----------------------------------------------------------------------
diff --git a/proxy/Prefetch.cc b/proxy/Prefetch.cc
index 7326496..a088955 100644
--- a/proxy/Prefetch.cc
+++ b/proxy/Prefetch.cc
@@ -547,7 +547,7 @@ PrefetchTransform::parse_data(IOBufferReader *reader)
continue;
}
//Debug("PrefetchParserURLs", "Found embedded URL: %s", url_start);
- ink_inet_copy(&entry->req_ip, &m_sm->t_state.client_info.addr);
+ ats_ip_copy(&entry->req_ip, &m_sm->t_state.client_info.addr);
PrefetchBlaster *blaster = prefetchBlasterAllocator.alloc();
blaster->init(entry, &m_sm->t_state.hdr_info.client_request, this);
@@ -583,7 +583,7 @@ PrefetchTransform::hash_add(char *s)
#define IS_RECURSIVE_PREFETCH(req_ip) \
- (prefetch_config.max_recursion > 0 && ink_inet_is_loopback(&req_ip))
+ (prefetch_config.max_recursion > 0 && ats_is_ip_loopback(&req_ip))
static void
check_n_attach_prefetch_transform(HttpSM *sm, HTTPHdr *resp, bool from_cache)
@@ -591,11 +591,11 @@ check_n_attach_prefetch_transform(HttpSM *sm, HTTPHdr *resp, bool from_cache)
INKVConnInternal *prefetch_trans;
ip_text_buffer client_ipb;
- ts_ip_endpoint client_ip = sm->t_state.client_info.addr;
+ IpEndpoint client_ip = sm->t_state.client_info.addr;
// we depend on this to setup @a client_ipb for all subsequent Debug().
Debug("PrefetchParser", "Checking response for request from %s\n",
- ink_inet_ntop(&client_ip, client_ipb, sizeof(client_ipb))
+ ats_ip_ntop(&client_ip, client_ipb, sizeof(client_ipb))
);
unsigned int rec_depth = 0;
@@ -892,10 +892,10 @@ PrefetchUrlBlaster::udpUrlBlaster(int event, void *data)
setup_udp_header(block->start(), get_udp_seq_no(), 0, true);
setup_object_header(block->start() + PRELOAD_UDP_HEADER_LEN, block->read_avail() - PRELOAD_UDP_HEADER_LEN, true);
- ts_ip_endpoint saddr;
- ink_inet_copy(&saddr, &url_head->url_multicast_ip) ||
- ink_inet_copy(&saddr, &url_head->child_ip);
- ink_inet_port_cast(&saddr.sa) = htons(prefetch_config.stuffer_port);
+ IpEndpoint saddr;
+ ats_ip_copy(&saddr, &url_head->url_multicast_ip) ||
+ ats_ip_copy(&saddr, &url_head->child_ip);
+ ats_ip_port_cast(&saddr.sa) = htons(prefetch_config.stuffer_port);
udpNet.sendto_re(this, NULL, prefetch_udp_fd, &saddr.sa, sizeof(saddr), block, block->read_avail());
}
@@ -1000,7 +1000,7 @@ PrefetchBlaster::init(PrefetchUrlEntry *entry, HTTPHdr *req_hdr, PrefetchTransfo
//this is a recursive prefetch. get child ip address from
//Client-IP header
ink_strlcpy(b, ip_str, sizeof(b));
- ink_inet_pton(b, &entry->child_ip.sa);
+ ats_ip_pton(b, &entry->child_ip.sa);
} else
entry->child_ip = entry->req_ip;
@@ -1500,7 +1500,7 @@ PrefetchBlaster::httpClient(int event, void *data)
switch (event) {
case EVENT_IMMEDIATE:{
- ts_ip_endpoint target;
+ IpEndpoint target;
target.setToLoopback(AF_INET);
target.port() = prefetch_config.local_http_server_port;
netProcessor.connect_re(this, &target.sa);
@@ -1676,13 +1676,13 @@ PrefetchBlaster::blastObject(int event, void *data)
setup_udp_header(io_block->start(), seq_no, n_pkts_sent++, (towrite >= nread_avail));
- ts_ip_endpoint saddr;
- ink_inet_copy(&saddr.sa,
- ink_inet_is_ip(&url_ent->data_multicast_ip)
+ IpEndpoint saddr;
+ ats_ip_copy(&saddr.sa,
+ ats_is_ip(&url_ent->data_multicast_ip)
? &url_ent->data_multicast_ip.sa
: &url_ent->child_ip.sa
);
- ink_inet_port_cast(&saddr) = htons(prefetch_config.stuffer_port);
+ ats_ip_port_cast(&saddr) = htons(prefetch_config.stuffer_port);
//saddr.sin_addr.s_addr = htonl((209<<24)|(131<<16)|(60<<8)|243);
//saddr.sin_addr.s_addr = htonl((209<<24)|(131<<16)|(48<<8)|52);
@@ -1740,9 +1740,9 @@ PrefetchBlaster::invokeBlaster()
if (ret == TS_PREFETCH_CONTINUE) {
if (MULTICAST_BLAST == url_blast.type)
- ink_inet_copy(&url_ent->url_multicast_ip.sa, &url_blast.ip.sa);
+ ats_ip_copy(&url_ent->url_multicast_ip.sa, &url_blast.ip.sa);
if (MULTICAST_BLAST == data_blast.type)
- ink_inet_copy(&url_ent->data_multicast_ip.sa, &data_blast.ip.sa);
+ ats_ip_copy(&url_ent->data_multicast_ip.sa, &data_blast.ip.sa);
if (url_ent->object_buf_status != TS_PREFETCH_OBJ_BUF_NEEDED) {
if (url_blast.type == TCP_BLAST)
@@ -1795,14 +1795,14 @@ config_read_proto(PrefetchBlastData &blast, const char *str)
blast.type = TCP_BLAST;
else { // this is a multicast address:
if (strncasecmp("multicast:", str, 10) == 0) {
- if (0 != ink_inet_pton(str, &blast.ip.sa)) {
+ if (0 != ats_ip_pton(str, &blast.ip.sa)) {
Error("PrefetchProcessor: Address specified for multicast does not seem to "
"be of the form multicast:ip_addr (eg: multicast:224.0.0.1)");
return 1;
} else {
ip_text_buffer ipb;
blast.type = MULTICAST_BLAST;
- Debug("Prefetch", "Setting multicast address: %s\n", ink_inet_ntop(&blast.ip.sa, ipb, sizeof(ipb)));
+ Debug("Prefetch", "Setting multicast address: %s\n", ats_ip_ntop(&blast.ip.sa, ipb, sizeof(ipb)));
}
} else {
Error("PrefetchProcessor: The protocol for Prefetch should of the form: " "tcp or udp or multicast:ip_address");
@@ -1961,9 +1961,9 @@ PrefetchConfiguration::readHtmlTags(int fd, html_tag ** ptags, html_tag ** pattr
#define CONN_ARR_SIZE 256
inline int
-KeepAliveConnTable::ip_hash(ts_ip_endpoint const& ip)
+KeepAliveConnTable::ip_hash(IpEndpoint const& ip)
{
- return ink_inet_hash(&ip.sa) & (CONN_ARR_SIZE - 1);
+ return ats_ip_hash(&ip.sa) & (CONN_ARR_SIZE - 1);
}
inline int
@@ -2005,7 +2005,7 @@ KeepAliveConnTable::free()
ClassAllocator<KeepAliveLockHandler> prefetchLockHandlerAllocator("prefetchLockHandlerAllocator");
int
-KeepAliveConnTable::append(ts_ip_endpoint const& ip, MIOBuffer *buf, IOBufferReader *reader)
+KeepAliveConnTable::append(IpEndpoint const& ip, MIOBuffer *buf, IOBufferReader *reader)
{
int index = ip_hash(ip);
@@ -2025,7 +2025,7 @@ KeepAliveConnTable::append(ts_ip_endpoint const& ip, MIOBuffer *buf, IOBufferRea
KeepAliveConn **conn = &arr[index].conn;
- while (*conn && ! ink_inet_eq(&(*conn)->ip, &ip))
+ while (*conn && ! ats_ip_addr_eq(&(*conn)->ip, &ip))
conn = &(*conn)->next;
if (*conn) {
@@ -2040,7 +2040,7 @@ KeepAliveConnTable::append(ts_ip_endpoint const& ip, MIOBuffer *buf, IOBufferRea
}
int
-KeepAliveConn::init(ts_ip_endpoint const& xip, MIOBuffer *xbuf, IOBufferReader *xreader)
+KeepAliveConn::init(IpEndpoint const& xip, MIOBuffer *xbuf, IOBufferReader *xreader)
{
mutex = g_conn_table->arr[KeepAliveConnTable::ip_hash(xip)].mutex;
@@ -2114,7 +2114,7 @@ KeepAliveConn::handleEvent(int event, void *data)
break;
case NET_EVENT_OPEN_FAILED:
- Debug("PrefetchKeepAlive", "Connection to child %s failed\n", ink_inet_ntop(&ip.sa, ipb, sizeof(ipb)));
+ Debug("PrefetchKeepAlive", "Connection to child %s failed\n", ats_ip_ntop(&ip.sa, ipb, sizeof(ipb)));
free();
break;
@@ -2143,7 +2143,7 @@ KeepAliveConn::handleEvent(int event, void *data)
break;
case VC_EVENT_ERROR:
- Debug("PrefetchKeepAlive", "got VC_ERROR.. connection problem? " "(ip: %s)", ink_inet_ntop(&ip.sa, ipb, sizeof(ipb)));
+ Debug("PrefetchKeepAlive", "got VC_ERROR.. connection problem? " "(ip: %s)", ats_ip_ntop(&ip.sa, ipb, sizeof(ipb)));
free();
break;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/proxy/Prefetch.h
----------------------------------------------------------------------
diff --git a/proxy/Prefetch.h b/proxy/Prefetch.h
index ccaebd6..ff58d0e 100644
--- a/proxy/Prefetch.h
+++ b/proxy/Prefetch.h
@@ -107,10 +107,10 @@ public:
int object_buf_status;
- ts_ip_endpoint req_ip; /*ip address where request is coming from */
- ts_ip_endpoint child_ip;
- ts_ip_endpoint url_multicast_ip;
- ts_ip_endpoint data_multicast_ip;
+ IpEndpoint req_ip; /*ip address where request is coming from */
+ IpEndpoint child_ip;
+ IpEndpoint url_multicast_ip;
+ IpEndpoint data_multicast_ip;
PrefetchUrlEntry *blaster_link;
PrefetchUrlEntry *hash_link;
@@ -349,13 +349,13 @@ public:
: Continuation(), nbytes_added(0)
{ ink_zero(ip); }
- int init(ts_ip_endpoint const& ip, MIOBuffer * buf, IOBufferReader * reader);
+ int init(IpEndpoint const& ip, MIOBuffer * buf, IOBufferReader * reader);
void free();
int append(IOBufferReader * reader);
int handleEvent(int event, void *data);
- ts_ip_endpoint ip;
+ IpEndpoint ip;
MIOBuffer *buf;
IOBufferReader *reader;
@@ -380,8 +380,8 @@ public:
int init();
void free();
- static int ip_hash(ts_ip_endpoint const& ip);
- int append(ts_ip_endpoint const& ip, MIOBuffer * buf, IOBufferReader * reader);
+ static int ip_hash(IpEndpoint const& ip);
+ int append(IpEndpoint const& ip, MIOBuffer * buf, IOBufferReader * reader);
typedef struct
{
@@ -403,11 +403,11 @@ public:
ink_zero(ip);
};
- void init(ts_ip_endpoint const& xip, MIOBuffer * xbuf, IOBufferReader * xreader)
+ void init(IpEndpoint const& xip, MIOBuffer * xbuf, IOBufferReader * xreader)
{
mutex = g_conn_table->arr[KeepAliveConnTable::ip_hash(xip)].mutex;
- ink_inet_copy(&ip, &xip);
+ ats_ip_copy(&ip, &xip);
buf = xbuf;
reader = xreader;
@@ -421,7 +421,7 @@ public:
int handleEvent(int event, void *data);
- ts_ip_endpoint ip;
+ IpEndpoint ip;
MIOBuffer *buf;
IOBufferReader *reader;
};
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/proxy/SimpleHttp.cc
----------------------------------------------------------------------
diff --git a/proxy/SimpleHttp.cc b/proxy/SimpleHttp.cc
index 7d77627..bd043d8 100644
--- a/proxy/SimpleHttp.cc
+++ b/proxy/SimpleHttp.cc
@@ -657,10 +657,10 @@ SimpleCont::dns_event(int event, void *edata)
if (r->round_robin) {
// TODO: IPv6
sockaddr_in ip4;
- ink_inet_ip4_set(&ip4, 0);
+ ats_ip4_set(&ip4, 0);
Debug("simple_http", "dns round robin");
- rr = r->rr()->select_best(ink_inet_sa_cast(&ip4));
+ rr = r->rr()->select_best(ats_ip_sa_cast(&ip4));
} else {
rr = r;
}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/proxy/Update.cc
----------------------------------------------------------------------
diff --git a/proxy/Update.cc b/proxy/Update.cc
index 0be5d0d..cf6cbe7 100644
--- a/proxy/Update.cc
+++ b/proxy/Update.cc
@@ -2563,7 +2563,7 @@ ObjectReloadCont::ObjectReloadEvent(int event, void *d)
switch (_state) {
case START:
{
- ts_ip_endpoint target;
+ IpEndpoint target;
// Schedule connect to localhost:<proxy port>
Debug("update-reload", "Connect start id=%d", _request_id);
_state = ObjectReloadCont::ATTEMPT_CONNECT;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/proxy/api/ts/InkAPIHughes.h
----------------------------------------------------------------------
diff --git a/proxy/api/ts/InkAPIHughes.h b/proxy/api/ts/InkAPIHughes.h
index 1a35569..32bf883 100644
--- a/proxy/api/ts/InkAPIHughes.h
+++ b/proxy/api/ts/InkAPIHughes.h
@@ -36,7 +36,7 @@ typedef enum
typedef struct {
PrefetchBlastType type;
- ts_ip_endpoint ip;
+ IpEndpoint ip;
} PrefetchBlastData;
typedef struct
@@ -51,7 +51,7 @@ typedef struct
TSMLoc response_loc;
/*child ip addr in network order */
- ts_ip_endpoint client_ip;
+ IpEndpoint client_ip;
/*the embedded url parsed by the parser */
const char *embedded_url;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/proxy/congest/Congestion.cc
----------------------------------------------------------------------
diff --git a/proxy/congest/Congestion.cc b/proxy/congest/Congestion.cc
index 95f7567..3cb2ed8 100644
--- a/proxy/congest/Congestion.cc
+++ b/proxy/congest/Congestion.cc
@@ -474,7 +474,7 @@ make_key(char *hostname, int len, sockaddr const* ip, CongestionControlRecord *
if (record->congestion_scheme == PER_HOST && len > 0)
ink_code_incr_MMH_update(&ctx, hostname, len);
else
- ink_code_incr_MMH_update(&ctx, reinterpret_cast<char const*>(ink_inet_addr8_cast(ip)), ink_inet_addr_size(ip));
+ ink_code_incr_MMH_update(&ctx, reinterpret_cast<char const*>(ats_ip_addr8_cast(ip)), ats_ip_addr_size(ip));
if (record->port != 0) {
unsigned short p = port;
p = htons(p);
@@ -490,7 +490,7 @@ make_key(char *hostname, int len, sockaddr const* ip, CongestionControlRecord *
if (record->congestion_scheme == PER_HOST && len > 0)
ink_code_incr_md5_update(&ctx, hostname, len);
else
- ink_code_incr_md5_update(&ctx, reinterpret_cast<char const*>(ink_inet_addr8_cast(ip)), ink_inet_addr_size(ip));
+ ink_code_incr_md5_update(&ctx, reinterpret_cast<char const*>(ats_ip_addr8_cast(ip)), ats_ip_addr_size(ip));
if (record->port != 0) {
unsigned short p = record->port;
p = htons(p);
@@ -515,7 +515,7 @@ make_key(char *hostname, int len, sockaddr const* ip, char *prefix, int prelen,
if (hostname && len > 0)
ink_code_incr_MMH_update(&ctx, hostname, len);
else
- ink_code_incr_MMH_update(&ctx, reinterpret_cast<char const*>(ink_inet_addr8_cast(ip)), ink_inet_addr_size(ip));
+ ink_code_incr_MMH_update(&ctx, reinterpret_cast<char const*>(ats_ip_addr8_cast(ip)), ats_ip_addr_size(ip));
if (port != 0) {
unsigned short p = port;
p = htons(p);
@@ -531,7 +531,7 @@ make_key(char *hostname, int len, sockaddr const* ip, char *prefix, int prelen,
if (hostname && len > 0)
ink_code_incr_md5_update(&ctx, hostname, len);
else
- ink_code_incr_md5_update(&ctx, reinterpret_cast<char const*>(ink_inet_addr8_cast(ip)), ink_inet_addr_size(ip));
+ ink_code_incr_md5_update(&ctx, reinterpret_cast<char const*>(ats_ip_addr8_cast(ip)), ats_ip_addr_size(ip));
if (port != 0) {
unsigned short p = port;
p = htons(p);
@@ -617,7 +617,7 @@ m_M_congested(0), m_last_M_congested(0), m_num_connections(0), m_stat_congested_
{
memset(&m_ip, 0, sizeof(m_ip));
if (ip != NULL) {
- ink_inet_copy(&m_ip.sa, ip);
+ ats_ip_copy(&m_ip.sa, ip);
}
m_hostname = ats_strdup(hostname);
rule->get();
@@ -714,7 +714,7 @@ CongestionEntry::sprint(char *buf, int buflen, int format)
len += snprintf(buf + len, buflen - len, "%" PRId64 "|%d|%s|%s",
timestamp,
pRecord->line_num,
- (m_hostname ? m_hostname : " "), (ink_inet_is_ip(&m_ip) ? ink_inet_ntop(&m_ip.sa, addrbuf, sizeof(addrbuf)) : " "));
+ (m_hostname ? m_hostname : " "), (ats_is_ip(&m_ip) ? ats_ip_ntop(&m_ip.sa, addrbuf, sizeof(addrbuf)) : " "));
len += snprintf(buf + len, buflen - len, "|%s|%s|%c",
(pRecord->congestion_scheme == PER_IP ? "per_ip" : "per_host"),
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/proxy/congest/Congestion.h
----------------------------------------------------------------------
diff --git a/proxy/congest/Congestion.h b/proxy/congest/Congestion.h
index 8924da7..3746f8e 100644
--- a/proxy/congest/Congestion.h
+++ b/proxy/congest/Congestion.h
@@ -202,7 +202,7 @@ struct CongestionEntry: public RequestData
// key in the hash table;
uint64_t m_key;
// host info
- ts_ip_endpoint m_ip;
+ IpEndpoint m_ip;
char *m_hostname;
// Pointer to the congestion.config entry
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/proxy/congest/CongestionDB.cc
----------------------------------------------------------------------
diff --git a/proxy/congest/CongestionDB.cc b/proxy/congest/CongestionDB.cc
index 6486fca..f2d3eaf 100644
--- a/proxy/congest/CongestionDB.cc
+++ b/proxy/congest/CongestionDB.cc
@@ -75,7 +75,7 @@ public:
{
uint64_t m_key;
char *m_hostname;
- ts_ip_endpoint m_ip;
+ IpEndpoint m_ip;
CongestionControlRecord *m_rule;
CongestionEntry **m_ppEntry;
} entry_info;
@@ -515,7 +515,7 @@ get_congest_entry(Continuation * cont, HttpRequestData * data, CongestionEntry *
Ccont->mutex = cont->mutex;
Ccont->CDBC_key = key;
Ccont->CDBC_host = (char *) data->get_host();
- ink_inet_copy(&Ccont->CDBC_ip.sa, data->get_ip());
+ ats_ip_copy(&Ccont->CDBC_ip.sa, data->get_ip());
p->get();
Ccont->CDBC_rule = p;
Ccont->CDBC_ppE = ppEntry;
@@ -623,7 +623,7 @@ remove_congested_entry(char *buf, MIOBuffer * out_buffer)
remove_congested_entry(key);
len = snprintf(msg, MSG_LEN, "host=%s prefix=%s removed\n", p, prefix ? prefix : "(nil)");
} else if (strncasecmp(buf, "ip=", 3) == 0) {
- ts_ip_endpoint ip;
+ IpEndpoint ip;
memset(&ip, 0, sizeof(ip));
char *p = buf + 3;
@@ -634,8 +634,8 @@ remove_congested_entry(char *buf, MIOBuffer * out_buffer)
prefix++;
prelen = strlen(prefix);
}
- ink_inet_pton(p, &ip);
- if (!ink_inet_is_ip(&ip)) {
+ ats_ip_pton(p, &ip);
+ if (!ats_is_ip(&ip)) {
len = snprintf(msg, MSG_LEN, "invalid ip: %s\n", buf);
} else {
key = make_key(NULL, 0, &ip.sa, prefix, prelen);
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/proxy/congest/CongestionTest.cc
----------------------------------------------------------------------
diff --git a/proxy/congest/CongestionTest.cc b/proxy/congest/CongestionTest.cc
index a4fc821..e93f4ad 100644
--- a/proxy/congest/CongestionTest.cc
+++ b/proxy/congest/CongestionTest.cc
@@ -407,7 +407,7 @@ CCCongestionDBTestCont::gen_CongestionEntry(sockaddr const* ip, int congested)
{
char hostname[INET6_ADDRSTRLEN];
uint64_t key;
- ink_inet_ntop(ip, hostname, sizeof(hostname));
+ ats_ip_ntop(ip, hostname, sizeof(hostname));
key = make_key(hostname, strlen(hostname), ip, rule->pRecord);
CongestionEntry *ret = new CongestionEntry(hostname,
ip,
@@ -474,8 +474,8 @@ CCCongestionDBTestCont::mainEvent(int event, Event * e)
if (i % (dbsize / 25) == 0)
fprintf(stderr, ".");
- ts_ip_endpoint ip;
- ink_inet_ip4_set(&ip, i + 255);
+ IpEndpoint ip;
+ ats_ip4_set(&ip, i + 255);
CongestionEntry *tmp = gen_CongestionEntry(&ip.sa);
db->addRecord(tmp->m_key, tmp);
@@ -494,8 +494,8 @@ CCCongestionDBTestCont::mainEvent(int event, Event * e)
if (i % (to_add / 25) == 0)
fprintf(stderr, ".");
- ts_ip_endpoint ip;
- ink_inet_ip4_set(&ip, i + 255);
+ IpEndpoint ip;
+ ats_ip4_set(&ip, i + 255);
CongestionEntry *tmp = gen_CongestionEntry(&ip.sa);
db->addRecord(tmp->m_key, tmp);
}
@@ -512,8 +512,8 @@ CCCongestionDBTestCont::mainEvent(int event, Event * e)
if (i % (to_add / 25) == 0)
fprintf(stderr, ".");
- ts_ip_endpoint ip;
- ink_inet_ip4_set(&ip, i + 255);
+ IpEndpoint ip;
+ ats_ip4_set(&ip, i + 255);
CongestionEntry *tmp = gen_CongestionEntry(&ip.sa, 1);
db->addRecord(tmp->m_key, tmp);
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/proxy/http/HttpAccept.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpAccept.cc b/proxy/http/HttpAccept.cc
index a307cf2..f90b7b0 100644
--- a/proxy/http/HttpAccept.cc
+++ b/proxy/http/HttpAccept.cc
@@ -45,7 +45,7 @@ HttpAccept::mainEvent(int event, void *data)
// The backdoor port is now only bound to "localhost", so reason to
// check for if it's incoming from "localhost" or not.
if (!backdoor && IpAllow::instance() && (!IpAllow::instance()->match(client_ip))) {
- Warning("connect by disallowed client %s, closing", ink_inet_ntop(client_ip, ipb, sizeof(ipb)));
+ Warning("connect by disallowed client %s, closing", ats_ip_ntop(client_ip, ipb, sizeof(ipb)));
netvc->do_io_close();
return VC_EVENT_CONT;
@@ -54,7 +54,7 @@ HttpAccept::mainEvent(int event, void *data)
netvc->attributes = transport_type;
if (is_debug_tag_set("http_seq"))
- Debug("http_seq", "[HttpAccept:mainEvent %p] accepted connection from %s transport type = %d", netvc, ink_inet_nptop(client_ip, ipb, sizeof(ipb)), netvc->attributes);
+ Debug("http_seq", "[HttpAccept:mainEvent %p] accepted connection from %s transport type = %d", netvc, ats_ip_nptop(client_ip, ipb, sizeof(ipb)), netvc->attributes);
HttpClientSession *new_session = THREAD_ALLOC_INIT(httpClientSessionAllocator, netvc->thread);
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/proxy/http/HttpAccept.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpAccept.h b/proxy/http/HttpAccept.h
index af3584b..9a22695 100644
--- a/proxy/http/HttpAccept.h
+++ b/proxy/http/HttpAccept.h
@@ -58,12 +58,12 @@ namespace detail {
/// Set the transport type.
self& setTransportType(int);
/// Local address to bind for outbound connections.
- InkInetAddr outbound_ip4;
+ IpAddr outbound_ip4;
/// Local address to bind for outbound connections.
- InkInetAddr outbound_ip6;
+ IpAddr outbound_ip6;
/// Set the outbound IP address.
- self& setOutboundIp(InkInetAddr& ip);
- self& setOutboundIp(ts_ip_endpoint* ip);
+ self& setOutboundIp(IpAddr& ip);
+ self& setOutboundIp(IpEndpoint* ip);
/// Local port for outbound connection.
uint16_t outbound_port;
/// Set outbound port.
@@ -93,14 +93,14 @@ namespace detail {
}
inline HttpAcceptOptions&
- HttpAcceptOptions::setOutboundIp(InkInetAddr& ip) {
+ HttpAcceptOptions::setOutboundIp(IpAddr& ip) {
if (ip.isIp4()) outbound_ip4 = ip;
else if (ip.isIp6()) outbound_ip6 = ip;
return *this;
}
inline HttpAcceptOptions&
- HttpAcceptOptions::setOutboundIp(ts_ip_endpoint* ip) {
+ HttpAcceptOptions::setOutboundIp(IpEndpoint* ip) {
if (ip->isIp4()) outbound_ip4 = *ip;
else if (ip->isIp6()) outbound_ip6 = *ip;
return *this;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/proxy/http/HttpClientSession.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpClientSession.h b/proxy/http/HttpClientSession.h
index dcef903..47d2a3e 100644
--- a/proxy/http/HttpClientSession.h
+++ b/proxy/http/HttpClientSession.h
@@ -144,9 +144,9 @@ public:
bool backdoor_connect;
int hooks_set;
/// Local address for outbound connection.
- InkInetAddr outbound_ip4;
+ IpAddr outbound_ip4;
/// Local address for outbound connection.
- InkInetAddr outbound_ip6;
+ IpAddr outbound_ip6;
/// Local port for outbound connection.
uint16_t outbound_port;
/// Set outbound connection to transparent.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/proxy/http/HttpConfig.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h
index 922fb45..cdd2608 100644
--- a/proxy/http/HttpConfig.h
+++ b/proxy/http/HttpConfig.h
@@ -594,8 +594,8 @@ public:
char *proxy_hostname;
int proxy_hostname_len;
- InkInetAddr inbound_ip4, inbound_ip6;
- InkInetAddr outbound_ip4, outbound_ip6;
+ IpAddr inbound_ip4, inbound_ip6;
+ IpAddr outbound_ip4, outbound_ip6;
MgmtInt server_max_connections;
MgmtInt origin_min_keep_alive_connections; // TODO: This one really ought to be overridable, but difficult right now.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/proxy/http/HttpConnectionCount.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpConnectionCount.h b/proxy/http/HttpConnectionCount.h
index d1acf93..bbf4b45 100644
--- a/proxy/http/HttpConnectionCount.h
+++ b/proxy/http/HttpConnectionCount.h
@@ -46,7 +46,7 @@ public:
* @param ip IP address of the host
* @return Number of connections
*/
- int getCount(const ts_ip_endpoint& addr) {
+ int getCount(const IpEndpoint& addr) {
ink_mutex_acquire(&_mutex);
int count = _hostCount.get(ConnAddr(addr));
ink_mutex_release(&_mutex);
@@ -58,7 +58,7 @@ public:
* @param ip IP address of the host
* @param delta Default is +1, can be set to negative to decrement
*/
- void incrementCount(const ts_ip_endpoint& addr, const int delta = 1) {
+ void incrementCount(const IpEndpoint& addr, const int delta = 1) {
ConnAddr caddr(addr);
ink_mutex_acquire(&_mutex);
int count = _hostCount.get(caddr);
@@ -67,18 +67,18 @@ public:
}
struct ConnAddr {
- ts_ip_endpoint _addr;
+ IpEndpoint _addr;
ConnAddr() { ink_zero(_addr); }
ConnAddr(int x) { ink_release_assert(x == 0); ink_zero(_addr); }
- ConnAddr(const ts_ip_endpoint& addr) : _addr(addr) { }
- operator bool() { return ink_inet_is_ip(&_addr); }
+ ConnAddr(const IpEndpoint& addr) : _addr(addr) { }
+ operator bool() { return ats_is_ip(&_addr); }
};
class ConnAddrHashFns {
public:
- static uintptr_t hash(ConnAddr& addr) { return (uintptr_t) ink_inet_hash(&addr._addr.sa); }
- static int equal(ConnAddr& a, ConnAddr& b) { return ink_inet_eq(&a._addr, &b._addr); }
+ static uintptr_t hash(ConnAddr& addr) { return (uintptr_t) ats_ip_hash(&addr._addr.sa); }
+ static int equal(ConnAddr& a, ConnAddr& b) { return ats_ip_addr_eq(&a._addr, &b._addr); }
};
private:
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/proxy/http/HttpSM.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index c2b91da..00d1b76 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -599,7 +599,7 @@ HttpSM::attach_client_session(HttpClientSession * client_vc, IOBufferReader * bu
NetVConnection* netvc = client_vc->get_netvc();
- ink_inet_copy(&t_state.client_info.addr, netvc->get_remote_addr());
+ ats_ip_copy(&t_state.client_info.addr, netvc->get_remote_addr());
t_state.client_info.port = netvc->get_local_port();
t_state.client_info.is_transparent = netvc->get_is_transparent();
t_state.backdoor_request = client_vc->backdoor_connect;
@@ -1624,9 +1624,9 @@ HttpSM::state_http_server_open(int event, void *data)
UnixNetVConnection *server_vc = (UnixNetVConnection*)data;
printf("client fd is :%d , server fd is %d\n",vc->con.fd,
server_vc->con.fd); */
- ink_inet_copy(&session->server_ip, &t_state.current.server->addr);
+ ats_ip_copy(&session->server_ip, &t_state.current.server->addr);
session->new_connection((NetVConnection *) data);
- ink_inet_port_cast(&session->server_ip) = htons(t_state.current.server->port);
+ ats_ip_port_cast(&session->server_ip) = htons(t_state.current.server->port);
session->state = HSS_ACTIVE;
attach_server_session(session);
@@ -2013,7 +2013,7 @@ HttpSM::process_hostdb_info(HostDBInfo * r)
// m_s.host_db_info = m_updated_host_db_info = *rr;
t_state.host_db_info = *rr;
ink_release_assert(!t_state.host_db_info.reverse_dns);
- ink_release_assert(ink_inet_is_ip(t_state.host_db_info.ip()));
+ ink_release_assert(ats_is_ip(t_state.host_db_info.ip()));
}
} else {
Debug("http", "[%" PRId64 "] DNS lookup failed for '%s'", sm_id, t_state.dns_info.lookup_name);
@@ -2115,7 +2115,7 @@ HttpSM::state_mark_os_down(int event, void *data)
}
} else {
// No longer a round robin, check to see if our address is the same
- if (ink_inet_eq(t_state.host_db_info.ip(), r->ip())) {
+ if (ats_ip_addr_eq(t_state.host_db_info.ip(), r->ip())) {
mark_down = r;
}
}
@@ -3763,8 +3763,8 @@ HttpSM::do_hostdb_reverse_lookup()
Debug("http_seq", "[HttpSM::do_hostdb_reverse_lookup] Doing reverse DNS Lookup");
- ts_ip_endpoint addr;
- ink_inet_pton(t_state.dns_info.lookup_name, &addr.sa);
+ IpEndpoint addr;
+ ats_ip_pton(t_state.dns_info.lookup_name, &addr.sa);
Action *dns_lookup_action_handle = hostDBProcessor.getbyaddr_re(this, &addr.sa);
if (dns_lookup_action_handle != ACTION_RESULT_DONE) {
@@ -3786,7 +3786,7 @@ HttpSM::do_hostdb_update_if_necessary()
}
// If we failed back over to the origin server, we don't have our
// hostdb information anymore which means we shouldn't update the hostdb
- if (!ink_inet_eq(&t_state.current.server->addr.sa, t_state.host_db_info.ip())) {
+ if (!ats_ip_addr_eq(&t_state.current.server->addr.sa, t_state.host_db_info.ip())) {
Debug("http", "[%" PRId64 "] skipping hostdb update due to server failover", sm_id);
return;
}
@@ -3813,12 +3813,12 @@ HttpSM::do_hostdb_update_if_necessary()
} else {
if (t_state.host_db_info.app.http_data.last_failure != 0) {
t_state.host_db_info.app.http_data.last_failure = 0;
- ink_inet_port_cast(&t_state.current.server->addr) = htons(t_state.current.server->port);
+ ats_ip_port_cast(&t_state.current.server->addr) = htons(t_state.current.server->port);
issue_update |= 1;
char addrbuf[INET6_ADDRPORTSTRLEN];
Debug("http", "[%" PRId64 "] hostdb update marking IP: %s as up",
sm_id,
- ink_inet_nptop(&t_state.current.server->addr.sa, addrbuf, sizeof(addrbuf)));
+ ats_ip_nptop(&t_state.current.server->addr.sa, addrbuf, sizeof(addrbuf)));
}
}
@@ -3831,7 +3831,7 @@ HttpSM::do_hostdb_update_if_necessary()
}
char addrbuf[INET6_ADDRPORTSTRLEN];
- Debug("http", "server info = %s", ink_inet_nptop(&t_state.current.server->addr.sa, addrbuf, sizeof(addrbuf)));
+ Debug("http", "server info = %s", ats_ip_nptop(&t_state.current.server->addr.sa, addrbuf, sizeof(addrbuf)));
return;
}
@@ -4076,7 +4076,7 @@ HttpSM::do_http_server_open(bool raw)
opt.local_port = ua_session->outbound_port;
opt.ip_family = ip_family;
- InkInetAddr& outbound_ip = AF_INET6 == ip_family ? ua_session->outbound_ip6 : ua_session->outbound_ip4;
+ IpAddr& outbound_ip = AF_INET6 == ip_family ? ua_session->outbound_ip6 : ua_session->outbound_ip4;
if (outbound_ip.isValid()) {
opt.addr_binding = NetVCOptions::INTF_ADDR;
opt.local_ip = outbound_ip;
@@ -4090,7 +4090,7 @@ HttpSM::do_http_server_open(bool raw)
char addrbuf[INET6_ADDRPORTSTRLEN];
Debug("http", "[%" PRId64 "] open connection to %s: %s",
sm_id, t_state.current.server->name,
- ink_inet_nptop(&t_state.current.server->addr.sa, addrbuf, sizeof(addrbuf)));
+ ats_ip_nptop(&t_state.current.server->addr.sa, addrbuf, sizeof(addrbuf)));
if (plugin_tunnel) {
PluginVCCore *t = plugin_tunnel;
@@ -4168,8 +4168,8 @@ HttpSM::do_http_server_open(bool raw)
HttpServerSession *existing_ss = ua_session->get_server_session();
if (existing_ss) {
- // [amc] Is this OK? Should we compare ports? (not done by ink_inet_cmp)
- if (ink_inet_cmp(&existing_ss->server_ip.sa, &t_state.current.server->addr.sa) == 0) {
+ // [amc] Is this OK? Should we compare ports? (not done by ats_ip_addr_cmp)
+ if (ats_ip_addr_cmp(&existing_ss->server_ip.sa, &t_state.current.server->addr.sa) == 0) {
ua_session->attach_server_session(NULL);
existing_ss->state = HSS_ACTIVE;
this->attach_server_session(existing_ss);
@@ -4221,7 +4221,7 @@ HttpSM::do_http_server_open(bool raw)
char addrbuf[INET6_ADDRSTRLEN];
if (connections->getCount((t_state.current.server->addr)) >= t_state.txn_conf->origin_max_connections) {
Debug("http", "[%" PRId64 "] over the number of connection for this host: %s", sm_id,
- ink_inet_ntop(&t_state.current.server->addr.sa, addrbuf, sizeof(addrbuf)));
+ ats_ip_ntop(&t_state.current.server->addr.sa, addrbuf, sizeof(addrbuf)));
ink_debug_assert(pending_action == NULL);
pending_action = eventProcessor.schedule_in(this, HRTIME_MSECONDS(100));
return;
@@ -4407,7 +4407,7 @@ HttpSM::mark_host_failure(HostDBInfo * info, time_t time_down)
char *url_str = t_state.hdr_info.client_request.url_string_get(&t_state.arena, 0);
Log::error("CONNECT: could not connect to %s "
"for '%s' (setting last failure time)",
- ink_inet_ntop(&t_state.current.server->addr.sa, addrbuf, sizeof(addrbuf)),
+ ats_ip_ntop(&t_state.current.server->addr.sa, addrbuf, sizeof(addrbuf)),
url_str ? url_str : "<none>"
);
if (url_str)
@@ -4423,7 +4423,7 @@ HttpSM::mark_host_failure(HostDBInfo * info, time_t time_down)
Debug("http", "[%" PRId64 "] hostdb update marking IP: %s as down",
sm_id,
- ink_inet_nptop(&t_state.current.server->addr.sa, addrbuf, sizeof(addrbuf)));
+ ats_ip_nptop(&t_state.current.server->addr.sa, addrbuf, sizeof(addrbuf)));
}
void
@@ -6398,7 +6398,7 @@ HttpSM::set_next_state()
} else if (t_state.http_config_param->use_client_target_addr
&& !t_state.url_remap_success
&& t_state.client_info.is_transparent
- && ink_inet_is_ip(addr = t_state.state_machine->ua_session->get_netvc()->get_local_addr())
+ && ats_is_ip(addr = t_state.state_machine->ua_session->get_netvc()->get_local_addr())
) {
ip_text_buffer ipb;
/* If the connection is client side transparent and the URL
@@ -6406,14 +6406,14 @@ HttpSM::set_next_state()
address instead of doing a DNS lookup. This is controlled
by the 'use_client_target_addr' configuration parameter.
*/
- Debug("dns", "[HttpTransact::HandleRequest] Skipping DNS lookup for client supplied target %s.\n", ink_inet_ntop(addr, ipb, sizeof(ipb)));
- ink_inet_copy(t_state.host_db_info.ip(), addr);
+ Debug("dns", "[HttpTransact::HandleRequest] Skipping DNS lookup for client supplied target %s.\n", ats_ip_ntop(addr, ipb, sizeof(ipb)));
+ ats_ip_copy(t_state.host_db_info.ip(), addr);
t_state.dns_info.lookup_success = true;
call_transact_and_set_next_state(NULL);
break;
} else if (t_state.parent_result.r == PARENT_UNDEFINED && t_state.dns_info.lookup_success) {
// Already set, and we don't have a parent proxy to lookup
- ink_assert(ink_inet_is_ip(t_state.host_db_info.ip()));
+ ink_assert(ats_is_ip(t_state.host_db_info.ip()));
Debug("dns", "[HttpTransact::HandleRequest] Skipping DNS lookup, provided by plugin");
call_transact_and_set_next_state(NULL);
break;
@@ -6421,7 +6421,7 @@ HttpSM::set_next_state()
t_state.http_config_param->no_dns_forward_to_parent){
if (t_state.cop_test_page)
- ink_inet_copy(t_state.host_db_info.ip(), t_state.state_machine->ua_session->get_netvc()->get_local_addr());
+ ats_ip_copy(t_state.host_db_info.ip(), t_state.state_machine->ua_session->get_netvc()->get_local_addr());
t_state.dns_info.lookup_success = true;
call_transact_and_set_next_state(NULL);
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/proxy/http/HttpServerSession.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpServerSession.cc b/proxy/http/HttpServerSession.cc
index 4df4d8a..60783eb 100644
--- a/proxy/http/HttpServerSession.cc
+++ b/proxy/http/HttpServerSession.cc
@@ -81,7 +81,7 @@ HttpServerSession::new_connection(NetVConnection *new_vc)
char addrbuf[INET6_ADDRSTRLEN];
Debug("http_ss", "[%" PRId64 "] new connection, ip: %s, count: %u",
con_id,
- ink_inet_ntop(&server_ip.sa, addrbuf, sizeof(addrbuf)), connection_count->getCount(server_ip));
+ ats_ip_ntop(&server_ip.sa, addrbuf, sizeof(addrbuf)), connection_count->getCount(server_ip));
}
#ifdef LAZY_BUF_ALLOC
read_buffer = new_empty_MIOBuffer(HTTP_SERVER_RESP_HDR_BUFFER_INDEX);
@@ -134,7 +134,7 @@ HttpServerSession::do_io_close(int alerrno)
char addrbuf[INET6_ADDRSTRLEN];
Debug("http_ss", "[%" PRId64 "] connection closed, ip: %s, count: %u",
con_id,
- ink_inet_ntop(&server_ip.sa, addrbuf, sizeof(addrbuf)),
+ ats_ip_ntop(&server_ip.sa, addrbuf, sizeof(addrbuf)),
connection_count->getCount(server_ip));
} else {
Error("[%" PRId64 "] number of connections should be greater then zero: %u",
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/proxy/http/HttpServerSession.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpServerSession.h b/proxy/http/HttpServerSession.h
index 82ddb2f..8078158 100644
--- a/proxy/http/HttpServerSession.h
+++ b/proxy/http/HttpServerSession.h
@@ -114,7 +114,7 @@ public:
};
// Keys for matching hostnames
- ts_ip_endpoint server_ip;
+ IpEndpoint server_ip;
INK_MD5 hostname_hash;
bool host_hash_computed;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/proxy/http/HttpSessionManager.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpSessionManager.cc b/proxy/http/HttpSessionManager.cc
index f341e71..c49e0e9 100644
--- a/proxy/http/HttpSessionManager.cc
+++ b/proxy/http/HttpSessionManager.cc
@@ -36,8 +36,8 @@
#include "HttpSM.h"
#include "HttpDebugNames.h"
-#define FIRST_LEVEL_HASH(x) ink_inet_hash(x) % HSM_LEVEL1_BUCKETS
-#define SECOND_LEVEL_HASH(x) ink_inet_hash(x) % HSM_LEVEL2_BUCKETS
+#define FIRST_LEVEL_HASH(x) ats_ip_hash(x) % HSM_LEVEL1_BUCKETS
+#define SECOND_LEVEL_HASH(x) ats_ip_hash(x) % HSM_LEVEL2_BUCKETS
// Initialize a thread to handle HTTP session management
void
@@ -190,8 +190,8 @@ _acquire_session(SessionBucket *bucket, sockaddr const* ip, INK_MD5 &hostname_ha
// the 2nd level bucket
b = bucket->l2_hash[l2_index].head;
while (b != NULL) {
- if (ink_inet_eq(&b->server_ip.sa, ip) &&
- ink_inet_port_cast(ip) == ink_inet_port_cast(&b->server_ip)
+ if (ats_ip_addr_eq(&b->server_ip.sa, ip) &&
+ ats_ip_port_cast(ip) == ats_ip_port_cast(&b->server_ip)
) {
if (hostname_hash == b->hostname_hash) {
bucket->lru_list.remove(b);
@@ -236,8 +236,8 @@ HttpSessionManager::acquire_session(Continuation *cont, sockaddr const* ip,
if (to_return != NULL) {
ua_session->attach_server_session(NULL);
- if (ink_inet_eq(&to_return->server_ip.sa, ip) &&
- ink_inet_port_cast(&to_return->server_ip) == ink_inet_port_cast(ip)
+ if (ats_ip_addr_eq(&to_return->server_ip.sa, ip) &&
+ ats_ip_port_cast(&to_return->server_ip) == ats_ip_port_cast(ip)
) {
if (!hash_computed) {
ink_code_MMH((unsigned char *) hostname, strlen(hostname), (unsigned char *) &hostname_hash);