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
[5/8] git commit: TS-995 changes.
TS-995 changes.
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/47d1f8ec
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/47d1f8ec
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/47d1f8ec
Branch: refs/heads/master
Commit: 47d1f8ec485db09892715ef5f6a4638fd006319b
Parents: c2cd672
Author: Alan M. Carroll <am...@network-geographics.com>
Authored: Tue Feb 21 09:55:03 2012 -0600
Committer: Alan M. Carroll <am...@network-geographics.com>
Committed: Tue Feb 21 09:55:03 2012 -0600
----------------------------------------------------------------------
iocore/dns/DNS.cc | 84 +++---
iocore/dns/DNSConnection.cc | 26 +-
iocore/dns/I_DNSProcessor.h | 6 +-
iocore/dns/P_DNSConnection.h | 2 +-
iocore/dns/P_DNSProcessor.h | 8 +-
iocore/dns/P_SplitDNSProcessor.h | 2 +-
iocore/dns/SplitDNS.cc | 12 +-
iocore/hostdb/HostDB.cc | 110 ++++----
iocore/hostdb/I_HostDBProcessor.h | 20 +-
iocore/hostdb/P_HostDBProcessor.h | 18 +-
iocore/net/Connection.cc | 16 +-
iocore/net/I_NetProcessor.h | 10 +-
iocore/net/I_NetVConnection.h | 8 +-
iocore/net/I_UDPNet.h | 2 +-
iocore/net/I_UDPPacket.h | 4 +-
iocore/net/P_Connection.h | 20 +-
iocore/net/P_NetVConnection.h | 18 +-
iocore/net/P_Socks.h | 6 +-
iocore/net/P_UDPConnection.h | 8 +-
iocore/net/P_UDPNet.h | 6 +-
iocore/net/P_UDPPacket.h | 8 +-
iocore/net/P_UnixNetVConnection.h | 4 +-
iocore/net/SSLNetVConnection.cc | 4 +-
iocore/net/Socks.cc | 34 +-
iocore/net/UnixConnection.cc | 20 +-
iocore/net/UnixNetAccept.cc | 10 +-
iocore/net/UnixNetPages.cc | 16 +-
iocore/net/UnixNetProcessor.cc | 16 +-
iocore/net/UnixUDPNet.cc | 44 ++--
iocore/utils/I_Machine.h | 6 +-
iocore/utils/Machine.cc | 36 +-
lib/records/I_RecHttp.h | 16 +-
lib/records/RecHttp.cc | 20 +-
lib/ts/IpMap.cc | 38 ++--
lib/ts/IpMap.h | 20 +-
lib/ts/IpMapConf.cc | 4 +-
lib/ts/IpMapTest.cc | 26 +-
lib/ts/MatcherUtils.cc | 30 +-
lib/ts/MatcherUtils.h | 2 +-
lib/ts/ink_inet.cc | 120 +++----
lib/ts/ink_inet.h | 480 ++++++++++++++--------------
lib/ts/ink_res_init.cc | 22 +-
lib/ts/ink_resolver.h | 4 +-
mgmt/LocalManager.cc | 14 +-
mgmt/LocalManager.h | 4 +-
mgmt/utils/MgmtUtils.cc | 22 +--
mgmt/utils/MgmtUtils.h | 1 -
proxy/ControlBase.cc | 12 +-
proxy/ControlMatcher.cc | 6 +-
proxy/ControlMatcher.h | 4 +-
proxy/CoreUtils.cc | 4 +-
proxy/FetchSM.cc | 4 +-
proxy/ICP.cc | 78 +++---
proxy/ICP.h | 48 ++--
proxy/ICPConfig.cc | 50 ++--
proxy/IPAllow.cc | 10 +-
proxy/IPAllow.h | 4 +-
proxy/InkAPI.cc | 50 ++--
proxy/InkAPITest.cc | 34 +-
proxy/InkAPITestTool.cc | 4 +-
proxy/InkIOCoreAPI.cc | 10 +-
proxy/Main.cc | 2 +-
proxy/ParentSelection.cc | 16 +-
proxy/PluginVC.cc | 12 +-
proxy/PluginVC.h | 4 +-
proxy/Prefetch.cc | 50 ++--
proxy/Prefetch.h | 22 +-
proxy/SimpleHttp.cc | 4 +-
proxy/Update.cc | 2 +-
proxy/api/ts/InkAPIHughes.h | 4 +-
proxy/congest/Congestion.cc | 12 +-
proxy/congest/Congestion.h | 2 +-
proxy/congest/CongestionDB.cc | 10 +-
proxy/congest/CongestionTest.cc | 14 +-
proxy/http/HttpAccept.cc | 4 +-
proxy/http/HttpAccept.h | 12 +-
proxy/http/HttpClientSession.h | 4 +-
proxy/http/HttpConfig.h | 4 +-
proxy/http/HttpConnectionCount.h | 14 +-
proxy/http/HttpSM.cc | 46 ++--
proxy/http/HttpServerSession.cc | 4 +-
proxy/http/HttpServerSession.h | 2 +-
proxy/http/HttpSessionManager.cc | 12 +-
proxy/http/HttpTransact.cc | 74 +++---
proxy/http/HttpTransact.h | 2 +-
proxy/http/HttpUpdateSM.cc | 2 +-
proxy/http/remap/AclFiltering.cc | 4 +-
proxy/http/remap/AclFiltering.h | 8 +-
proxy/http/remap/RemapProcessor.cc | 4 +-
proxy/http/remap/UrlRewrite.cc | 2 +-
proxy/logging/LogAccess.cc | 24 +-
proxy/logging/LogAccess.h | 2 +-
proxy/logging/LogAccessHttp.cc | 4 +-
proxy/logging/LogAccessTest.cc | 8 +-
proxy/logging/LogCollationClientSM.cc | 4 +-
95 files changed, 1038 insertions(+), 1081 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/iocore/dns/DNS.cc
----------------------------------------------------------------------
diff --git a/iocore/dns/DNS.cc b/iocore/dns/DNS.cc
index e84825b..0611fab 100644
--- a/iocore/dns/DNS.cc
+++ b/iocore/dns/DNS.cc
@@ -65,11 +65,11 @@ namespace {
}
inline void set_loopback(sockaddr* addr) {
if (prefer_ipv6_p())
- ink_inet_ip6_set(addr, in6addr_loopback, htons(DOMAIN_SERVICE_PORT));
+ ats_ip6_set(addr, in6addr_loopback, htons(DOMAIN_SERVICE_PORT));
else
- ink_inet_ip4_set(addr, htonl(INADDR_LOOPBACK), htons(DOMAIN_SERVICE_PORT));
+ ats_ip4_set(addr, htonl(INADDR_LOOPBACK), htons(DOMAIN_SERVICE_PORT));
}
- inline void set_loopback(ts_ip_endpoint* ip) {
+ inline void set_loopback(IpEndpoint* ip) {
set_loopback(&ip->sa);
}
}
@@ -226,13 +226,13 @@ DNSProcessor::open(sockaddr const* target, int aoptions)
h->options = aoptions;
h->mutex = thread->mutex;
h->m_res = &l_res;
- ink_inet_copy(&h->local_ipv4.sa, &local_ipv4.sa);
- ink_inet_copy(&h->local_ipv6.sa, &local_ipv6.sa);
+ ats_ip_copy(&h->local_ipv4.sa, &local_ipv4.sa);
+ ats_ip_copy(&h->local_ipv6.sa, &local_ipv6.sa);
if (target)
- ink_inet_copy(&h->ip, target);
+ ats_ip_copy(&h->ip, target);
else
- ink_inet_invalidate(&h->ip); // marked to use default.
+ ats_ip_invalidate(&h->ip); // marked to use default.
if (!dns_handler_initialized)
handler = h;
@@ -251,7 +251,7 @@ DNSProcessor::dns_init()
Debug("dns", "localhost=%s\n", try_server_names[0]);
Debug("dns", "Round-robin nameservers = %d\n", dns_ns_rr);
- ts_ip_endpoint nameserver[MAX_NAMED];
+ IpEndpoint nameserver[MAX_NAMED];
size_t nserv = 0;
if (dns_ns_list) {
@@ -287,7 +287,7 @@ DNSProcessor::dns_init()
}
}
- if (!err && 0 != ink_inet_pton(ns, &nameserver[nserv].sa)) {
+ if (!err && 0 != ats_ip_pton(ns, &nameserver[nserv].sa)) {
Debug("dns", "Invalid IP address given for nameserver '%s', discarding", ns);
Warning("Invalid IP address given for nameserver '%s', discarding", ns);
err = true;
@@ -296,10 +296,10 @@ DNSProcessor::dns_init()
if (!err) {
ip_port_text_buffer buff;
- ink_inet_port_cast(&nameserver[nserv].sa) = htons(prt);
+ ats_ip_port_cast(&nameserver[nserv].sa) = htons(prt);
Debug("dns", "Adding nameserver %s to nameserver list",
- ink_inet_nptop(&nameserver[nserv].sa, buff, sizeof(buff))
+ ats_ip_nptop(&nameserver[nserv].sa, buff, sizeof(buff))
);
++nserv;
}
@@ -316,21 +316,21 @@ DNSProcessor::dns_init()
// Check for local forced bindings.
if (dns_local_ipv6) {
- if (0 != ink_inet_pton(dns_local_ipv6, &local_ipv6)) {
- ink_inet_invalidate(&local_ipv6);
+ if (0 != ats_ip_pton(dns_local_ipv6, &local_ipv6)) {
+ ats_ip_invalidate(&local_ipv6);
Warning("Invalid IP address '%s' for dns.local_ipv6 value, discarding.", dns_local_ipv6);
- } else if (!ink_inet_is_ip6(&local_ipv6.sa)) {
- ink_inet_invalidate(&local_ipv6);
+ } else if (!ats_is_ip6(&local_ipv6.sa)) {
+ ats_ip_invalidate(&local_ipv6);
Warning("IP address '%s' for dns.local_ipv6 value was not IPv6, discarding.", dns_local_ipv6);
}
}
if (dns_local_ipv4) {
- if (0 != ink_inet_pton(dns_local_ipv4, &local_ipv4)) {
- ink_inet_invalidate(&local_ipv4);
+ if (0 != ats_ip_pton(dns_local_ipv4, &local_ipv4)) {
+ ats_ip_invalidate(&local_ipv4);
Warning("Invalid IP address '%s' for dns.local_ipv4 value, discarding.", dns_local_ipv4);
- } else if (!ink_inet_is_ip4(&local_ipv4.sa)) {
- ink_inet_invalidate(&local_ipv4);
+ } else if (!ats_is_ip4(&local_ipv4.sa)) {
+ ats_ip_invalidate(&local_ipv4);
Warning("IP address '%s' for dns.local_ipv4 value was not IPv4, discarding.", dns_local_ipv4);
}
}
@@ -394,10 +394,10 @@ DNSEntry::init(const char *x, int len, int qtype_arg,
}
} else { //T_PTR
sockaddr const* ip = reinterpret_cast<sockaddr const*>(x);
- if (ink_inet_is_ip6(ip))
- make_ipv6_ptr(&ink_inet_ip6_addr_cast(ip), qname);
- else if (ink_inet_is_ip4(ip))
- make_ipv4_ptr(ink_inet_ip4_addr_cast(ip), qname);
+ if (ats_is_ip6(ip))
+ make_ipv6_ptr(&ats_ip6_addr_cast(ip), qname);
+ else if (ats_is_ip4(ip))
+ make_ipv4_ptr(ats_ip4_addr_cast(ip), qname);
else
ink_assert(!"T_PTR query to DNS must be IP address.");
}
@@ -417,12 +417,12 @@ DNSHandler::open_con(sockaddr const* target, bool failed, int icon)
PollDescriptor *pd = get_PollDescriptor(dnsProcessor.thread);
if (!icon && target) {
- ink_inet_copy(&ip, target);
+ ats_ip_copy(&ip, target);
} else if (!target) {
target = &ip.sa;
}
- Debug("dns", "open_con: opening connection %s", ink_inet_nptop(target, ip_text, sizeof ip_text));
+ Debug("dns", "open_con: opening connection %s", ats_ip_nptop(target, ip_text, sizeof ip_text));
if (con[icon].fd != NO_FD) { // Remove old FD from epoll fd
con[icon].eio.stop();
@@ -459,10 +459,10 @@ DNSHandler::open_con(sockaddr const* target, bool failed, int icon)
void
DNSHandler::validate_ip() {
- if (!ink_inet_is_ip(&ip.sa)) {
+ if (!ats_is_ip(&ip.sa)) {
// Invalid, switch to default.
// seems that res_init always sets m_res.nscount to at least 1!
- if (!m_res->nscount || !ink_inet_copy(&ip.sa, &m_res->nsaddr_list[0].sa)) {
+ if (!m_res->nscount || !ats_ip_copy(&ip.sa, &m_res->nsaddr_list[0].sa)) {
Warning("bad nameserver config, fallback to %s loopback",
prefer_ipv6_p() ? "IPv6" : "IPv4"
);
@@ -500,11 +500,11 @@ DNSHandler::startEvent(int event, Event *e)
for (int i = 0; i < max_nscount; i++) {
ip_port_text_buffer buff;
sockaddr *sa = &m_res->nsaddr_list[i].sa;
- if (ink_inet_is_ip(sa)) {
+ if (ats_is_ip(sa)) {
open_con(sa, false, n_con);
++n_con;
Debug("dns_pas", "opened connection to %s, n_con = %d",
- ink_inet_nptop(sa, buff, sizeof(buff)),
+ ats_ip_nptop(sa, buff, sizeof(buff)),
n_con
);
}
@@ -555,7 +555,7 @@ void
DNSHandler::recover()
{
ip_text_buffer buff;
- Warning("connection to DNS server %s restored", ink_inet_ntop(&ip.sa, buff, sizeof(buff)));
+ Warning("connection to DNS server %s restored", ats_ip_ntop(&ip.sa, buff, sizeof(buff)));
name_server = 0;
switch_named(name_server);
}
@@ -639,15 +639,15 @@ DNSHandler::failover()
name_server = (name_server + 1) % max_nscount;
Debug("dns", "failover: failing over to name_server=%d", name_server);
- ts_ip_endpoint target;
- ink_inet_copy(&target.sa, &m_res->nsaddr_list[name_server].sa);
+ IpEndpoint target;
+ ats_ip_copy(&target.sa, &m_res->nsaddr_list[name_server].sa);
Warning("failover: connection to DNS server %s lost, move to %s",
- ink_inet_ntop(old_addr, buff1, sizeof(buff1)),
- ink_inet_ntop(&target.sa, buff2, sizeof(buff2))
+ ats_ip_ntop(old_addr, buff1, sizeof(buff1)),
+ ats_ip_ntop(&target.sa, buff2, sizeof(buff2))
);
- if (!ink_inet_is_ip(&target.sa)) set_loopback(&target.sa);
+ if (!ats_is_ip(&target.sa)) set_loopback(&target.sa);
open_con(&target.sa, true, name_server);
if (n_con <= name_server)
@@ -656,7 +656,7 @@ DNSHandler::failover()
} else {
ip_text_buffer buff;
Warning("failover: connection to DNS server %s lost, retrying",
- ink_inet_ntop(&ip.sa, buff, sizeof(buff))
+ ats_ip_ntop(&ip.sa, buff, sizeof(buff))
);
}
}
@@ -672,7 +672,7 @@ DNSHandler::rr_failure(int ndx)
Debug("dns", "rr_failure: Marking nameserver %d as down", ndx);
ns_down[ndx] = 1;
Warning("connection to DNS server %s lost, marking as down",
- ink_inet_ntop(&m_res->nsaddr_list[ndx].sa, buff, sizeof(buff))
+ ats_ip_ntop(&m_res->nsaddr_list[ndx].sa, buff, sizeof(buff))
);
}
@@ -740,7 +740,7 @@ DNSHandler::recv_dns(int event, Event *e)
while ((dnsc = (DNSConnection *) triggered.dequeue())) {
while (1) {
- ts_ip_endpoint from_ip;
+ IpEndpoint from_ip;
socklen_t from_length = sizeof(from_ip);
if (!hostent_cache)
@@ -761,10 +761,10 @@ DNSHandler::recv_dns(int event, Event *e)
}
// verify that this response came from the correct server
- if (!ink_inet_eq(&dnsc->ip.sa, &from_ip.sa)) {
+ if (!ats_ip_addr_eq(&dnsc->ip.sa, &from_ip.sa)) {
Warning("unexpected DNS response from %s (expected %s)",
- ink_inet_ntop(&from_ip.sa, ipbuff1, sizeof ipbuff1),
- ink_inet_ntop(&dnsc->ip.sa, ipbuff2, sizeof ipbuff2)
+ ats_ip_ntop(&from_ip.sa, ipbuff1, sizeof ipbuff1),
+ ats_ip_ntop(&dnsc->ip.sa, ipbuff2, sizeof ipbuff2)
);
continue;
}
@@ -777,7 +777,7 @@ DNSHandler::recv_dns(int event, Event *e)
received_one(dnsc->num);
if (ns_down[dnsc->num]) {
Warning("connection to DNS server %s restored",
- ink_inet_ntop(&m_res->nsaddr_list[dnsc->num].sa, ipbuff1, sizeof ipbuff1)
+ ats_ip_ntop(&m_res->nsaddr_list[dnsc->num].sa, ipbuff1, sizeof ipbuff1)
);
ns_down[dnsc->num] = 0;
}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/iocore/dns/DNSConnection.cc
----------------------------------------------------------------------
diff --git a/iocore/dns/DNSConnection.cc b/iocore/dns/DNSConnection.cc
index 92132e5..3003a6e 100644
--- a/iocore/dns/DNSConnection.cc
+++ b/iocore/dns/DNSConnection.cc
@@ -85,12 +85,12 @@ DNSConnection::connect(sockaddr const* addr, Options const& opt)
// bool non_blocking_connect, bool use_tcp, bool non_blocking, bool bind_random_port)
{
ink_assert(fd == NO_FD);
- ink_assert(ink_inet_is_ip(addr));
+ ink_assert(ats_is_ip(addr));
int res = 0;
short Proto;
uint8_t af = addr->sa_family;
- ts_ip_endpoint bind_addr;
+ IpEndpoint bind_addr;
size_t bind_size = 0;
if (opt._use_tcp) {
@@ -109,15 +109,15 @@ DNSConnection::connect(sockaddr const* addr, Options const& opt)
bind_addr.sa.sa_family = af;
if (AF_INET6 == af) {
- if (ink_inet_is_ip6(opt._local_ipv6)) {
- ink_inet_copy(&bind_addr.sa, opt._local_ipv6);
+ if (ats_is_ip6(opt._local_ipv6)) {
+ ats_ip_copy(&bind_addr.sa, opt._local_ipv6);
} else {
bind_addr.sin6.sin6_addr = in6addr_any;
}
bind_size = sizeof(sockaddr_in6);
} else if (AF_INET == af) {
- if (ink_inet_is_ip4(opt._local_ipv4))
- ink_inet_copy(&bind_addr.sa, opt._local_ipv4);
+ if (ats_is_ip4(opt._local_ipv4))
+ ats_ip_copy(&bind_addr.sa, opt._local_ipv4);
else
bind_addr.sin.sin_addr.s_addr = INADDR_ANY;
bind_size = sizeof(sockaddr_in);
@@ -127,7 +127,7 @@ DNSConnection::connect(sockaddr const* addr, Options const& opt)
if (opt._bind_random_port) {
int retries = 0;
- ts_ip_endpoint bind_addr;
+ IpEndpoint bind_addr;
size_t bind_size = 0;
memset(&bind_addr, 0, sizeof bind_addr);
bind_addr.sa.sa_family = af;
@@ -142,8 +142,8 @@ DNSConnection::connect(sockaddr const* addr, Options const& opt)
ip_port_text_buffer b;
uint32_t p = generator.random();
p = static_cast<uint16_t>((p % (LAST_RANDOM_PORT - FIRST_RANDOM_PORT)) + FIRST_RANDOM_PORT);
- ink_inet_port_cast(&bind_addr.sa) = htons(p); // stuff port in sockaddr.
- Debug("dns", "random port = %s\n", ink_inet_nptop(&bind_addr.sa, b, sizeof b));
+ ats_ip_port_cast(&bind_addr.sa) = htons(p); // stuff port in sockaddr.
+ Debug("dns", "random port = %s\n", ats_ip_nptop(&bind_addr.sa, b, sizeof b));
if ((res = socketManager.ink_bind(fd, &bind_addr.sa, bind_size, Proto)) < 0) {
continue;
}
@@ -151,11 +151,11 @@ DNSConnection::connect(sockaddr const* addr, Options const& opt)
}
Warning("unable to bind random DNS port");
Lok:;
- } else if (ink_inet_is_ip(&bind_addr.sa)) {
+ } else if (ats_is_ip(&bind_addr.sa)) {
ip_text_buffer b;
res = socketManager.ink_bind(fd, &bind_addr.sa, bind_size, Proto);
if (res < 0) Warning("Unable to bind local address to %s.",
- ink_inet_ntop(&bind_addr.sa, b, sizeof b));
+ ats_ip_ntop(&bind_addr.sa, b, sizeof b));
}
if (opt._non_blocking_connect)
@@ -177,8 +177,8 @@ DNSConnection::connect(sockaddr const* addr, Options const& opt)
goto Lerror;
#endif
- ink_inet_copy(&ip.sa, addr);
- res =::connect(fd, addr, ink_inet_ip_size(addr));
+ ats_ip_copy(&ip.sa, addr);
+ res =::connect(fd, addr, ats_ip_size(addr));
if (!res || ((res < 0) && (errno == EINPROGRESS || errno == EWOULDBLOCK))) {
if (!opt._non_blocking_connect && opt._non_blocking_io)
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/iocore/dns/I_DNSProcessor.h
----------------------------------------------------------------------
diff --git a/iocore/dns/I_DNSProcessor.h b/iocore/dns/I_DNSProcessor.h
index 51e7e47..2375178 100644
--- a/iocore/dns/I_DNSProcessor.h
+++ b/iocore/dns/I_DNSProcessor.h
@@ -98,8 +98,8 @@ struct DNSProcessor: public Processor
EThread *thread;
DNSHandler *handler;
ts_imp_res_state l_res;
- ts_ip_endpoint local_ipv6;
- ts_ip_endpoint local_ipv4;
+ IpEndpoint local_ipv6;
+ IpEndpoint local_ipv4;
Action *getby(const char *x, int len, int type, Continuation *cont, DNSHandler *adnsH = NULL, int timeout = 0);
void dns_init();
};
@@ -136,7 +136,7 @@ inline Action *
DNSProcessor::gethostbyaddr(Continuation *cont, in_addr_t addr, int timeout)
{
sockaddr_in ip;
- ink_inet_ip4_set(&ip, addr);
+ ats_ip4_set(&ip, addr);
return getby(reinterpret_cast<char const*>(&ip), 0, T_PTR, cont, NULL, timeout);
}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/iocore/dns/P_DNSConnection.h
----------------------------------------------------------------------
diff --git a/iocore/dns/P_DNSConnection.h b/iocore/dns/P_DNSConnection.h
index 285e648..48f699e 100644
--- a/iocore/dns/P_DNSConnection.h
+++ b/iocore/dns/P_DNSConnection.h
@@ -92,7 +92,7 @@ struct DNSConnection {
};
int fd;
- ts_ip_endpoint ip;
+ IpEndpoint ip;
int num;
LINK(DNSConnection, link);
EventIO eio;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/iocore/dns/P_DNSProcessor.h
----------------------------------------------------------------------
diff --git a/iocore/dns/P_DNSProcessor.h b/iocore/dns/P_DNSProcessor.h
index d4a584b..3f74082 100644
--- a/iocore/dns/P_DNSProcessor.h
+++ b/iocore/dns/P_DNSProcessor.h
@@ -199,9 +199,9 @@ struct DNSEntry;
struct DNSHandler: public Continuation
{
/// This is used as the target if round robin isn't set.
- ts_ip_endpoint ip;
- ts_ip_endpoint local_ipv6; ///< Local V6 address if set.
- ts_ip_endpoint local_ipv4; ///< Local V4 address if set.
+ IpEndpoint ip;
+ IpEndpoint local_ipv6; ///< Local V6 address if set.
+ IpEndpoint local_ipv4; ///< Local V4 address if set.
int ifd[MAX_NAMED];
int n_con;
DNSConnection con[MAX_NAMED];
@@ -296,7 +296,7 @@ TS_INLINE DNSHandler::DNSHandler()
hostent_cache(0), last_primary_retry(0), last_primary_reopen(0),
m_res(0), txn_lookup_timeout(0), generator((uint32_t)((uintptr_t)time(NULL) ^ (uintptr_t)this))
{
- ink_inet_invalidate(&ip);
+ ats_ip_invalidate(&ip);
for (int i = 0; i < MAX_NAMED; i++) {
ifd[i] = -1;
failover_number[i] = 0;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/iocore/dns/P_SplitDNSProcessor.h
----------------------------------------------------------------------
diff --git a/iocore/dns/P_SplitDNSProcessor.h b/iocore/dns/P_SplitDNSProcessor.h
index ce23a94..38ce322 100644
--- a/iocore/dns/P_SplitDNSProcessor.h
+++ b/iocore/dns/P_SplitDNSProcessor.h
@@ -162,7 +162,7 @@ TS_INLINE bool SplitDNSConfig::isSplitDNSEnabled()
-------------------------------------------------------------- */
struct DNSServer
{
- ts_ip_endpoint x_server_ip[MAXNS];
+ IpEndpoint x_server_ip[MAXNS];
char x_dns_ip_line[MAXDNAME * 2];
char x_def_domain[MAXDNAME];
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/iocore/dns/SplitDNS.cc
----------------------------------------------------------------------
diff --git a/iocore/dns/SplitDNS.cc b/iocore/dns/SplitDNS.cc
index 9609adb..871e898 100644
--- a/iocore/dns/SplitDNS.cc
+++ b/iocore/dns/SplitDNS.cc
@@ -364,11 +364,11 @@ SplitDNSRecord::ProcessDNSHosts(char *val)
*tmp = 0;
}
- if (0 != ink_inet_pton(current, &m_servers.x_server_ip[i].sa)) {
+ if (0 != ats_ip_pton(current, &m_servers.x_server_ip[i].sa)) {
return "invalid IP address given for a DNS server";
}
- ink_inet_port_cast(&m_servers.x_server_ip[i].sa) = htons(port ? port : NAMESERVER_PORT);
+ ats_ip_port_cast(&m_servers.x_server_ip[i].sa) = htons(port ? port : NAMESERVER_PORT);
if ((MAXDNAME * 2 - 1) > totsz) {
sz = strlen(current);
@@ -503,7 +503,7 @@ SplitDNSRecord::Init(matcher_line * line_info)
}
}
- if (!ink_inet_is_ip(&m_servers.x_server_ip[0].sa)) {
+ if (!ats_is_ip(&m_servers.x_server_ip[0].sa)) {
snprintf(errBuf, errBufLen, "%s No server specified in splitdns.config at line %d", modulePrefix, line_num);
return errBuf;
}
@@ -517,7 +517,7 @@ SplitDNSRecord::Init(matcher_line * line_info)
char ab[INET6_ADDRPORTSTRLEN];
snprintf(errBuf, errBufLen,
"Failed to build res record for the servers %s ...",
- ink_inet_ntop(&m_servers.x_server_ip[0].sa, ab, sizeof ab)
+ ats_ip_ntop(&m_servers.x_server_ip[0].sa, ab, sizeof ab)
);
return errBuf;
}
@@ -525,7 +525,7 @@ SplitDNSRecord::Init(matcher_line * line_info)
dnsH->m_res = res;
dnsH->mutex = SplitDNSConfig::dnsHandler_mutex;
dnsH->options = res->options;
- ink_inet_invalidate(&dnsH->ip.sa); // Mark to use default DNS.
+ ats_ip_invalidate(&dnsH->ip.sa); // Mark to use default DNS.
m_servers.x_dnsH = dnsH;
@@ -576,7 +576,7 @@ SplitDNSRecord::Print()
{
for (int i = 0; i < m_dnsSrvr_cnt; i++) {
char ab[INET6_ADDRPORTSTRLEN];
- Debug("splitdns_config", " %s ", ink_inet_ntop(&m_servers.x_server_ip[i].sa, ab, sizeof ab));
+ Debug("splitdns_config", " %s ", ats_ip_ntop(&m_servers.x_server_ip[i].sa, ab, sizeof ab));
}
}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/iocore/hostdb/HostDB.cc
----------------------------------------------------------------------
diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
index 22e5616..2ed6e40 100644
--- a/iocore/hostdb/HostDB.cc
+++ b/iocore/hostdb/HostDB.cc
@@ -103,10 +103,10 @@ ip_addr_set(
void* ptr ///< Raw address data
) {
if (AF_INET6 == af)
- ink_inet_ip6_set(ip, *static_cast<in6_addr*>(ptr));
+ ats_ip6_set(ip, *static_cast<in6_addr*>(ptr));
else if (AF_INET == af)
- ink_inet_ip4_set(ip, *static_cast<in_addr_t*>(ptr));
- else ink_inet_invalidate(ip);
+ ats_ip4_set(ip, *static_cast<in_addr_t*>(ptr));
+ else ats_ip_invalidate(ip);
}
inline void
@@ -176,7 +176,7 @@ HostDBCache::rebuild_callout(HostDBInfo * e, RebuildMC & r)
for (int i = 0; i < rr->good; i++) {
if (!valid_heap_pointer(((char *) &rr->info[i + 1]) - 1))
return -1;
- if (!ink_inet_is_ip(rr->info[i].ip()))
+ if (!ats_is_ip(rr->info[i].ip()))
return corrupt_debugging_callout(e, r);
if (rr->info[i].md5_high != e->md5_high ||
rr->info[i].md5_low != e->md5_low || rr->info[i].md5_low_low != e->md5_low_low)
@@ -462,7 +462,7 @@ HostDBContinuation::init(
dns_lookup_timeout = timeout;
namelen = len;
is_srv_lookup = is_srv;
- ink_inet_copy(&ip.sa, aip);
+ ats_ip_copy(&ip.sa, aip);
md5 = amd5;
mutex = hostDB.lock_for_bucket((int) (fold_md5(md5) % hostDB.buckets));
m_pDS = pDS;
@@ -538,7 +538,7 @@ reply_to_cont(Continuation * cont, HostDBInfo * ar)
goto Lerror;
}
ip_text_buffer ipb;
- Debug("hostdb", "RR of %d with %d good, 1st IP = %s", r->rr()->n, r->rr()->good, ink_inet_ntop(r->ip(), ipb, sizeof ipb));
+ Debug("hostdb", "RR of %d with %d good, 1st IP = %s", r->rr()->n, r->rr()->good, ats_ip_ntop(r->ip(), ipb, sizeof ipb));
}
if (r->is_srv && r->srv_count) {
cont->handleEvent(EVENT_SRV_LOOKUP, r);
@@ -671,7 +671,7 @@ HostDBProcessor::getby(Continuation * cont,
void *pDS = 0;
EThread *thread = this_ethread();
ProxyMutex *mutex = thread->mutex;
- unsigned short port = ink_inet_get_port(ip);
+ unsigned short port = ats_ip_port_host_order(ip);
ip_text_buffer ipb;
HOSTDB_INCREMENT_DYN_STAT(hostdb_total_lookups_stat);
@@ -713,10 +713,10 @@ HostDBProcessor::getby(Continuation * cont,
//
uint8_t buff[INK_IP6_SIZE+4];
memset(buff, 0, sizeof(buff));
- if (ink_inet_is_ip4(ip))
- memcpy(buff+2, &ink_inet_ip4_addr_cast(ip), sizeof(in_addr_t));
- else if (ink_inet_is_ip6(ip))
- memcpy(buff+2, &ink_inet_ip6_addr_cast(ip), sizeof(in6_addr));
+ if (ats_is_ip4(ip))
+ memcpy(buff+2, &ats_ip4_addr_cast(ip), sizeof(in_addr_t));
+ else if (ats_is_ip6(ip))
+ memcpy(buff+2, &ats_ip6_addr_cast(ip), sizeof(in6_addr));
md5.encodeBuffer(buff, sizeof buff);
}
@@ -737,7 +737,7 @@ HostDBProcessor::getby(Continuation * cont,
if (r) {
Debug("hostdb", "immediate answer for %s",
hostname ? hostname
- : ink_inet_is_ip(ip) ? ink_inet_ntop(ip, ipb, sizeof ipb)
+ : ats_is_ip(ip) ? ats_ip_ntop(ip, ipb, sizeof ipb)
: "<null>"
);
HOSTDB_INCREMENT_DYN_STAT(hostdb_total_hits_stat);
@@ -748,7 +748,7 @@ HostDBProcessor::getby(Continuation * cont,
}
Debug("hostdb", "delaying force %d answer for %s", aforce_dns,
hostname ? hostname
- : ink_inet_is_ip(ip) ? ink_inet_ntop(ip, ipb, sizeof ipb)
+ : ats_is_ip(ip) ? ats_ip_ntop(ip, ipb, sizeof ipb)
: "<null>"
);
@@ -784,7 +784,7 @@ HostDBProcessor::getbyname_re(Continuation * cont, const char *ahostname, int le
ProxyMutex *mutex = thread->mutex;
sockaddr_in ip;
- ink_inet_ip4_set(&ip, INADDR_ANY, htons(port));
+ ats_ip4_set(&ip, INADDR_ANY, htons(port));
if (flags & HOSTDB_FORCE_DNS_ALWAYS)
force_dns = true;
@@ -793,7 +793,7 @@ HostDBProcessor::getbyname_re(Continuation * cont, const char *ahostname, int le
if (force_dns)
HOSTDB_INCREMENT_DYN_STAT(hostdb_re_dns_on_reload_stat);
}
- return getby(cont, ahostname, len, ink_inet_sa_cast(&ip), force_dns);
+ return getby(cont, ahostname, len, ats_ip_sa_cast(&ip), force_dns);
}
@@ -826,7 +826,7 @@ HostDBProcessor::getSRVbyname_imm(Continuation * cont, process_srv_info_pfn proc
}
sockaddr_in ip;
- ink_inet_ip4_set(&ip, INADDR_ANY, htons(port));
+ ats_ip4_set(&ip, INADDR_ANY, htons(port));
if (!len)
len = strlen(hostname);
@@ -841,7 +841,7 @@ HostDBProcessor::getSRVbyname_imm(Continuation * cont, process_srv_info_pfn proc
// If we can get the lock and a level 1 probe succeeds, return
if (lock) {
- HostDBInfo *r = probe(bucket_mutex, md5, hostname, len, ink_inet_sa_cast(&ip), pDS, false, true);
+ HostDBInfo *r = probe(bucket_mutex, md5, hostname, len, ats_ip_sa_cast(&ip), pDS, false, true);
if (r) {
Debug("hostdb", "immediate SRV answer for %s from hostdb", hostname);
Debug("dns_srv", "immediate SRV answer for %s from hostdb", hostname);
@@ -856,7 +856,7 @@ HostDBProcessor::getSRVbyname_imm(Continuation * cont, process_srv_info_pfn proc
// Otherwise, create a continuation to do a deeper probe in the background
HostDBContinuation *c = hostDBContAllocator.alloc();
- c->init(hostname, len, ink_inet_sa_cast(&ip), md5, cont, pDS, true, dns_lookup_timeout);
+ c->init(hostname, len, ats_ip_sa_cast(&ip), md5, cont, pDS, true, dns_lookup_timeout);
c->force_dns = force_dns;
SET_CONTINUATION_HANDLER(c, (HostDBContHandler) & HostDBContinuation::probeEvent);
@@ -881,8 +881,8 @@ HostDBProcessor::getbyname_imm(Continuation * cont, process_hostdb_info_pfn proc
EThread *thread = cont->mutex->thread_holding;
ProxyMutex *mutex = thread->mutex;
sockaddr_in ip_store;
- sockaddr* ip = ink_inet_sa_cast(&ip_store);
- ink_inet_ip4_set(ip, INADDR_ANY, htons(port));
+ sockaddr* ip = ats_ip_sa_cast(&ip_store);
+ ats_ip4_set(ip, INADDR_ANY, htons(port));
if (flags & HOSTDB_FORCE_DNS_ALWAYS)
force_dns = true;
@@ -965,7 +965,7 @@ do_setby(HostDBInfo * r, HostDBApplicationInfo * app, const char *hostname, sock
if (rr) {
ink_assert(hostname);
for (int i = 0; i < rr->n; i++) {
- if (0 == ink_inet_cmp(rr->info[i].ip(), ip)) {
+ if (0 == ats_ip_addr_cmp(rr->info[i].ip(), ip)) {
Debug("hostdb", "immediate setby for %s", hostname ? hostname : "<addr>");
rr->info[i].app.allotment.application1 = app->allotment.application1;
rr->info[i].app.allotment.application2 = app->allotment.application2;
@@ -973,7 +973,7 @@ do_setby(HostDBInfo * r, HostDBApplicationInfo * app, const char *hostname, sock
}
}
} else {
- if (r->reverse_dns || (!r->round_robin && ink_inet_eq(r->ip(), ip))) {
+ if (r->reverse_dns || (!r->round_robin && ats_ip_addr_eq(r->ip(), ip))) {
Debug("hostdb", "immediate setby for %s", hostname ? hostname : "<addr>");
r->app.allotment.application1 = app->allotment.application1;
r->app.allotment.application2 = app->allotment.application2;
@@ -989,7 +989,7 @@ HostDBProcessor::setby(const char *hostname, int len, sockaddr const* ip, HostDB
return;
INK_MD5 md5;
- unsigned short port = ink_inet_get_port(ip);
+ unsigned short port = ats_ip_port_host_order(ip);
// if it is by name, INK_MD5 the name
//
@@ -1003,10 +1003,10 @@ HostDBProcessor::setby(const char *hostname, int len, sockaddr const* ip, HostDB
//
uint8_t buff[INK_IP6_SIZE+4];
memset(buff, 0, sizeof(buff));
- if (ink_inet_is_ip4(ip))
- memcpy(buff+2, &ink_inet_ip4_addr_cast(ip), sizeof(in_addr_t));
- else if (ink_inet_is_ip6(ip))
- memcpy(buff+2, &ink_inet_ip6_addr_cast(ip), sizeof(in6_addr));
+ if (ats_is_ip4(ip))
+ memcpy(buff+2, &ats_ip4_addr_cast(ip), sizeof(in_addr_t));
+ else if (ats_is_ip6(ip))
+ memcpy(buff+2, &ats_ip6_addr_cast(ip), sizeof(in6_addr));
md5.encodeBuffer(buff, sizeof buff);
}
@@ -1057,10 +1057,10 @@ remove_round_robin(HostDBInfo * r, const char *hostname, sockaddr const* ip)
if (!rr)
return false;
for (int i = 0; i < rr->good; i++) {
- if (0 == ink_inet_cmp(rr->info[i].ip(), ip)) {
+ if (0 == ats_ip_addr_cmp(rr->info[i].ip(), ip)) {
ip_text_buffer b;
Debug("hostdb", "Deleting %s from '%s' round robin DNS entry",
- ink_inet_ntop(ip, b, sizeof b),
+ ats_ip_ntop(ip, b, sizeof b),
hostname
);
HostDBInfo tmp = rr->info[i];
@@ -1076,7 +1076,7 @@ remove_round_robin(HostDBInfo * r, const char *hostname, sockaddr const* ip)
char *rr_ip_list = (char *) alloca(bufsize);
char *p = rr_ip_list;
for (int n = 0; n < rr->good; ++n) {
- ink_inet_ntop(rr->info[n].ip(), p, bufsize);
+ ats_ip_ntop(rr->info[n].ip(), p, bufsize);
int nbytes = strlen(p);
p += nbytes;
bufsize -= nbytes;
@@ -1098,7 +1098,7 @@ HostDBProcessor::failed_connect_on_ip_for_name(Continuation * cont, sockaddr con
INK_MD5 md5;
char *pServerLine = 0;
void *pDS = 0;
- unsigned short port = ink_inet_get_port(ip);
+ unsigned short port = ats_ip_port_host_order(ip);
#ifdef SPLIT_DNS
SplitDNS *pSD = 0;
@@ -1180,14 +1180,14 @@ HostDBContinuation::lookup_done(sockaddr const* aip, char *aname, bool around_ro
HostDBInfo *i = NULL;
ink_debug_assert(this_ethread() == hostDB.lock_for_bucket((int) (fold_md5(md5) % hostDB.buckets))->thread_holding);
- if (!aip || !ink_inet_is_ip(aip) || !aname || !aname[0]) {
+ if (!aip || !ats_is_ip(aip) || !aname || !aname[0]) {
if (is_byname()) {
Debug("hostdb", "lookup_done() failed for '%s'", name);
} else if (is_srv()) {
Debug("dns_srv", "SRV failed for '%s'", name);
} else {
ip_text_buffer b;
- Debug("hostdb", "failed for %s", ink_inet_ntop(&ip.sa, b, sizeof b));
+ Debug("hostdb", "failed for %s", ats_ip_ntop(&ip.sa, b, sizeof b));
}
i = insert(hostdb_ip_fail_timeout_interval); // currently ... 0
i->round_robin = false;
@@ -1216,8 +1216,8 @@ HostDBContinuation::lookup_done(sockaddr const* aip, char *aname, bool around_ro
i = insert(ttl_seconds);
if (is_byname()) {
ip_text_buffer b;
- Debug("hostdb", "done %s TTL %d", ink_inet_ntop(aip, b, sizeof b), ttl_seconds);
- ink_inet_copy(i->ip(), aip);
+ Debug("hostdb", "done %s TTL %d", ats_ip_ntop(aip, b, sizeof b), ttl_seconds);
+ ats_ip_copy(i->ip(), aip);
i->round_robin = around_robin;
i->reverse_dns = false;
if (name != aname) {
@@ -1226,7 +1226,7 @@ HostDBContinuation::lookup_done(sockaddr const* aip, char *aname, bool around_ro
i->is_srv = false;
} else if (is_srv()) {
- ink_inet_copy(i->ip(), aip); /* this doesnt matter w. srv records -- setting to 1 so Md5 works */
+ ats_ip_copy(i->ip(), aip); /* this doesnt matter w. srv records -- setting to 1 so Md5 works */
i->reverse_dns = false;
@@ -1305,12 +1305,12 @@ restore_info(HostDBInfo * r, HostDBInfo * old_r, HostDBInfo & old_info, HostDBRo
{
if (old_rr_data) {
for (int j = 0; j < old_rr_data->n; j++)
- if (ink_inet_eq(old_rr_data->info[j].ip(), r->ip())) {
+ if (ats_ip_addr_eq(old_rr_data->info[j].ip(), r->ip())) {
r->app = old_rr_data->info[j].app;
return true;
}
} else if (old_r)
- if (ink_inet_eq(old_info.ip(), r->ip())) {
+ if (ats_ip_addr_eq(old_info.ip(), r->ip())) {
r->app = old_info.app;
return true;
}
@@ -1402,8 +1402,8 @@ HostDBContinuation::dnsEvent(int event, HostEnt * e)
HostDBInfo *r = NULL;
sockaddr_storage tip; // temporary IP data.
- sockaddr* tip_ptr = ink_inet_sa_cast(&tip);
- ink_inet_invalidate(tip_ptr);
+ sockaddr* tip_ptr = ats_ip_sa_cast(&tip);
+ ats_ip_invalidate(tip_ptr);
if (first) ip_addr_set(tip_ptr, af, first);
if (is_byname())
@@ -1430,7 +1430,7 @@ HostDBContinuation::dnsEvent(int event, HostEnt * e)
SRV *t = q->dequeue();
HostDBInfo& item = rr_data->info[i];
- ink_inet_invalidate(item.ip());
+ ats_ip_invalidate(item.ip());
item.round_robin = 0;
item.reverse_dns = 0;
@@ -1522,7 +1522,7 @@ HostDBContinuation::dnsEvent(int event, HostEnt * e)
//
struct HostDB_get_message {
INK_MD5 md5;
- ts_ip_endpoint ip;
+ IpEndpoint ip;
Continuation *cont;
int namelen;
char name[MAXDNAME];
@@ -1539,7 +1539,7 @@ HostDBContinuation::make_get_message(char *buf, int size)
HostDB_get_message *msg = reinterpret_cast<HostDB_get_message *>(buf);
msg->md5 = md5;
- ink_inet_copy(&msg->ip.sa, &ip.sa);
+ ats_ip_copy(&msg->ip.sa, &ip.sa);
msg->cont = this;
// name
@@ -1607,7 +1607,7 @@ bool HostDBContinuation::do_get_response(Event * e)
//
struct HostDB_put_message {
INK_MD5 md5;
- ts_ip_endpoint ip;
+ IpEndpoint ip;
unsigned int ttl;
unsigned int missing:1;
unsigned int round_robin:1;
@@ -1633,7 +1633,7 @@ HostDBContinuation::make_put_message(HostDBInfo * r, Continuation * c, char *buf
msg->md5 = md5;
msg->cont = c;
if (r) {
- ink_inet_copy(&msg->ip.sa, r->ip());
+ ats_ip_copy(&msg->ip.sa, r->ip());
msg->application1 = r->app.allotment.application1;
msg->application2 = r->app.allotment.application2;
msg->missing = false;
@@ -1694,7 +1694,7 @@ HostDBContinuation::probeEvent(int event, Event * e)
return EVENT_DONE;
}
- if (!hostdb_enable || (!*name && !ink_inet_is_ip(&ip.sa))) {
+ if (!hostdb_enable || (!*name && !ats_is_ip(&ip.sa))) {
if (action.continuation)
action.continuation->handleEvent(EVENT_HOST_DB_LOOKUP, NULL);
#ifdef NON_MODULAR
@@ -1791,8 +1791,8 @@ HostDBContinuation::do_dns()
ink_assert(!action.cancelled);
if (is_byname()) {
Debug("hostdb", "DNS %s", name);
- ts_ip_endpoint tip;
- if (0 == ink_inet_pton(name, &tip.sa)) {
+ IpEndpoint tip;
+ if (0 == ats_ip_pton(name, &tip.sa)) {
// check 127.0.0.1 format // What the heck does that mean? - AMC
if (action.continuation) {
HostDBInfo *r = lookup_done(&tip.sa, name, false, HOST_DB_MAX_TTL, NULL);
@@ -1821,7 +1821,7 @@ HostDBContinuation::do_dns()
pending_action = dnsProcessor.getSRVbyname(this, name, dnsH, dns_lookup_timeout);
} else {
ip_text_buffer ipb;
- Debug("hostdb", "DNS IP %s", ink_inet_ntop(&ip.sa, ipb, sizeof ipb));
+ Debug("hostdb", "DNS IP %s", ats_ip_ntop(&ip.sa, ipb, sizeof ipb));
pending_action = dnsProcessor.gethostbyaddr(this, &ip.sa, dns_lookup_timeout);
}
} else {
@@ -2124,7 +2124,7 @@ typedef int (ShowHostDB::*ShowHostDBEventHandler) (int event, Event * data);
struct ShowHostDB: public ShowCont
{
char *name;
- ts_ip_endpoint ip;
+ IpEndpoint ip;
bool force;
int showMain(int event, Event * e)
@@ -2174,7 +2174,7 @@ struct ShowHostDB: public ShowCont
if (r->reverse_dns) {
CHECK_SHOW(show("<tr><td>%s</td><td>%s</td></tr>\n", "Hostname", r->hostname()? r->hostname() : "<none>"));
} else {
- CHECK_SHOW(show("<tr><td>%s</td><td>%s</td></tr>\n", "IP", ink_inet_ntop(r->ip(), b, sizeof b)));
+ CHECK_SHOW(show("<tr><td>%s</td><td>%s</td></tr>\n", "IP", ats_ip_ntop(r->ip(), b, sizeof b)));
}
CHECK_SHOW(show("</table>\n"));
return EVENT_CONT;
@@ -2209,7 +2209,7 @@ struct ShowHostDB: public ShowCont
} else {
if (name) {
ip_text_buffer b;
- CHECK_SHOW(show("<H2>%s Not Found</H2>\n", ink_inet_ntop(&ip.sa, b, sizeof b)));
+ CHECK_SHOW(show("<H2>%s Not Found</H2>\n", ats_ip_ntop(&ip.sa, b, sizeof b)));
} else {
CHECK_SHOW(show("<H2>%s Not Found</H2>\n", name));
}
@@ -2221,7 +2221,7 @@ struct ShowHostDB: public ShowCont
ShowHostDB(Continuation * c, HTTPHdr * h)
: ShowCont(c, h), name(0), force(0)
{
- ink_inet_invalidate(&ip);
+ ats_ip_invalidate(&ip);
SET_HANDLER(&ShowHostDB::showMain);
}
@@ -2247,7 +2247,7 @@ register_ShowHostDB(Continuation * c, HTTPHdr * h)
if (s->sarg)
gn = (char *)memchr(s->sarg, '=', strlen(s->sarg));
if (gn) {
- ink_inet_pton(gn+1, &s->ip); // hope that's null terminated.
+ ats_ip_pton(gn+1, &s->ip); // hope that's null terminated.
}
SET_CONTINUATION_HANDLER(s, &ShowHostDB::showLookup);
} else if (STR_LEN_EQ_PREFIX(path, path_len, "name")) {
@@ -2297,7 +2297,7 @@ struct HostDBTestReverse: public Continuation
#else
l = lrand48();
#endif
- ts_ip_endpoint ip;
+ IpEndpoint ip;
ip.sin.sin_addr.s_addr = static_cast<in_addr_t>(l);
outstanding++;
total++;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/iocore/hostdb/I_HostDBProcessor.h
----------------------------------------------------------------------
diff --git a/iocore/hostdb/I_HostDBProcessor.h b/iocore/hostdb/I_HostDBProcessor.h
index c697e25..34b3ab6 100644
--- a/iocore/hostdb/I_HostDBProcessor.h
+++ b/iocore/hostdb/I_HostDBProcessor.h
@@ -141,7 +141,7 @@ struct HostDBInfo
} else if (byname) {
if (reverse_dns)
goto Lbad;
- if (!ink_inet_is_ip(ip()))
+ if (!ats_is_ip(ip()))
goto Lbad;
} else {
if (!reverse_dns)
@@ -233,7 +233,7 @@ struct HostDBInfo
//
union {
- ts_ip_endpoint ip; ///< IP address / port data.
+ IpEndpoint ip; ///< IP address / port data.
int hostname_offset; ///< Some hostname thing.
} data;
@@ -260,8 +260,8 @@ struct HostDBInfo
uint64_t md5_high;
- bool failed() { return !ink_inet_is_ip(ip()); }
- void set_failed() { ink_inet_invalidate(ip()); }
+ bool failed() { return !ats_is_ip(ip()); }
+ void set_failed() { ats_ip_invalidate(ip()); }
void set_deleted() { deleted = 1; }
bool is_deleted() const { return deleted; }
@@ -294,7 +294,7 @@ struct HostDBInfo
void reset()
{
- ink_inet_invalidate(ip());
+ ats_ip_invalidate(ip());
app.allotment.application1 = 0;
app.allotment.application2 = 0;
backed = 0;
@@ -335,7 +335,7 @@ HostDBInfo()
app.allotment.application1 = 0;
app.allotment.application2 = 0;
#endif
- ink_inet_invalidate(ip());
+ ats_ip_invalidate(ip());
return;
}
@@ -470,8 +470,8 @@ struct HostDBProcessor: public Processor
void setbyname_appinfo(char *hostname, int len, int port, HostDBApplicationInfo * app)
{
sockaddr_in addr;
- ink_inet_ip4_set(&addr, INADDR_ANY, port);
- setby(hostname, len, ink_inet_sa_cast(&addr), app);
+ ats_ip4_set(&addr, INADDR_ANY, port);
+ setby(hostname, len, ats_ip_sa_cast(&addr), app);
}
void setbyaddr_appinfo(sockaddr const* addr, HostDBApplicationInfo * app) {
@@ -481,8 +481,8 @@ struct HostDBProcessor: public Processor
void setbyaddr_appinfo(in_addr_t ip, HostDBApplicationInfo * app)
{
sockaddr_in addr;
- ink_inet_ip4_set(&addr, ip);
- this->setby(0, 0, ink_inet_sa_cast(&addr), app);
+ ats_ip4_set(&addr, ip);
+ this->setby(0, 0, ats_ip_sa_cast(&addr), app);
}
/** Configuration. */
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/iocore/hostdb/P_HostDBProcessor.h
----------------------------------------------------------------------
diff --git a/iocore/hostdb/P_HostDBProcessor.h b/iocore/hostdb/P_HostDBProcessor.h
index 48a2ff9..b7961ea 100644
--- a/iocore/hostdb/P_HostDBProcessor.h
+++ b/iocore/hostdb/P_HostDBProcessor.h
@@ -35,14 +35,14 @@ inline unsigned int HOSTDB_CLIENT_IP_HASH(
sockaddr const* rhs
) {
unsigned int zret = ~static_cast<unsigned int>(0);
- if (ink_inet_are_compatible(lhs,rhs)) {
- if (ink_inet_is_ip4(lhs)) {
- in_addr_t ip1 = ink_inet_ip4_addr_cast(lhs);
- in_addr_t ip2 = ink_inet_ip4_addr_cast(rhs);
+ if (ats_ip_are_compatible(lhs,rhs)) {
+ if (ats_is_ip4(lhs)) {
+ in_addr_t ip1 = ats_ip4_addr_cast(lhs);
+ in_addr_t ip2 = ats_ip4_addr_cast(rhs);
zret = (ip1 >> 16) ^ ip1 ^ ip2 ^ (ip2 >> 16);
- } else if (ink_inet_is_ip6(lhs)) {
- uint32_t const* ip1 = ink_inet_addr32_cast(lhs);
- uint32_t const* ip2 = ink_inet_addr32_cast(rhs);
+ } else if (ats_is_ip6(lhs)) {
+ uint32_t const* ip1 = ats_ip_addr32_cast(lhs);
+ uint32_t const* ip2 = ats_ip_addr32_cast(rhs);
for ( int i = 0 ; i < 4 ; ++i, ++ip1, ++ip2 ) {
zret ^= (*ip1 >> 16) ^ *ip1 ^ *ip2 ^ (*ip2 >> 16);
}
@@ -174,7 +174,7 @@ HostDBRoundRobin::find_ip(sockaddr const* ip) {
}
for (int i = 0; i < good; i++) {
- if (ink_inet_eq(ip, info[i].ip())) {
+ if (ats_ip_addr_eq(ip, info[i].ip())) {
return &info[i];
}
}
@@ -299,7 +299,7 @@ typedef int (HostDBContinuation::*HostDBContHandler) (int, void *);
struct HostDBContinuation: public Continuation
{
Action action;
- ts_ip_endpoint ip;
+ IpEndpoint ip;
unsigned int ttl;
bool is_srv_lookup;
int dns_lookup_timeout;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/iocore/net/Connection.cc
----------------------------------------------------------------------
diff --git a/iocore/net/Connection.cc b/iocore/net/Connection.cc
index 192b9e5..1dbbe12 100644
--- a/iocore/net/Connection.cc
+++ b/iocore/net/Connection.cc
@@ -92,8 +92,8 @@ Server::accept(Connection * c)
if (is_debug_tag_set("iocore_net_server")) {
ip_port_text_buffer ipb1, ipb2;
Debug("iocore_net_server", "Connection accepted [Server]. %s -> %s\n"
- , ink_inet_nptop(&c->addr, ipb2, sizeof(ipb2))
- , ink_inet_nptop(&addr, ipb1, sizeof(ipb1))
+ , ats_ip_nptop(&c->addr, ipb2, sizeof(ipb2))
+ , ats_ip_nptop(&addr, ipb1, sizeof(ipb1))
);
}
@@ -268,10 +268,10 @@ Server::listen(bool non_blocking, int recv_bufsize, int send_bufsize, bool trans
int res = 0;
int namelen;
- if (!ink_inet_is_ip(&accept_addr)) {
- ink_inet_ip4_set(&addr, INADDR_ANY,0);
+ if (!ats_is_ip(&accept_addr)) {
+ ats_ip4_set(&addr, INADDR_ANY,0);
} else {
- ink_inet_copy(&addr, &accept_addr);
+ ats_ip_copy(&addr, &accept_addr);
}
res = socketManager.socket(addr.sa.sa_family, SOCK_STREAM, IPPROTO_TCP);
@@ -339,13 +339,13 @@ Server::listen(bool non_blocking, int recv_bufsize, int send_bufsize, bool trans
}
#endif
- if (ink_inet_is_ip6(&addr) && (res = safe_setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, SOCKOPT_ON, sizeof(int))) < 0)
+ if (ats_is_ip6(&addr) && (res = safe_setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, SOCKOPT_ON, sizeof(int))) < 0)
goto Lerror;
if ((res = safe_setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, SOCKOPT_ON, sizeof(int))) < 0)
goto Lerror;
- if ((res = socketManager.ink_bind(fd, &addr.sa, ink_inet_ip_size(&addr.sa), IPPROTO_TCP)) < 0) {
+ if ((res = socketManager.ink_bind(fd, &addr.sa, ats_ip_size(&addr.sa), IPPROTO_TCP)) < 0) {
goto Lerror;
}
#ifdef SET_TCP_NO_DELAY
@@ -391,6 +391,6 @@ Server::listen(bool non_blocking, int recv_bufsize, int send_bufsize, bool trans
Lerror:
if (fd != NO_FD)
close();
- Error("Could not bind or listen to port %d (error: %d)", ink_inet_get_port(&addr), res);
+ Error("Could not bind or listen to port %d (error: %d)", ats_ip_port_host_order(&addr), res);
return res;
}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/iocore/net/I_NetProcessor.h
----------------------------------------------------------------------
diff --git a/iocore/net/I_NetProcessor.h b/iocore/net/I_NetProcessor.h
index 847a664..bea906a 100644
--- a/iocore/net/I_NetProcessor.h
+++ b/iocore/net/I_NetProcessor.h
@@ -51,7 +51,7 @@ public:
int local_port;
/// Local address to bind for accept.
/// If not set -> any address.
- InkInetAddr local_ip;
+ IpAddr local_ip;
/// IP address family.
/// @note Ignored if an explicit incoming address is set in the
/// the configuration (@c local_ip). If neither is set IPv4 is used.
@@ -233,8 +233,8 @@ public:
) {
struct sockaddr_in addr;
- ink_inet_ip4_set(&addr, ip, htons(port));
- return connect_re(cont, ink_inet_sa_cast(&addr), options);
+ ats_ip4_set(&addr, ip, htons(port));
+ return connect_re(cont, ats_ip_sa_cast(&addr), options);
}
/**
@@ -276,8 +276,8 @@ public:
) {
struct sockaddr_in addr;
- ink_inet_ip4_set(&addr, ip, htons(port));
- return connect_s(cont, ink_inet_sa_cast(&addr), timeout, opts);
+ ats_ip4_set(&addr, ip, htons(port));
+ return connect_s(cont, ats_ip_sa_cast(&addr), timeout, opts);
}
/**
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/iocore/net/I_NetVConnection.h
----------------------------------------------------------------------
diff --git a/iocore/net/I_NetVConnection.h b/iocore/net/I_NetVConnection.h
index 2297830..0c55580 100644
--- a/iocore/net/I_NetVConnection.h
+++ b/iocore/net/I_NetVConnection.h
@@ -101,7 +101,7 @@ struct NetVCOptions {
causes the value in @a local_addr to be ignored.
The IP address and port are separate because most clients treat
- these independently. For the same reason @c InkInetAddr is used
+ these independently. For the same reason @c IpAddr is used
to be clear that it contains no port data.
@see local_addr
@@ -124,7 +124,7 @@ struct NetVCOptions {
@see addr_binding
@see ip_family
*/
- InkInetAddr local_ip;
+ IpAddr local_ip;
/** Local port for connection.
Set to 0 for "don't care" (default).
*/
@@ -569,8 +569,8 @@ private:
NetVConnection & operator =(const NetVConnection &);
protected:
- ts_ip_endpoint local_addr;
- ts_ip_endpoint remote_addr;
+ IpEndpoint local_addr;
+ IpEndpoint remote_addr;
bool got_local_addr;
bool got_remote_addr;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/iocore/net/I_UDPNet.h
----------------------------------------------------------------------
diff --git a/iocore/net/I_UDPNet.h b/iocore/net/I_UDPNet.h
index ec9c856..5e558ec 100644
--- a/iocore/net/I_UDPNet.h
+++ b/iocore/net/I_UDPNet.h
@@ -82,7 +82,7 @@ public:
inkcoreapi Action *UDPBind(Continuation * c, sockaddr const* addr, int send_bufsize = 0, int recv_bufsize = 0);
// The mess again: the complier won't let me stick UDPConnection here.
- void UDPClassifyConnection(Continuation * udpConn, InkInetAddr const& addr);
+ void UDPClassifyConnection(Continuation * udpConn, IpAddr const& addr);
// create pairs of UDPConnections in which the first connection is
// on a even-#'ed port and the second connection is on the next
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/iocore/net/I_UDPPacket.h
----------------------------------------------------------------------
diff --git a/iocore/net/I_UDPPacket.h b/iocore/net/I_UDPPacket.h
index 378d5cf..f248e7a 100644
--- a/iocore/net/I_UDPPacket.h
+++ b/iocore/net/I_UDPPacket.h
@@ -65,8 +65,8 @@ public:
inkcoreapi void append_block(IOBufferBlock * block);
virtual void UDPPacket_is_abstract() = 0;
- ts_ip_endpoint from; // what address came from
- ts_ip_endpoint to; // what address to send to
+ IpEndpoint from; // what address came from
+ IpEndpoint to; // what address to send to
int from_size;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/iocore/net/P_Connection.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_Connection.h b/iocore/net/P_Connection.h
index f16f78e..1630ee3 100644
--- a/iocore/net/P_Connection.h
+++ b/iocore/net/P_Connection.h
@@ -81,7 +81,7 @@ struct NetVCOptions;
struct Connection
{
SOCKET fd; ///< Socket for connection.
- ts_ip_endpoint addr; ///< Associated address.
+ IpEndpoint addr; ///< Associated address.
bool is_bound; ///< Flag for already bound to a local address.
bool is_connected; ///< Flag for already connected.
@@ -121,7 +121,7 @@ struct Connection
void setRemote(
sockaddr const* remote_addr ///< Address and port.
) {
- ink_inet_copy(&addr, remote_addr);
+ ats_ip_copy(&addr, remote_addr);
}
/**
@@ -131,7 +131,7 @@ struct Connection
in_addr_t ip,
int port
) {
- ink_inet_ip4_set(&addr.sin, ip, htons(port));
+ ats_ip4_set(&addr.sin, ip, htons(port));
}
@@ -152,12 +152,12 @@ struct Connection
struct sockaddr_in mc_addr;
struct sockaddr_in my_addr;
- ink_inet_ip4_set(&mc_addr, mc_ip, htons(mc_port));
- ink_inet_ip4_set(&my_addr, my_ip, htons(my_port));
+ ats_ip4_set(&mc_addr, mc_ip, htons(mc_port));
+ ats_ip4_set(&my_addr, my_ip, htons(my_port));
return setup_mc_send(
- ink_inet_sa_cast(&mc_addr),
- ink_inet_sa_cast(&my_addr),
+ ats_ip_sa_cast(&mc_addr),
+ ats_ip_sa_cast(&my_addr),
non_blocking, mc_ttl, mc_loopback, c);
}
@@ -173,9 +173,9 @@ struct Connection
bool non_blocking = NON_BLOCKING, Connection * sendchan = NULL, Continuation * c = NULL)
{
struct sockaddr_in mc_addr;
- ink_inet_ip4_set(&mc_addr, mc_ip, port);
+ ats_ip4_set(&mc_addr, mc_ip, port);
- return setup_mc_receive(ink_inet_sa_cast(&mc_addr), non_blocking, sendchan, c);
+ return setup_mc_receive(ats_ip_sa_cast(&mc_addr), non_blocking, sendchan, c);
}
@@ -199,7 +199,7 @@ protected:
struct Server: public Connection
{
/// Client side (inbound) local IP address.
- ts_ip_endpoint accept_addr;
+ IpEndpoint accept_addr;
/// If set, the related incoming connect was transparent.
bool f_inbound_transparent;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/iocore/net/P_NetVConnection.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_NetVConnection.h b/iocore/net/P_NetVConnection.h
index e5d05c5..b62ed54 100644
--- a/iocore/net/P_NetVConnection.h
+++ b/iocore/net/P_NetVConnection.h
@@ -37,8 +37,8 @@ TS_INLINE in_addr_t
NetVConnection::get_remote_ip()
{
sockaddr const* addr = this->get_remote_addr();
- return ink_inet_is_ip4(addr)
- ? ink_inet_ip4_addr_cast(addr)
+ return ats_is_ip4(addr)
+ ? ats_ip4_addr_cast(addr)
: 0;
}
@@ -47,7 +47,7 @@ NetVConnection::get_remote_ip()
TS_INLINE uint16_t
NetVConnection::get_remote_port()
{
- return ink_inet_get_port(this->get_remote_addr());
+ return ats_ip_port_host_order(this->get_remote_addr());
}
TS_INLINE sockaddr const*
@@ -56,9 +56,9 @@ NetVConnection::get_local_addr()
if (!got_local_addr) {
set_local_addr();
if (
- (ink_inet_is_ip(&local_addr) && ink_inet_port_cast(&local_addr)) // IP and has a port.
- || (ink_inet_is_ip4(&local_addr) && INADDR_ANY != ink_inet_ip4_addr_cast(&local_addr)) // IPv4
- || (ink_inet_is_ip6(&local_addr) && !IN6_IS_ADDR_UNSPECIFIED(&local_addr.sin6.sin6_addr))
+ (ats_is_ip(&local_addr) && ats_ip_port_cast(&local_addr)) // IP and has a port.
+ || (ats_is_ip4(&local_addr) && INADDR_ANY != ats_ip4_addr_cast(&local_addr)) // IPv4
+ || (ats_is_ip6(&local_addr) && !IN6_IS_ADDR_UNSPECIFIED(&local_addr.sin6.sin6_addr))
) {
got_local_addr = 1;
}
@@ -70,8 +70,8 @@ TS_INLINE in_addr_t
NetVConnection::get_local_ip()
{
sockaddr const* addr = this->get_local_addr();
- return ink_inet_is_ip4(addr)
- ? ink_inet_ip4_addr_cast(addr)
+ return ats_is_ip4(addr)
+ ? ats_ip4_addr_cast(addr)
: 0;
}
@@ -79,5 +79,5 @@ NetVConnection::get_local_ip()
TS_INLINE uint16_t
NetVConnection::get_local_port()
{
- return ink_inet_get_port(this->get_local_addr());
+ return ats_ip_port_host_order(this->get_local_addr());
}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/iocore/net/P_Socks.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_Socks.h b/iocore/net/P_Socks.h
index 8a98a0c..d03eacd 100644
--- a/iocore/net/P_Socks.h
+++ b/iocore/net/P_Socks.h
@@ -62,7 +62,7 @@ struct socks_conf_struct
#endif
#ifndef SOCKS_WITH_TS
- ts_ip_endpoint server_addr;
+ IpEndpoint server_addr;
#endif
socks_conf_struct():socks_needed(0), server_connect_timeout(0), socks_timeout(100), default_version(5),
@@ -115,9 +115,9 @@ struct SocksEntry:public Continuation
SocksNetVC *netVConnection;
// Changed from @a ip and @a port.
- ts_ip_endpoint target_addr; ///< Original target address.
+ IpEndpoint target_addr; ///< Original target address.
// Changed from @a server_ip, @a server_port.
- ts_ip_endpoint server_addr; ///< Origin server address.
+ IpEndpoint server_addr; ///< Origin server address.
int nattempts;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/iocore/net/P_UDPConnection.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UDPConnection.h b/iocore/net/P_UDPConnection.h
index 9436073..724bb9e 100644
--- a/iocore/net/P_UDPConnection.h
+++ b/iocore/net/P_UDPConnection.h
@@ -46,7 +46,7 @@ public:
int refcount; // public for assertion
SOCKET fd;
- ts_ip_endpoint binding;
+ IpEndpoint binding;
int binding_valid;
int tobedestroyed;
int sendGenerationNum;
@@ -113,7 +113,7 @@ TS_INLINE void
UDPConnection::setBinding(struct sockaddr const* s)
{
UDPConnectionInternal *p = (UDPConnectionInternal *) this;
- ink_inet_copy(&p->binding, s);
+ ats_ip_copy(&p->binding, s);
p->binding_valid = 1;
}
@@ -121,7 +121,7 @@ TS_INLINE int
UDPConnection::getBinding(struct sockaddr *s)
{
UDPConnectionInternal *p = (UDPConnectionInternal *) this;
- ink_inet_copy(s, &p->binding);
+ ats_ip_copy(s, &p->binding);
return p->binding_valid;
}
@@ -165,7 +165,7 @@ UDPConnection::GetSendGenerationNumber()
TS_INLINE int
UDPConnection::getPortNum(void)
{
- return ink_inet_get_port(&static_cast<UDPConnectionInternal *>(this)->binding);
+ return ats_ip_port_host_order(&static_cast<UDPConnectionInternal *>(this)->binding);
}
TS_INLINE int64_t
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/iocore/net/P_UDPNet.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UDPNet.h b/iocore/net/P_UDPNet.h
index 91f677c..37d0151 100644
--- a/iocore/net/P_UDPNet.h
+++ b/iocore/net/P_UDPNet.h
@@ -416,7 +416,7 @@ struct InkSinglePipeInfo
int64_t bwAlloc;
// this is in Mbps
double bwUsed;
- InkInetAddr destIP;
+ IpAddr destIP;
uint32_t count;
uint64_t bytesSent;
uint64_t pktsSent;
@@ -456,8 +456,8 @@ public:
private:
Continuation * cont;
int numPairs;
- ts_ip_endpoint local_ip; ///< replaces myIP.
- ts_ip_endpoint remote_ip; ///< replaces destIP.
+ IpEndpoint local_ip; ///< replaces myIP.
+ IpEndpoint remote_ip; ///< replaces destIP.
int sendbufsize, recvbufsize;
UnixUDPConnection **udpConns;
int resultCode;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/iocore/net/P_UDPPacket.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UDPPacket.h b/iocore/net/P_UDPPacket.h
index 87dcb23..5ad953e 100644
--- a/iocore/net/P_UDPPacket.h
+++ b/iocore/net/P_UDPPacket.h
@@ -219,7 +219,7 @@ new_UDPPacket(struct sockaddr const* to, ink_hrtime when, char *buf, int len)
p->in_heap = 0;
#endif
p->delivery_time = when;
- ink_inet_copy(&p->to, to);
+ ats_ip_copy(&p->to, to);
if (buf) {
IOBufferBlock *body = new_IOBufferBlock();
@@ -244,7 +244,7 @@ new_UDPPacket(struct sockaddr const* to, ink_hrtime when, IOBufferBlock * buf, i
p->in_heap = 0;
#endif
p->delivery_time = when;
- ink_inet_copy(&p->to, to);
+ ats_ip_copy(&p->to, to);
while (buf) {
body = buf->clone();
@@ -265,7 +265,7 @@ new_UDPPacket(struct sockaddr const* to, ink_hrtime when, Ptr<IOBufferBlock> buf
#endif
p->delivery_time = when;
if (to)
- ink_inet_copy(&p->to, to);
+ ats_ip_copy(&p->to, to);
p->chain = buf;
return p;
}
@@ -286,7 +286,7 @@ new_incoming_UDPPacket(struct sockaddr * from, char *buf, int len)
p->in_heap = 0;
#endif
p->delivery_time = 0;
- ink_inet_copy(&p->from, from);
+ ats_ip_copy(&p->from, from);
IOBufferBlock *body = new_IOBufferBlock();
body->alloc(iobuffer_size_to_index(len));
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/iocore/net/P_UnixNetVConnection.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UnixNetVConnection.h b/iocore/net/P_UnixNetVConnection.h
index 387b1d2..9a9d07b 100644
--- a/iocore/net/P_UnixNetVConnection.h
+++ b/iocore/net/P_UnixNetVConnection.h
@@ -208,7 +208,7 @@ public:
NetHandler *nh;
unsigned int id;
// amc - what is this for? Why not use remote_addr or con.addr?
- ts_ip_endpoint server_addr; /// Server address and port.
+ IpEndpoint server_addr; /// Server address and port.
union
{
@@ -250,7 +250,7 @@ typedef int (UnixNetVConnection::*NetVConnHandler) (int, void *);
TS_INLINE void
UnixNetVConnection::set_remote_addr()
{
- ink_inet_copy(&remote_addr, &con.addr);
+ ats_ip_copy(&remote_addr, &con.addr);
}
TS_INLINE void
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/iocore/net/SSLNetVConnection.cc
----------------------------------------------------------------------
diff --git a/iocore/net/SSLNetVConnection.cc b/iocore/net/SSLNetVConnection.cc
index 60a67cd..f538359 100644
--- a/iocore/net/SSLNetVConnection.cc
+++ b/iocore/net/SSLNetVConnection.cc
@@ -469,7 +469,7 @@ int
SSLNetVConnection::sslStartHandShake(int event, int &err)
{
SSL_CTX *ctx = NULL;
- ts_ip_endpoint ip;
+ IpEndpoint ip;
int namelen = sizeof(ip);
if (event == SSL_EVENT_SERVER) {
@@ -477,7 +477,7 @@ SSLNetVConnection::sslStartHandShake(int event, int &err)
if (sslCertLookup.multipleCerts) {
char buff[INET6_ADDRSTRLEN];
safe_getsockname(get_socket(), &ip.sa, &namelen);
- ink_inet_ntop(&ip.sa, buff, sizeof(buff));
+ ats_ip_ntop(&ip.sa, buff, sizeof(buff));
ctx = sslCertLookup.findInfoInHash(buff);
if (ctx == NULL)
ctx = ssl_NetProcessor.ctx;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/iocore/net/Socks.cc
----------------------------------------------------------------------
diff --git a/iocore/net/Socks.cc b/iocore/net/Socks.cc
index 21c68d6..36dd678 100644
--- a/iocore/net/Socks.cc
+++ b/iocore/net/Socks.cc
@@ -54,7 +54,7 @@ SocksEntry::init(ProxyMutex * m, SocksNetVC * vc, unsigned char socks_support, u
SET_HANDLER(&SocksEntry::startEvent);
- ink_inet_copy(&target_addr, vc->get_local_addr());
+ ats_ip_copy(&target_addr, vc->get_local_addr());
#ifdef SOCKS_WITH_TS
req_data.hdr = 0;
@@ -62,11 +62,11 @@ SocksEntry::init(ProxyMutex * m, SocksNetVC * vc, unsigned char socks_support, u
req_data.api_info = 0;
req_data.xact_start = time(0);
- assert(ink_inet_is_ip4(&target_addr));
- ink_inet_copy(&req_data.dest_ip, &target_addr);
+ assert(ats_is_ip4(&target_addr));
+ ats_ip_copy(&req_data.dest_ip, &target_addr);
//we dont have information about the source. set to destination's
- ink_inet_copy(&req_data.src_ip, &target_addr);
+ ats_ip_copy(&req_data.src_ip, &target_addr);
server_params = SocksServerConfig::acquire();
#endif
@@ -104,10 +104,10 @@ SocksEntry::findServer()
switch (server_result.r) {
case PARENT_SPECIFIED:
// Original was inet_addr, but should hostnames work?
- // ink_inet_pton only supports numeric (because other clients
+ // ats_ip_pton only supports numeric (because other clients
// explicitly want to avoid hostname lookups).
- if (0 == ink_inet_pton(server_result.hostname, &server_addr)) {
- ink_inet_port_cast(&server_addr) = htons(server_result.port);
+ if (0 == ats_ip_pton(server_result.hostname, &server_addr)) {
+ ats_ip_port_cast(&server_addr) = htons(server_result.port);
} else {
Debug("SocksParent", "Invalid parent server specified %s", server_result.hostname);
}
@@ -122,13 +122,13 @@ SocksEntry::findServer()
#else
if (nattempts > netProcessor.socks_conf_stuff->connection_attempts)
memset(&server_addr, 0, sizeof(server_addr));
- else ink_inet_copy(server_addr, g_socks_conf_stuff->socks_server);
+ else ats_ip_copy(server_addr, g_socks_conf_stuff->socks_server);
#endif // SOCKS_WITH_TS
char buff[INET6_ADDRSTRLEN];
Debug("SocksParents", "findServer result: %s:%d",
- ink_inet_ntop(&server_addr.sa, buff, sizeof(buff)),
- ink_inet_get_port(&server_addr)
+ ats_ip_ntop(&server_addr.sa, buff, sizeof(buff)),
+ ats_ip_port_host_order(&server_addr)
);
}
@@ -163,7 +163,7 @@ SocksEntry::free()
netVConnection->do_io_read(this, 0, 0);
netVConnection->do_io_write(this, 0, 0);
netVConnection->action_ = action_; //assign the original continuation
- ink_inet_copy(&netVConnection->server_addr, &server_addr);
+ ats_ip_copy(&netVConnection->server_addr, &server_addr);
Debug("Socks", "Sent success to HTTP");
NET_INCREMENT_DYN_STAT(socks_connections_successful_stat);
action_.continuation->handleEvent(NET_EVENT_OPEN, netVConnection);
@@ -197,11 +197,11 @@ SocksEntry::startEvent(int event, void *data)
}
char buff[INET6_ADDRPORTSTRLEN];
- Debug("Socks", "Failed to connect to %s", ink_inet_nptop(&server_addr.sa, buff, sizeof(buff)));
+ Debug("Socks", "Failed to connect to %s", ats_ip_nptop(&server_addr.sa, buff, sizeof(buff)));
findServer();
- if (!ink_inet_is_ip(&server_addr)) {
+ if (!ats_is_ip(&server_addr)) {
Debug("Socks", "Unable to open connection to the SOCKS server");
lerrno = ESOCK_NO_SOCK_SERVER_CONN;
free();
@@ -253,18 +253,18 @@ SocksEntry::mainEvent(int event, void *data)
p[n_bytes++] = version;
p[n_bytes++] = (socks_cmd == NORMAL_SOCKS) ? SOCKS_CONNECT : socks_cmd;
- ts = ntohs(ink_inet_port_cast(&server_addr));
+ ts = ntohs(ats_ip_port_cast(&server_addr));
if (version == SOCKS5_VERSION) {
p[n_bytes++] = 0; //Reserved
- if (ink_inet_is_ip4(&server_addr)) {
+ if (ats_is_ip4(&server_addr)) {
p[n_bytes++] = 1; //IPv4 addr
memcpy(p + n_bytes,
&server_addr.sin.sin_addr,
4
);
n_bytes += 4;
- } else if (ink_inet_is_ip6(&server_addr)) {
+ } else if (ats_is_ip6(&server_addr)) {
p[n_bytes++] = 4; //IPv6 addr
memcpy(p + n_bytes,
&server_addr.sin6.sin6_addr,
@@ -280,7 +280,7 @@ SocksEntry::mainEvent(int event, void *data)
n_bytes += 2;
if (version == SOCKS4_VERSION) {
- if (ink_inet_is_ip4(&server_addr)) {
+ if (ats_is_ip4(&server_addr)) {
//for socks4, ip addr is after the port
memcpy(p + n_bytes,
&server_addr.sin.sin_addr,
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/iocore/net/UnixConnection.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixConnection.cc b/iocore/net/UnixConnection.cc
index dadb348..3be09f5 100644
--- a/iocore/net/UnixConnection.cc
+++ b/iocore/net/UnixConnection.cc
@@ -64,11 +64,11 @@ Connection::setup_mc_send(
goto Lerror;
}
- if ((res = socketManager.ink_bind(fd, my_addr, ink_inet_ip_size(my_addr), IPPROTO_UDP)) < 0) {
+ if ((res = socketManager.ink_bind(fd, my_addr, ats_ip_size(my_addr), IPPROTO_UDP)) < 0) {
goto Lerror;
}
- ink_inet_copy(&addr, mc_addr);
+ ats_ip_copy(&addr, mc_addr);
#ifdef SET_CLOSE_ON_EXEC
if ((res = safe_fcntl(fd, F_SETFD, 1)) < 0)
@@ -124,19 +124,19 @@ Connection::setup_mc_receive(
if ((res = safe_setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *) &enable_reuseaddr, sizeof(enable_reuseaddr)) < 0))
goto Lerror;
- ink_inet_copy(&addr, mc_addr);
+ ats_ip_copy(&addr, mc_addr);
- if ((res = socketManager.ink_bind(fd, &addr.sa, ink_inet_ip_size(&addr.sa), IPPROTO_TCP)) < 0)
+ if ((res = socketManager.ink_bind(fd, &addr.sa, ats_ip_size(&addr.sa), IPPROTO_TCP)) < 0)
goto Lerror;
if (non_blocking)
if ((res = safe_nonblocking(fd)) < 0)
goto Lerror;
- if (ink_inet_is_ip4(&addr)) {
+ if (ats_is_ip4(&addr)) {
struct ip_mreq mc_request;
// Add ourselves to the MultiCast group
- mc_request.imr_multiaddr.s_addr = ink_inet_ip4_addr_cast(mc_addr);
+ mc_request.imr_multiaddr.s_addr = ats_ip4_addr_cast(mc_addr);
mc_request.imr_interface.s_addr = INADDR_ANY;
if ((res = safe_setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *) &mc_request, sizeof(mc_request)) < 0))
@@ -213,7 +213,7 @@ Connection::open(NetVCOptions const& opt)
ink_assert(fd == NO_FD);
int enable_reuseaddr = 1; // used for sockopt setting
int res = 0; // temp result
- ts_ip_endpoint local_addr;
+ IpEndpoint local_addr;
int sock_type = NetVCOptions::USE_UDP == opt.ip_proto
? SOCK_DGRAM
: SOCK_STREAM;
@@ -234,7 +234,7 @@ Connection::open(NetVCOptions const& opt)
family = opt.local_ip.family();
} else {
// No local address specified, so use family option if possible.
- family = ink_inet_is_ip(opt.ip_family) ? opt.ip_family : AF_INET;
+ family = ats_is_ip(opt.ip_family) ? opt.ip_family : AF_INET;
local_addr.setToAnyAddr(family);
local_addr.port() = htons(opt.local_port);
}
@@ -305,7 +305,7 @@ Connection::open(NetVCOptions const& opt)
}
}
- if (-1 == socketManager.ink_bind(fd, &local_addr.sa, ink_inet_ip_size(&local_addr.sa)))
+ if (-1 == socketManager.ink_bind(fd, &local_addr.sa, ats_ip_size(&local_addr.sa)))
return -errno;
cleanup.reset();
@@ -325,7 +325,7 @@ Connection::connect(sockaddr const* target, NetVCOptions const& opt) {
cleaner<Connection> cleanup(this, &Connection::_cleanup); // mark for close until we succeed.
- res = ::connect(fd, target, ink_inet_ip_size(target));
+ res = ::connect(fd, target, ats_ip_size(target));
// It's only really an error if either the connect was blocking
// or it wasn't blocking and the error was other than EINPROGRESS.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/iocore/net/UnixNetAccept.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixNetAccept.cc b/iocore/net/UnixNetAccept.cc
index a3d9817..1e11eac 100644
--- a/iocore/net/UnixNetAccept.cc
+++ b/iocore/net/UnixNetAccept.cc
@@ -118,7 +118,7 @@ net_accept(NetAccept * na, void *ep, bool blockable)
na->alloc_cache = NULL;
vc->submit_time = ink_get_hrtime();
- ink_inet_copy(&vc->server_addr, &vc->con.addr);
+ ats_ip_copy(&vc->server_addr, &vc->con.addr);
vc->mutex = new_ProxyMutex();
vc->action_ = *na->action_;
vc->set_is_transparent(na->server.f_inbound_transparent);
@@ -314,7 +314,7 @@ NetAccept::do_blocking_accept(EThread * t)
NET_SUM_GLOBAL_DYN_STAT(net_connections_currently_open_stat, 1);
vc->submit_time = now;
- ink_inet_copy(&vc->server_addr, &vc->con.addr);
+ ats_ip_copy(&vc->server_addr, &vc->con.addr);
vc->set_is_transparent(server.f_inbound_transparent);
vc->mutex = new_ProxyMutex();
vc->action_ = *action_;
@@ -356,10 +356,10 @@ NetAccept::acceptEvent(int event, void *ep)
NET_DECREMENT_DYN_STAT(net_accepts_currently_open_stat);
/* INKqa11179 */
Warning("Accept on port %d failed with error no %d",
- ink_inet_get_port(&server.addr), res
+ ats_ip_port_host_order(&server.addr), res
);
Warning("Traffic Server may be unable to accept more network" "connections on %d",
- ink_inet_get_port(&server.addr)
+ ats_ip_port_host_order(&server.addr)
);
e->cancel();
delete this;
@@ -455,7 +455,7 @@ NetAccept::acceptFastEvent(int event, void *ep)
vc->id = net_next_connection_number();
vc->submit_time = ink_get_hrtime();
- ink_inet_copy(&vc->server_addr, &vc->con.addr);
+ ats_ip_copy(&vc->server_addr, &vc->con.addr);
vc->set_is_transparent(server.f_inbound_transparent);
vc->mutex = new_ProxyMutex();
vc->thread = e->ethread;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/iocore/net/UnixNetPages.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixNetPages.cc b/iocore/net/UnixNetPages.cc
index f68ef6c..dfcc28f 100644
--- a/iocore/net/UnixNetPages.cc
+++ b/iocore/net/UnixNetPages.cc
@@ -34,7 +34,7 @@ typedef int (ShowNet::*ShowNetEventHandler) (int event, Event * data);
struct ShowNet: public ShowCont
{
int ithread;
- ts_ip_endpoint addr;
+ IpEndpoint addr;
int showMain(int event, Event * e)
{
@@ -63,13 +63,13 @@ struct ShowNet: public ShowCont
ink_hrtime now = ink_get_hrtime();
forl_LL(UnixNetVConnection, vc, nh->open_list) {
-// uint16_t port = ink_inet_get_port(&addr.sa);
- if (ink_inet_is_ip(&addr) && addr != vc->server_addr)
+// uint16_t port = ats_ip_port_host_order(&addr.sa);
+ if (ats_is_ip(&addr) && addr != vc->server_addr)
continue;
-// if (port && port != ink_inet_get_port(&vc->server_addr.sa) && port != vc->accept_port)
+// if (port && port != ats_ip_port_host_order(&vc->server_addr.sa) && port != vc->accept_port)
// continue;
char ipbuf[INET6_ADDRSTRLEN];
- ink_inet_ntop(&vc->server_addr.sa, ipbuf, sizeof(ipbuf));
+ ats_ip_ntop(&vc->server_addr.sa, ipbuf, sizeof(ipbuf));
char opt_ipbuf[INET6_ADDRSTRLEN];
char interbuf[80];
snprintf(interbuf, sizeof(interbuf), "[%s] %s:%d",
@@ -100,7 +100,7 @@ struct ShowNet: public ShowCont
"</tr>\n",
vc->id,
ipbuf,
- ink_inet_get_port(&vc->server_addr),
+ ats_ip_port_host_order(&vc->server_addr),
vc->con.fd,
interbuf,
// vc->accept_port,
@@ -233,7 +233,7 @@ register_ShowNet(Continuation * c, HTTPHdr * h)
if (s->sarg)
gn = (char *)memchr(s->sarg, '=', strlen(s->sarg));
if (gn)
- ink_inet_pton(gn + 1, &s->addr);
+ ats_ip_pton(gn + 1, &s->addr);
SET_CONTINUATION_HANDLER(s, &ShowNet::showConnections);
} else if (STREQ_PREFIX(path, path_len, "ports")) {
int query_len;
@@ -243,7 +243,7 @@ register_ShowNet(Continuation * c, HTTPHdr * h)
if (s->sarg)
gn = (char *)memchr(s->sarg, '=', strlen(s->sarg));
if (gn)
- ink_inet_port_cast(&s->addr.sa) = htons(atoi(gn+1));
+ ats_ip_port_cast(&s->addr.sa) = htons(atoi(gn+1));
SET_CONTINUATION_HANDLER(s, &ShowNet::showConnections);
}
eventProcessor.schedule_imm(s, ET_TASK);
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/iocore/net/UnixNetProcessor.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixNetProcessor.cc b/iocore/net/UnixNetProcessor.cc
index 1b49745..512a68a 100644
--- a/iocore/net/UnixNetProcessor.cc
+++ b/iocore/net/UnixNetProcessor.cc
@@ -94,7 +94,7 @@ UnixNetProcessor::accept_internal(
EThread *thread = this_ethread();
ProxyMutex *mutex = thread->mutex;
int accept_threads = opt.accept_threads; // might be changed.
- ts_ip_endpoint accept_ip; // local binding address.
+ IpEndpoint accept_ip; // local binding address.
// Potentially upgrade to SSL.
upgradeEtype(et);
@@ -118,7 +118,7 @@ UnixNetProcessor::accept_internal(
na->accept_fn = net_accept; // All callers used this.
na->server.fd = fd;
- ink_inet_copy(&na->server.accept_addr, &accept_ip);
+ ats_ip_copy(&na->server.accept_addr, &accept_ip);
na->server.f_inbound_transparent = opt.f_inbound_transparent;
if (opt.f_inbound_transparent) {
Debug(
@@ -153,10 +153,10 @@ UnixNetProcessor::accept_internal(
a = createNetAccept();
*a = *na;
a->init_accept_loop();
- Debug("iocore_net_accept", "Created accept thread #%d for port %d", i, ink_inet_get_port(&accept_ip));
+ Debug("iocore_net_accept", "Created accept thread #%d for port %d", i, ats_ip_port_host_order(&accept_ip));
}
// Start the "template" accept thread last.
- Debug("iocore_net_accept", "Created accept thread #%d for port %d", accept_threads, ink_inet_get_port(&accept_ip));
+ Debug("iocore_net_accept", "Created accept thread #%d for port %d", accept_threads, ats_ip_port_host_order(&accept_ip));
na->init_accept_loop();
}
} else {
@@ -220,23 +220,23 @@ UnixNetProcessor::connect_re_internal(
vc->id = net_next_connection_number();
vc->submit_time = ink_get_hrtime();
vc->setSSLClientConnection(true);
- ink_inet_copy(&vc->server_addr, target);
+ ats_ip_copy(&vc->server_addr, target);
vc->mutex = cont->mutex;
Action *result = &vc->action_;
#ifndef INK_NO_SOCKS
if (using_socks) {
char buff[INET6_ADDRPORTSTRLEN];
- Debug("Socks", "Using Socks ip: %s\n", ink_inet_nptop(target, buff, sizeof(buff)));
+ Debug("Socks", "Using Socks ip: %s\n", ats_ip_nptop(target, buff, sizeof(buff)));
socksEntry = socksAllocator.alloc();
socksEntry->init(cont->mutex, vc, opt->socks_support, opt->socks_version); /*XXXX remove last two args */
socksEntry->action_ = cont;
cont = socksEntry;
- if (!ink_inet_is_ip(&socksEntry->server_addr)) {
+ if (!ats_is_ip(&socksEntry->server_addr)) {
socksEntry->lerrno = ESOCK_NO_SOCK_SERVER_CONN;
socksEntry->free();
return ACTION_RESULT_DONE;
}
- ink_inet_copy(&vc->server_addr, &socksEntry->server_addr);
+ ats_ip_copy(&vc->server_addr, &socksEntry->server_addr);
result = &socksEntry->action_;
vc->action_ = socksEntry;
} else {
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/iocore/net/UnixUDPNet.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixUDPNet.cc b/iocore/net/UnixUDPNet.cc
index c472bbe..d61311c 100644
--- a/iocore/net/UnixUDPNet.cc
+++ b/iocore/net/UnixUDPNet.cc
@@ -146,7 +146,7 @@ UDPNetProcessorInternal::udp_read_from_net(UDPNetHandler * nh,
break;
}
// create packet
- UDPPacket *p = new_incoming_UDPPacket(ink_inet_sa_cast(&fromaddr), buf, r);
+ UDPPacket *p = new_incoming_UDPPacket(ats_ip_sa_cast(&fromaddr), buf, r);
p->setConnection(uc);
// XXX: is this expensive? I] really want to know this information
p->setArrivalTime(ink_get_hrtime_internal());
@@ -285,7 +285,7 @@ UDPReadContinuation::init_read(int rfd, IOBufferBlock * buf, int len, struct soc
fd = rfd;
readbuf = buf;
readlen = len;
- fromaddr = ink_inet_ip6_cast(fromaddr_);
+ fromaddr = ats_ip6_cast(fromaddr_);
fromaddrlen = fromaddrlen_;
SET_HANDLER(&UDPReadContinuation::readPollEvent);
period = NET_PERIOD;
@@ -362,7 +362,7 @@ UDPReadContinuation::readPollEvent(int event_, Event * e)
socklen_t tmp_fromlen = *fromaddrlen;
int rlen = socketManager.recvfrom(fd, readbuf->end(), readlen,
0, // default flags
- ink_inet_sa_cast(fromaddr), &tmp_fromlen);
+ ats_ip_sa_cast(fromaddr), &tmp_fromlen);
completionUtil::setThread(event, e->ethread);
// call back user with their event
if (rlen > 0) {
@@ -548,7 +548,7 @@ UDPNetProcessor::CreateUDPSocket(
) {
int res = 0, fd = -1;
- ink_assert(ink_inet_are_compatible(remote_addr, local_addr));
+ ink_assert(ats_ip_are_compatible(remote_addr, local_addr));
*resfd = -1;
if ((res = socketManager.socket(remote_addr->sa_family, SOCK_DGRAM, 0)) < 0)
@@ -556,9 +556,9 @@ UDPNetProcessor::CreateUDPSocket(
fd = res;
if ((res = safe_fcntl(fd, F_SETFL, O_NONBLOCK)) < 0)
goto HardError;
- if ((res = socketManager.ink_bind(fd, remote_addr, ink_inet_ip_size(remote_addr), IPPROTO_UDP)) < 0) {
+ if ((res = socketManager.ink_bind(fd, remote_addr, ats_ip_size(remote_addr), IPPROTO_UDP)) < 0) {
char buff[INET6_ADDRPORTSTRLEN];
- Debug("udpnet", "ink bind failed on %s", ink_inet_nptop(remote_addr, buff, sizeof(buff)));
+ Debug("udpnet", "ink bind failed on %s", ats_ip_nptop(remote_addr, buff, sizeof(buff)));
goto SoftError;
}
@@ -577,12 +577,12 @@ UDPNetProcessor::CreateUDPSocket(
*resfd = fd;
*status = NULL;
Debug("udpnet", "creating a udp socket port = %d, %d---success",
- ink_inet_get_port(remote_addr), ink_inet_get_port(local_addr)
+ ats_ip_port_host_order(remote_addr), ats_ip_port_host_order(local_addr)
);
return true;
SoftError:
Debug("udpnet", "creating a udp socket port = %d---soft failure",
- ink_inet_get_port(local_addr)
+ ats_ip_port_host_order(local_addr)
);
if (fd != -1)
socketManager.close(fd);
@@ -591,7 +591,7 @@ SoftError:
return false;
HardError:
Debug("udpnet", "creating a udp socket port = %d---hard failure",
- ink_inet_get_port(local_addr)
+ ats_ip_port_host_order(local_addr)
);
if (fd != -1)
socketManager.close(fd);
@@ -603,7 +603,7 @@ HardError:
void
UDPNetProcessor::UDPClassifyConnection(
Continuation * udpConn,
- InkInetAddr const& destIP
+ IpAddr const& destIP
) {
int i;
UDPConnectionInternal *p = static_cast<UDPConnectionInternal *>(udpConn);
@@ -619,7 +619,7 @@ UDPNetProcessor::UDPClassifyConnection(
p->pipe_class = i;
// no match; set it to the null class
if (p->pipe_class == -1) {
- InkInetAddr null; // default constructed -> invalid value.
+ IpAddr null; // default constructed -> invalid value.
for (i = 0; i < G_inkPipeInfo.numPipes + 1; ++i)
if (G_inkPipeInfo.perPipeInfo[i].destIP == null) {
p->pipe_class = i;
@@ -639,7 +639,7 @@ UDPNetProcessor::UDPBind(Continuation * cont, sockaddr const* addr, int send_buf
int res = 0;
int fd = -1;
UnixUDPConnection *n = NULL;
- ts_ip_endpoint myaddr;
+ IpEndpoint myaddr;
int myaddr_len = sizeof(myaddr);
if ((res = socketManager.socket(addr->sa_family, SOCK_DGRAM, 0)) < 0)
@@ -649,7 +649,7 @@ UDPNetProcessor::UDPBind(Continuation * cont, sockaddr const* addr, int send_buf
goto Lerror;
// If this is a class D address (i.e. multicast address), use REUSEADDR.
- if (ink_inet_is_multicast(addr)) {
+ if (ats_is_ip_multicast(addr)) {
int enable_reuseaddr = 1;
if ((res = safe_setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *) &enable_reuseaddr, sizeof(enable_reuseaddr)) < 0)) {
@@ -657,7 +657,7 @@ UDPNetProcessor::UDPBind(Continuation * cont, sockaddr const* addr, int send_buf
}
}
- if ((res = socketManager.ink_bind(fd, addr, ink_inet_ip_size(addr))) < 0) {
+ if ((res = socketManager.ink_bind(fd, addr, ats_ip_size(addr))) < 0) {
goto Lerror;
}
@@ -1260,8 +1260,8 @@ UDPWorkContinuation::init(Continuation * c, int num_pairs,
cont = c;
action = c;
numPairs = num_pairs;
- ink_inet_copy(&local_ip, local_addr);
- ink_inet_copy(&remote_ip, remote_addr);
+ ats_ip_copy(&local_ip, local_addr);
+ ats_ip_copy(&remote_ip, remote_addr);
sendbufsize = s_bufsize;
recvbufsize = r_bufsize;
udpConns = NULL;
@@ -1276,8 +1276,8 @@ UDPWorkContinuation::StateCreatePortPairs(int event, void *data)
// int res = 0;
int numUdpPorts = 2 * numPairs;
int fd1 = -1, fd2 = -1;
- ts_ip_endpoint target;
- ts_ip_endpoint myaddr1, myaddr2;
+ IpEndpoint target;
+ IpEndpoint myaddr1, myaddr2;
int portNum, i;
// int myaddr_len = sizeof(myaddr1);
static int lastAllocPort = 10000;
@@ -1297,7 +1297,7 @@ UDPWorkContinuation::StateCreatePortPairs(int event, void *data)
}
startTime = ink_get_hrtime_internal();
- ink_inet_copy(&target, &remote_ip);
+ ats_ip_copy(&target, &remote_ip);
udpConns = NEW(new UnixUDPConnection *[numUdpPorts]);
for (i = 0; i < numUdpPorts; i++)
@@ -1312,13 +1312,13 @@ UDPWorkContinuation::StateCreatePortPairs(int event, void *data)
int myaddr1_len = sizeof(myaddr1);
int myaddr2_len = sizeof(myaddr2);
- ink_inet_port_cast(&target) = htons(portNum);
+ ats_ip_port_cast(&target) = htons(portNum);
if (udpNet.CreateUDPSocket(&fd1,
&target.sa,
&myaddr1.sa,
&myaddr1_len,
&status, sendbufsize, recvbufsize)) {
- ink_inet_port_cast(&target) = htons(portNum + 1);
+ ats_ip_port_cast(&target) = htons(portNum + 1);
if (udpNet.CreateUDPSocket(&fd2,
&target.sa,
&myaddr2.sa,
@@ -1357,7 +1357,7 @@ UDPWorkContinuation::StateCreatePortPairs(int event, void *data)
}
for (i = 0; i < numUdpPorts; i++) {
- udpNet.UDPClassifyConnection(udpConns[i], InkInetAddr(target));
+ udpNet.UDPClassifyConnection(udpConns[i], IpAddr(target));
Debug("udpnet-pipe", "Adding (port = %d) to Pipe class: %d",
udpConns[i]->getPortNum(), udpConns[i]->pipe_class);
}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/iocore/utils/I_Machine.h
----------------------------------------------------------------------
diff --git a/iocore/utils/I_Machine.h b/iocore/utils/I_Machine.h
index 91cfa85..dc93850 100644
--- a/iocore/utils/I_Machine.h
+++ b/iocore/utils/I_Machine.h
@@ -52,9 +52,9 @@ struct Machine {
char *hostname; // name of the internet host
int hostname_len; // size of the string pointed to by hostname
- ts_ip_endpoint ip; ///< Prefered IP address of the host (network order)
- ts_ip_endpoint ip4; ///< IPv4 address if present.
- ts_ip_endpoint ip6; ///< IPv6 address if present.
+ IpEndpoint ip; ///< Prefered IP address of the host (network order)
+ IpEndpoint ip4; ///< IPv4 address if present.
+ IpEndpoint ip6; ///< IPv6 address if present.
ip_text_buffer ip_string; // IP address of the host as a string.
int ip_string_len;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/47d1f8ec/iocore/utils/Machine.cc
----------------------------------------------------------------------
diff --git a/iocore/utils/Machine.cc b/iocore/utils/Machine.cc
index c13506b..64ab53c 100644
--- a/iocore/utils/Machine.cc
+++ b/iocore/utils/Machine.cc
@@ -61,7 +61,7 @@ Machine::Machine(char const* the_hostname, sockaddr const* addr)
localhost[sizeof(localhost)-1] = 0; // ensure termination.
- if (!ink_inet_is_ip(addr)) {
+ if (!ats_is_ip(addr)) {
if (!the_hostname) {
ink_release_assert(!gethostname(localhost, sizeof(localhost)-1));
the_hostname = localhost;
@@ -118,22 +118,22 @@ Machine::Machine(char const* the_hostname, sockaddr const* addr)
ifip = &spot->ifr_addr;
# endif
- if (!ink_inet_is_ip(ifip)) spot_type = NA;
- else if (ink_inet_is_loopback(ifip)) spot_type = LO;
- else if (ink_inet_is_nonroutable(ifip)) spot_type = NR;
- else if (ink_inet_is_multicast(ifip)) spot_type = MC;
+ if (!ats_is_ip(ifip)) spot_type = NA;
+ else if (ats_is_ip_loopback(ifip)) spot_type = LO;
+ else if (ats_is_ip_nonroutable(ifip)) spot_type = NR;
+ else if (ats_is_ip_multicast(ifip)) spot_type = MC;
else spot_type = GA;
if (spot_type == NA) continue; // Next!
- if (ink_inet_is_ip4(ifip)) {
+ if (ats_is_ip4(ifip)) {
if (spot_type > ip4_type) {
- ink_inet_copy(&ip4, ifip);
+ ats_ip_copy(&ip4, ifip);
ip4_type = spot_type;
}
- } else if (ink_inet_is_ip6(ifip)) {
+ } else if (ats_is_ip6(ifip)) {
if (spot_type > ip6_type) {
- ink_inet_copy(&ip6, ifip);
+ ats_ip_copy(&ip6, ifip);
ip6_type = spot_type;
}
}
@@ -145,17 +145,17 @@ Machine::Machine(char const* the_hostname, sockaddr const* addr)
// What about the general address? Prefer IPv4?
if (ip4_type >= ip6_type)
- ink_inet_copy(&ip.sa, &ip4.sa);
+ ats_ip_copy(&ip.sa, &ip4.sa);
else
- ink_inet_copy(&ip.sa, &ip6.sa);
+ ats_ip_copy(&ip.sa, &ip6.sa);
}
} else { // address provided.
- ink_inet_copy(&ip, addr);
- if (ink_inet_is_ip4(addr)) ink_inet_copy(&ip4, addr);
- else if (ink_inet_is_ip6(addr)) ink_inet_copy(&ip6, addr);
+ ats_ip_copy(&ip, addr);
+ if (ats_is_ip4(addr)) ats_ip_copy(&ip4, addr);
+ else if (ats_is_ip6(addr)) ats_ip_copy(&ip6, addr);
status = getnameinfo(
- addr, ink_inet_ip_size(addr),
+ addr, ats_ip_size(addr),
localhost, sizeof(localhost) - 1,
0, 0, // do not request service info
0 // no flags.
@@ -164,7 +164,7 @@ Machine::Machine(char const* the_hostname, sockaddr const* addr)
if (0 != status) {
ip_text_buffer ipbuff;
Warning("Failed to find hostname for address '%s' - %s"
- , ink_inet_ntop(addr, ipbuff, sizeof(ipbuff))
+ , ats_ip_ntop(addr, ipbuff, sizeof(ipbuff))
, gai_strerror(status)
);
} else
@@ -173,9 +173,9 @@ Machine::Machine(char const* the_hostname, sockaddr const* addr)
hostname_len = hostname ? strlen(hostname) : 0;
- ink_inet_ntop(&ip.sa, ip_string, sizeof(ip_string));
+ ats_ip_ntop(&ip.sa, ip_string, sizeof(ip_string));
ip_string_len = strlen(ip_string);
- ip_hex_string_len = ink_inet_to_hex(&ip.sa, ip_hex_string, sizeof(ip_hex_string));
+ ip_hex_string_len = ats_ip_to_hex(&ip.sa, ip_hex_string, sizeof(ip_hex_string));
}
Machine::~Machine()