Skip to content
Browse files

TS-995 changes.

  • Loading branch information...
1 parent c2cd672 commit 47d1f8ec485db09892715ef5f6a4638fd006319b @SolidWallOfCode SolidWallOfCode committed Feb 21, 2012
Showing with 1,038 additions and 1,081 deletions.
  1. +42 −42 iocore/dns/DNS.cc
  2. +13 −13 iocore/dns/DNSConnection.cc
  3. +3 −3 iocore/dns/I_DNSProcessor.h
  4. +1 −1 iocore/dns/P_DNSConnection.h
  5. +4 −4 iocore/dns/P_DNSProcessor.h
  6. +1 −1 iocore/dns/P_SplitDNSProcessor.h
  7. +6 −6 iocore/dns/SplitDNS.cc
  8. +55 −55 iocore/hostdb/HostDB.cc
  9. +10 −10 iocore/hostdb/I_HostDBProcessor.h
  10. +9 −9 iocore/hostdb/P_HostDBProcessor.h
  11. +8 −8 iocore/net/Connection.cc
  12. +5 −5 iocore/net/I_NetProcessor.h
  13. +4 −4 iocore/net/I_NetVConnection.h
  14. +1 −1 iocore/net/I_UDPNet.h
  15. +2 −2 iocore/net/I_UDPPacket.h
  16. +10 −10 iocore/net/P_Connection.h
  17. +9 −9 iocore/net/P_NetVConnection.h
  18. +3 −3 iocore/net/P_Socks.h
  19. +4 −4 iocore/net/P_UDPConnection.h
  20. +3 −3 iocore/net/P_UDPNet.h
  21. +4 −4 iocore/net/P_UDPPacket.h
  22. +2 −2 iocore/net/P_UnixNetVConnection.h
  23. +2 −2 iocore/net/SSLNetVConnection.cc
  24. +17 −17 iocore/net/Socks.cc
  25. +10 −10 iocore/net/UnixConnection.cc
  26. +5 −5 iocore/net/UnixNetAccept.cc
  27. +8 −8 iocore/net/UnixNetPages.cc
  28. +8 −8 iocore/net/UnixNetProcessor.cc
  29. +22 −22 iocore/net/UnixUDPNet.cc
  30. +3 −3 iocore/utils/I_Machine.h
  31. +18 −18 iocore/utils/Machine.cc
  32. +8 −8 lib/records/I_RecHttp.h
  33. +10 −10 lib/records/RecHttp.cc
  34. +19 −19 lib/ts/IpMap.cc
  35. +10 −10 lib/ts/IpMap.h
  36. +2 −2 lib/ts/IpMapConf.cc
  37. +13 −13 lib/ts/IpMapTest.cc
  38. +15 −15 lib/ts/MatcherUtils.cc
  39. +1 −1 lib/ts/MatcherUtils.h
  40. +54 −66 lib/ts/ink_inet.cc
  41. +235 −245 lib/ts/ink_inet.h
  42. +11 −11 lib/ts/ink_res_init.cc
  43. +2 −2 lib/ts/ink_resolver.h
  44. +7 −7 mgmt/LocalManager.cc
  45. +2 −2 mgmt/LocalManager.h
  46. +1 −21 mgmt/utils/MgmtUtils.cc
  47. +0 −1 mgmt/utils/MgmtUtils.h
  48. +6 −6 proxy/ControlBase.cc
  49. +3 −3 proxy/ControlMatcher.cc
  50. +2 −2 proxy/ControlMatcher.h
  51. +2 −2 proxy/CoreUtils.cc
  52. +2 −2 proxy/FetchSM.cc
  53. +39 −39 proxy/ICP.cc
  54. +24 −24 proxy/ICP.h
  55. +25 −25 proxy/ICPConfig.cc
  56. +5 −5 proxy/IPAllow.cc
  57. +2 −2 proxy/IPAllow.h
  58. +25 −25 proxy/InkAPI.cc
  59. +17 −17 proxy/InkAPITest.cc
  60. +2 −2 proxy/InkAPITestTool.cc
  61. +5 −5 proxy/InkIOCoreAPI.cc
  62. +1 −1 proxy/Main.cc
  63. +8 −8 proxy/ParentSelection.cc
  64. +6 −6 proxy/PluginVC.cc
  65. +2 −2 proxy/PluginVC.h
  66. +25 −25 proxy/Prefetch.cc
  67. +11 −11 proxy/Prefetch.h
  68. +2 −2 proxy/SimpleHttp.cc
  69. +1 −1 proxy/Update.cc
  70. +2 −2 proxy/api/ts/InkAPIHughes.h
  71. +6 −6 proxy/congest/Congestion.cc
  72. +1 −1 proxy/congest/Congestion.h
  73. +5 −5 proxy/congest/CongestionDB.cc
  74. +7 −7 proxy/congest/CongestionTest.cc
  75. +2 −2 proxy/http/HttpAccept.cc
  76. +6 −6 proxy/http/HttpAccept.h
  77. +2 −2 proxy/http/HttpClientSession.h
  78. +2 −2 proxy/http/HttpConfig.h
  79. +7 −7 proxy/http/HttpConnectionCount.h
  80. +23 −23 proxy/http/HttpSM.cc
  81. +2 −2 proxy/http/HttpServerSession.cc
  82. +1 −1 proxy/http/HttpServerSession.h
  83. +6 −6 proxy/http/HttpSessionManager.cc
  84. +37 −37 proxy/http/HttpTransact.cc
  85. +1 −1 proxy/http/HttpTransact.h
  86. +1 −1 proxy/http/HttpUpdateSM.cc
  87. +2 −2 proxy/http/remap/AclFiltering.cc
  88. +4 −4 proxy/http/remap/AclFiltering.h
  89. +2 −2 proxy/http/remap/RemapProcessor.cc
  90. +1 −1 proxy/http/remap/UrlRewrite.cc
  91. +12 −12 proxy/logging/LogAccess.cc
  92. +1 −1 proxy/logging/LogAccess.h
  93. +2 −2 proxy/logging/LogAccessHttp.cc
  94. +4 −4 proxy/logging/LogAccessTest.cc
  95. +2 −2 proxy/logging/LogCollationClientSM.cc
View
84 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;
}
View
26 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,20 +142,20 @@ 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;
}
goto Lok;
}
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)
View
6 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);
}
View
2 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;
View
8 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;
View
2 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];
View
12 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,15 +517,15 @@ 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;
}
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));
}
}
View
110 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,15 +965,15 @@ 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;
return;
}
}
} 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++;
View
20 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. */
View
18 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;
View
16 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;
}
View
10 iocore/net/I_NetProcessor.h
@@ -51,7 +51,7 @@ class NetProcessor:public Processor
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 @@ class NetProcessor:public Processor
) {
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 @@ class NetProcessor:public Processor
) {
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);
}
/**
View
8 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 @@ class NetVConnection:public VConnection
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;
View
2 iocore/net/I_UDPNet.h
@@ -82,7 +82,7 @@ class UDPNetProcessor:public Processor
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
View
4 iocore/net/I_UDPPacket.h
@@ -65,8 +65,8 @@ class UDPPacket
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;
View
20 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 @@ struct Connection
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;
View
18 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,14 +70,14 @@ 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;
}
/// @return The local port in host order.
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());
}
View
6 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;
View
8 iocore/net/P_UDPConnection.h
@@ -46,7 +46,7 @@ class UDPConnectionInternal:public UDPConnection
int refcount; // public for assertion
SOCKET fd;
- ts_ip_endpoint binding;
+ IpEndpoint binding;
int binding_valid;
int tobedestroyed;
int sendGenerationNum;
@@ -113,15 +113,15 @@ 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;
}
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
View
6 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 @@ class UDPWorkContinuation:public Continuation
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;
View
8 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));
View
4 iocore/net/P_UnixNetVConnection.h
@@ -208,7 +208,7 @@ class UnixNetVConnection:public NetVConnection
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
View
4 iocore/net/SSLNetVConnection.cc
@@ -469,15 +469,15 @@ 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) {
if (ssl == NULL) {
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;
View
34 iocore/net/Socks.cc
@@ -54,19 +54,19 @@ 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;
req_data.hostname_str = 0;
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,
View
20 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.
View
10 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;
View
16 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);
View
16 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);