On MinGW at least macro replacement appears to be case insensitive.
The lower-case freeaddrinfo/initaddrinfo system functions are defined
with macros, both in MinGW headers and Squid libcompat.
ftpState->writeCommand(cbuf);
ftpState->state = Ftp::Client::SENT_PORT;
- Ip::Address::FreeAddrInfo(AI);
+ Ip::Address::FreeAddr(AI);
}
static void
++ statCounter.syscalls.sock.recvfroms;
debugs(5,8, "comm_udp_recvfrom: FD " << fd << " from " << from);
struct addrinfo *AI = NULL;
- Ip::Address::InitAddrInfo(AI);
+ Ip::Address::InitAddr(AI);
int x = recvfrom(fd, buf, len, flags, AI->ai_addr, &AI->ai_addrlen);
from = *AI;
- Ip::Address::FreeAddrInfo(AI);
+ Ip::Address::FreeAddr(AI);
return x;
}
if (F->sock_family == AF_INET)
temp.setIPv4();
- Ip::Address::InitAddrInfo(addr);
+ Ip::Address::InitAddr(addr);
if (getsockname(fd, addr->ai_addr, &(addr->ai_addrlen)) ) {
debugs(50, DBG_IMPORTANT, "comm_local_port: Failed to retrieve TCP/UDP port number for socket: FD " << fd << ": " << xstrerror());
- Ip::Address::FreeAddrInfo(addr);
+ Ip::Address::FreeAddr(addr);
return 0;
}
temp = *addr;
- Ip::Address::FreeAddrInfo(addr);
+ Ip::Address::FreeAddr(addr);
if (F->local_addr.isAnyAddr()) {
/* save the whole local address, not just the port. */
/* try again as IPv4-native if possible */
if ( new_socket < 0 && Ip::EnableIpv6 && addr.isIPv6() && addr.setIPv4() ) {
/* attempt to open this IPv4-only. */
- Ip::Address::FreeAddrInfo(AI);
+ Ip::Address::FreeAddr(AI);
/* Setup the socket addrinfo details for use */
addr.getAddrInfo(AI);
AI->ai_socktype = sock_type;
debugs(50, DBG_CRITICAL, "comm_open: socket failure: " << xstrerror());
}
- Ip::Address::FreeAddrInfo(AI);
+ Ip::Address::FreeAddr(AI);
PROF_stop(comm_open);
return -1;
comm_init_opened(conn, note, AI);
new_socket = comm_apply_flags(conn->fd, addr, flags, AI);
- Ip::Address::FreeAddrInfo(AI);
+ Ip::Address::FreeAddr(AI);
PROF_stop(comm_open);
}
- Ip::Address::FreeAddrInfo(AI);
+ Ip::Address::FreeAddr(AI);
PROF_stop(comm_connect_addr);
struct addrinfo *AI = NULL;
to_addr.getAddrInfo(AI, fd_table[fd].sock_family);
int x = sendto(fd, buf, len, 0, AI->ai_addr, AI->ai_addrlen);
- Ip::Address::FreeAddrInfo(AI);
+ Ip::Address::FreeAddr(AI);
PROF_stop(comm_udp_sendto);
Comm::ConnOpener::lookupLocalAddress()
{
struct addrinfo *addr = NULL;
- Ip::Address::InitAddrInfo(addr);
+ Ip::Address::InitAddr(addr);
if (getsockname(conn_->fd, addr->ai_addr, &(addr->ai_addrlen)) != 0) {
debugs(50, DBG_IMPORTANT, "ERROR: Failed to retrieve TCP/UDP details for socket: " << conn_ << ": " << xstrerror());
- Ip::Address::FreeAddrInfo(addr);
+ Ip::Address::FreeAddr(addr);
return;
}
conn_->local = *addr;
- Ip::Address::FreeAddrInfo(addr);
+ Ip::Address::FreeAddr(addr);
debugs(5, 6, HERE << conn_);
}
++statCounter.syscalls.sock.accepts;
int sock;
struct addrinfo *gai = NULL;
- Ip::Address::InitAddrInfo(gai);
+ Ip::Address::InitAddr(gai);
errcode = 0; // reset local errno copy.
if ((sock = accept(conn->fd, gai->ai_addr, &gai->ai_addrlen)) < 0) {
errcode = errno; // store last accept errno locally.
- Ip::Address::FreeAddrInfo(gai);
+ Ip::Address::FreeAddr(gai);
PROF_stop(comm_accept);
if ( Config.client_ip_max_connections >= 0) {
if (clientdbEstablished(details->remote, 0) > Config.client_ip_max_connections) {
debugs(50, DBG_IMPORTANT, "WARNING: " << details->remote << " attempting more than " << Config.client_ip_max_connections << " connections.");
- Ip::Address::FreeAddrInfo(gai);
+ Ip::Address::FreeAddr(gai);
return Comm::COMM_ERROR;
}
}
// lookup the local-end details of this new connection
- Ip::Address::InitAddrInfo(gai);
+ Ip::Address::InitAddr(gai);
details->local.setEmpty();
if (getsockname(sock, gai->ai_addr, &gai->ai_addrlen) != 0) {
debugs(50, DBG_IMPORTANT, "ERROR: getsockname() failed to locate local-IP on " << details << ": " << xstrerror());
- Ip::Address::FreeAddrInfo(gai);
+ Ip::Address::FreeAddr(gai);
return Comm::COMM_ERROR;
}
details->local = *gai;
- Ip::Address::FreeAddrInfo(gai);
+ Ip::Address::FreeAddr(gai);
/* fdstat update */
// XXX : these are not all HTTP requests. use a note about type and ip:port details->
}
Log(to, ' ', NULL, 0, 0);
- Ip::Address::FreeAddrInfo(S);
+ Ip::Address::FreeAddr(S);
}
void
if (pkt == NULL)
pkt = (char *)xmalloc(MAX_PKT4_SZ);
- Ip::Address::InitAddrInfo(from);
+ Ip::Address::InitAddr(from);
n = recvfrom(icmp_sock,
(void *)pkt,
MAX_PKT4_SZ,
if (n <= 0) {
debugs(42, DBG_CRITICAL, HERE << "Error when calling recvfrom() on ICMP socket.");
- Ip::Address::FreeAddrInfo(from);
+ Ip::Address::FreeAddr(from);
return;
}
icmp = (struct icmphdr *) (void *) (pkt + iphdrlen);
if (icmp->icmp_type != ICMP_ECHOREPLY) {
- Ip::Address::FreeAddrInfo(from);
+ Ip::Address::FreeAddr(from);
return;
}
if (icmp->icmp_id != icmp_ident) {
- Ip::Address::FreeAddrInfo(from);
+ Ip::Address::FreeAddr(from);
return;
}
if (preply.psize < 0) {
debugs(42, DBG_CRITICAL, HERE << "Malformed ICMP packet.");
- Ip::Address::FreeAddrInfo(from);
+ Ip::Address::FreeAddr(from);
return;
}
control.SendResult(preply, (sizeof(pingerReplyData) - MAX_PKT4_SZ + preply.psize) );
Log(preply.from, icmp->icmp_type, IcmpPacketType(icmp->icmp_type), preply.rtt, preply.hops);
- Ip::Address::FreeAddrInfo(from);
+ Ip::Address::FreeAddr(from);
}
#endif /* USE_ICMP */
debugs(42,9, HERE << "x=" << x);
Log(to, 0, NULL, 0, 0);
- Ip::Address::FreeAddrInfo(S);
+ Ip::Address::FreeAddr(S);
}
/**
pkt = (char *)xmalloc(MAX_PKT6_SZ);
}
- Ip::Address::InitAddrInfo(from);
+ Ip::Address::InitAddr(from);
n = recvfrom(icmp_sock,
(void *)pkt,
if (n <= 0) {
debugs(42, DBG_CRITICAL, HERE << "Error when calling recvfrom() on ICMPv6 socket.");
- Ip::Address::FreeAddrInfo(from);
+ Ip::Address::FreeAddr(from);
return;
}
debugs(42, 8, HERE << preply.from << " said: " << icmp6header->icmp6_type << "/" << (int)icmp6header->icmp6_code << " " <<
IcmpPacketType(icmp6header->icmp6_type));
}
- Ip::Address::FreeAddrInfo(from);
+ Ip::Address::FreeAddr(from);
return;
}
if (icmp6header->icmp6_id != icmp_ident) {
debugs(42, 8, HERE << "dropping Icmp6 read. IDENT check failed. ident=='" << icmp_ident << "'=='" << icmp6header->icmp6_id << "'");
- Ip::Address::FreeAddrInfo(from);
+ Ip::Address::FreeAddr(from);
return;
}
/* send results of the lookup back to squid.*/
control.SendResult(preply, (sizeof(pingerReplyData) - PINGER_PAYLOAD_SZ + preply.psize) );
- Ip::Address::FreeAddrInfo(from);
+ Ip::Address::FreeAddr(from);
}
#endif /* USE_ICMP */
}
void
-Ip::Address::InitAddrInfo(struct addrinfo *&ai)
+Ip::Address::InitAddr(struct addrinfo *&ai)
{
if (ai == NULL) {
ai = new addrinfo;
}
void
-Ip::Address::FreeAddrInfo(struct addrinfo *&ai)
+Ip::Address::FreeAddr(struct addrinfo *&ai)
{
if (ai == NULL) return;
* Get RFC 3493 addrinfo structure from the Ip::Address data
* for protocol-neutral socket operations.
* Should be passed a NULL pointer of type struct addrinfo* it will
- * allocate memory for the structures involved. (see FreeAddrInfo to clear).
+ * allocate memory for the structures involved. (see FreeAddr() to clear).
* Defaults to a TCP streaming socket, if other values (such as UDP) are needed
* the caller MUST override these default settings.
* Some situations may also require an actual call to the system getaddrinfo()
* to pull relevant OS details for the socket.
\par
- * Ip::Address allocated objects MUST be destructed by Ip::Address::FreeAddrInfo
+ * Ip::Address allocated objects MUST be destructed by Ip::Address::FreeAddr
* System getaddrinfo() allocated objects MUST be freed with system freeaddrinfo()
*
\param ai structure to be filled out.
/**
* Equivalent to the sysem call freeaddrinfo() but for Ip::Address allocated data
*/
- static void FreeAddrInfo(struct addrinfo *&ai);
+ static void FreeAddr(struct addrinfo *&ai);
/**
* Initializes an empty addrinfo properly for use.
* about to be changed and the stored details may not match the new ones coming.
\param ai addrinfo struct to be initialized as AF_UNSPEC with large address buffer
*/
- static void InitAddrInfo(struct addrinfo *&ai);
+ static void InitAddr(struct addrinfo *&ai);
/**
* Lookup a Host by Name. Equivalent to system call gethostbyname(char*)
CPPUNIT_ASSERT( memcmp( expect->ai_addr, ipval->ai_addr, expect->ai_addrlen ) == 0 );
freeaddrinfo(expect);
- Ip::Address::FreeAddrInfo(ipval);
+ Ip::Address::FreeAddr(ipval);
}
void
debugs(54, 3, "ipcCreate: cwfd FD " << cwfd);
if (type == IPC_TCP_SOCKET || type == IPC_UDP_SOCKET) {
- Ip::Address::InitAddrInfo(AI);
+ Ip::Address::InitAddr(AI);
if (getsockname(pwfd, AI->ai_addr, &AI->ai_addrlen) < 0) {
- Ip::Address::FreeAddrInfo(AI);
+ Ip::Address::FreeAddr(AI);
debugs(54, DBG_CRITICAL, "ipcCreate: getsockname: " << xstrerror());
return ipcCloseAllFD(prfd, pwfd, crfd, cwfd);
}
debugs(54, 3, "ipcCreate: FD " << pwfd << " sockaddr " << PaS);
- Ip::Address::FreeAddrInfo(AI);
+ Ip::Address::FreeAddr(AI);
- Ip::Address::InitAddrInfo(AI);
+ Ip::Address::InitAddr(AI);
if (getsockname(crfd, AI->ai_addr, &AI->ai_addrlen) < 0) {
- Ip::Address::FreeAddrInfo(AI);
+ Ip::Address::FreeAddr(AI);
debugs(54, DBG_CRITICAL, "ipcCreate: getsockname: " << xstrerror());
return ipcCloseAllFD(prfd, pwfd, crfd, cwfd);
}
ChS = *AI;
- Ip::Address::FreeAddrInfo(AI);
+ Ip::Address::FreeAddr(AI);
debugs(54, 3, "ipcCreate: FD " << crfd << " sockaddr " << ChS );
AI->ai_socktype = p.sock_type;
AI->ai_protocol = p.proto;
comm_import_opened(cbd->conn, FdNote(p.fdNote), AI);
- Ip::Address::FreeAddrInfo(AI);
+ Ip::Address::FreeAddr(AI);
}
cbd->errNo = response.errNo;
addr_info->ai_socktype = socktype;
addr_info->ai_protocol = protocol;
comm_import_opened(conn, Ipc::FdNote(noteId), addr_info);
- Ip::Address::FreeAddrInfo(addr_info);
+ Ip::Address::FreeAddr(addr_info);
} else {
debugs(54, DBG_CRITICAL, "ERROR: Ipc::ImportFdIntoComm: " << conn << ' ' << xstrerror());
conn->close();
// AYJ: these flags should be neutral, but if not IPv6 version needs adding
if (type == IPC_TCP_SOCKET || type == IPC_UDP_SOCKET) {
- Ip::Address::InitAddrInfo(aiPS);
+ Ip::Address::InitAddr(aiPS);
if (getsockname(pwfd, aiPS->ai_addr, &(aiPS->ai_addrlen) ) < 0) {
debugs(54, DBG_CRITICAL, "ipcCreate: getsockname: " << xstrerror());
- Ip::Address::FreeAddrInfo(aiPS);
+ Ip::Address::FreeAddr(aiPS);
return ipcCloseAllFD(prfd, pwfd, crfd, cwfd);
}
tmp_addr = *aiPS;
- Ip::Address::FreeAddrInfo(aiPS);
+ Ip::Address::FreeAddr(aiPS);
debugs(54, 3, "ipcCreate: FD " << pwfd << " sockaddr " << tmp_addr );
- Ip::Address::InitAddrInfo(aiCS);
+ Ip::Address::InitAddr(aiCS);
if (getsockname(crfd, aiCS->ai_addr, &(aiCS->ai_addrlen) ) < 0) {
debugs(54, DBG_CRITICAL, "ipcCreate: getsockname: " << xstrerror());
- Ip::Address::FreeAddrInfo(aiCS);
+ Ip::Address::FreeAddr(aiCS);
return ipcCloseAllFD(prfd, pwfd, crfd, cwfd);
}
tmp_addr.setEmpty();
tmp_addr = *aiCS;
- Ip::Address::FreeAddrInfo(aiCS);
+ Ip::Address::FreeAddr(aiCS);
debugs(54, 3, "ipcCreate: FD " << crfd << " sockaddr " << tmp_addr );
}
goto cleanup;
}
- Ip::Address::InitAddrInfo(aiPS_ipc);
+ Ip::Address::InitAddr(aiPS_ipc);
if (getsockname(pwfd_ipc, aiPS_ipc->ai_addr, &(aiPS_ipc->ai_addrlen)) < 0) {
debugs(54, DBG_CRITICAL, "ipcCreate: getsockname: " << xstrerror());
ipcSend(cwfd, err_string, strlen(err_string));
- Ip::Address::FreeAddrInfo(aiPS_ipc);
+ Ip::Address::FreeAddr(aiPS_ipc);
goto cleanup;
}
PS_ipc = *aiPS_ipc;
- Ip::Address::FreeAddrInfo(aiPS_ipc);
+ Ip::Address::FreeAddr(aiPS_ipc);
debugs(54, 3, "ipcCreate: FD " << pwfd_ipc << " sockaddr " << PS_ipc);
- Ip::Address::InitAddrInfo(aiCS_ipc);
+ Ip::Address::InitAddr(aiCS_ipc);
if (getsockname(crfd_ipc, aiCS_ipc->ai_addr, &(aiCS_ipc->ai_addrlen)) < 0) {
debugs(54, DBG_CRITICAL, "ipcCreate: getsockname: " << xstrerror());
ipcSend(cwfd, err_string, strlen(err_string));
- Ip::Address::FreeAddrInfo(aiCS_ipc);
+ Ip::Address::FreeAddr(aiCS_ipc);
goto cleanup;
}
CS_ipc = *aiCS_ipc;
- Ip::Address::FreeAddrInfo(aiCS_ipc);
+ Ip::Address::FreeAddr(aiCS_ipc);
debugs(54, 3, "ipcCreate: FD " << crfd_ipc << " sockaddr " << CS_ipc);
present = 1;
- Ip::Address::FreeAddrInfo(AI);
+ Ip::Address::FreeAddr(AI);
if (strchr(host, '.'))
return host;
}
- Ip::Address::FreeAddrInfo(AI);
+ Ip::Address::FreeAddr(AI);
debugs(50, 2, "WARNING: failed to resolve " << sa << " to a fully qualified hostname");
}
#endif
snprintf(buf, sizeof(buf), "socket: %s\n", xstrerror());
error_html(buf);
- Ip::Address::FreeAddrInfo(AI);
+ Ip::Address::FreeAddr(AI);
return 1;
}
S.toUrl(ipbuf,MAX_IPSTRLEN),
xstrerror());
error_html(buf);
- Ip::Address::FreeAddrInfo(AI);
+ Ip::Address::FreeAddr(AI);
close(s);
return 1;
}
- Ip::Address::FreeAddrInfo(AI);
+ Ip::Address::FreeAddr(AI);
l = snprintf(buf, sizeof(buf),
"GET cache_object://%s/%s%s%s HTTP/1.0\r\n"
static struct addrinfo *AI = NULL;
addr.getAddrInfo(AI);
int res = bind(sock, AI->ai_addr, AI->ai_addrlen);
- Ip::Address::FreeAddrInfo(AI);
+ Ip::Address::FreeAddr(AI);
return res;
}
iaddr.getAddrInfo(AI);
if ((conn = socket(AI->ai_family, AI->ai_socktype, 0)) < 0) {
std::cerr << "ERROR: could not open socket to " << iaddr << std::endl;
- Ip::Address::FreeAddrInfo(AI);
+ Ip::Address::FreeAddr(AI);
exit(1);
}
- Ip::Address::FreeAddrInfo(AI);
+ Ip::Address::FreeAddr(AI);
if (Transport::Config.localHost) {
if (client_comm_bind(conn, iaddr) < 0) {
static struct addrinfo *AI = NULL;
addr.getAddrInfo(AI);
int res = connect(sock, AI->ai_addr, AI->ai_addrlen);
- Ip::Address::FreeAddrInfo(AI);
+ Ip::Address::FreeAddr(AI);
Ping::TimerStart();
return res;
}