--------------------- PatchSet 4062 Date: 2007/02/17 11:03:36 Author: amosjeffries Branch: squid3-ipv6 Tag: (none) Log: Added IPAddress class to hide operations on in_addr and sockaddr Began code modifications to use it instead of overloaded macros. Members: src/IPAddress.cc:1.1->1.1.2.1 src/IPAddress.h:1.1->1.1.2.1 src/comm.cc:1.47.2.7->1.47.2.8 src/comm.h:1.16.8.2->1.16.8.3 src/ipc.cc:1.9.4.3->1.9.4.4 src/ipcache.cc:1.9.2.11->1.9.2.12 src/net_db.cc:1.13.4.4->1.13.4.5 src/protos.h:1.48.4.6->1.48.4.7 --- /dev/null Thu Mar 1 01:20:21 2007 +++ squid3/src/IPAddress.cc Thu Mar 1 01:20:21 2007 @@ -0,0 +1,263 @@ +/* + * $Id: IPAddress.cc,v 1.1.2.1 2007/02/17 11:03:36 amosjeffries Exp $ + */ +#include "squid.h" +#include "IPAddress.h" + +// #include + +/* + enum IPAddressType { + NONE=0, + SockAddr =1, // Full SocketAddr Details Stored. + IPv4 =2, // Pure IPv4 address stored (conversion up must be done explicitly) + IPv6 =4, // Pure IPv6 Address Stored (no conversion to IPv4 possible) + IPv64 =6 // Dual-Address Stored (can return either IPv6 OR IPv4) + } m_Type; + struct sockaddr m_SocketAddr; +*/ + +bool IPAddress::IsAnyAddr() +{ +#if INET6 + return (0 == memcmp(&(m_SocketAddr.sin6_addr), &in6addr_any, sizeof(in6addr_any)) ); +#else + return (INADDR_ANY == m_SocketAddr.sin_addr.s_addr); +#endif +} + +#if INET6 +bool IPAddress::GetReverseString6(char buf[MAX_IPSTRLEN], struct in_addr &dat) +{ + // FIXME: code. + assert(false); + + return false; +} +#endif + +bool IPAddress::GetReverseString4(char buf[MAX_IPSTRLEN], struct in_addr &dat) +{ + // FIXME: code it! + assert(false); + + return false; +} + +bool IPAddress::GetReverseString(char buf[MAX_IPSTRLEN], IPAddressType show_type) +{ + void* ip4_ptr = NULL; +#if INET6 + void* ip6_ptr = NULL; + in6_addr tmp_buf; +#endif + + if(m_Type == None) return false; +#if INET6 + if(show_type == None) show_type = IPv6; +#else + if(show_type == None) show_type = IPv4; +#endif + + switch(m_Type && IPv64) // What we do depends on how we stored it. + { + case IPv4: + ip4_ptr = &m_SocketAddr.sin_addr; +#if INET6 /* otherwise we don't need to bother converting it. */ + ip6_ptr = tmp_buf; + Map4to6(ip4_ptr, ip6_ptr); +#endif + break; + +#if INET6 + case IPv64: + ip4_ptr = &m_SocketAddr.sin6_addr.s6_addr32[3]); + // Fall through to setup IPv6 output ptr + + case IPv6: + ip6_ptr = &m_SocketAddr.sin6_addr; + break; +#endif + } + + if(show_type == IPv4 && ip4_ptr != NULL) + { + return GetReverseString4(buf, *(in_addr*)ip4_ptr); + } +#if INET6 + if(show_type == IPv6 && ip6_ptr != NULL) + { + return GetReverseString6(buf, *(in6_addr*)ip6_ptr); + } +#endif + + /* FIXME: an error occured. invalid address type */ + return false; +} + +IPAddress IPAddress::operator =(struct sockaddr_in const &s) { +#if INET6 + Map4to6(&s.sin_addr, &m_SockAddr.sin6_addr); + m_SocketAddr.sin6_port = s.sin_port; + m_SocketAddr.sin6_family = AF_INET6; + m_Type=(IPAddressType)(IPv64 | SockAddr); +#else + memcpy(&m_SocketAddr, &s, sizeof(struct sockaddr_in)); + m_Type=(IPAddressType)(IPv4 | SockAddr); +#endif + return *this; +}; + +#if INET6 +IPAddress IPAddress::operator =(sockaddr_in6 const &s) { + memcpy(&m_SocketAddr, &s, sizeof(struct sockaddr_in6)); + m_Type = (IPAddressType)(SockAddr | IPv6); + + // FIXME: check to see what type of in*_addr is in this sockaddr. Update type to show it. + // AYJ: Not sure about the following. + // Only absolute test is if first 96 bits are 0 then 16 of 0xFFFF + // m_Type |= IPv4; + + return *this; +}; +#endif + +IPAddress IPAddress::operator =(in_addr const &s) { +#if INET6 + Map4to6(&s, &m_SockAddr.sin6_addr)); + m_SocketAddr.sin6_port = 0; + m_SocketAddr.sin6_family = AF_INET6; + m_Type=IPv64; +#else + memcpy(&m_SocketAddr.sin_addr, &s, sizeof(struct in_addr)); + m_SocketAddr.sin_port = 0; + m_SocketAddr.sin_family = AF_INET; + m_Type=IPv4; +#endif + return *this; +}; + +#if INET6 +IPAddress operator =(struct in6_addr const &s) { + // FIXME: convert properly from in6_addr to the storage method. + memcpy(&m_SocketAddr.sin6_addr, &s, sizeof(struct in6_addr)); + m_SocketAddr.sin6_port = 0; + m_SocketAddr.sin6_famly = AF_INET6; + m_Type=IPv6; + return *this; +}; +#endif + +bool IPAddress::operator ==(const IPAddress &s) +{ + if(m_Type != s.m_Type) return false; + return (0 == memcmp(this, &s, sizeof(IPAddress)) ); +} + +u_short IPAddress::GetPort() +{ + return ntohs( ((sockaddr_in)m_SocketAddr).sin_port ); +} + +u_short IPAddress::SetPort(u_short prt) +{ + ((sockaddr_in)m_SocketAddr).sin_port = htons(prt); + if(m_Type != None) m_Type = (IPAddressType)(m_Type | SockAddr); + return prt; +} + +bool IPAddress::GetString(char *buf, unsigned int blen) +{ +#if INET6 + if(blen >= INET6_ADDRSTRLEN) + { + xstrncpy(buf, inet6_ntoa(m_SocketAddr.sin6_addr), 16); + return true; + } +#else + if(blen >= MAX_IP4_STRLEN) + { + xstrncpy(buf, inet_ntoa(m_SocketAddr.sin_addr), 16); + return true; + } +#endif + return false; +} + +void IPAddress::GetSockAddr(struct sockaddr_in &buf) +{ +#if INET6 + // FIXME: Hmm, how to convert down?? + if(m_Type & IPv4) // if can be converted down. + { + buf.sin_family = AF_INET; + buf.sin_port = m_SocketAddr.sin6_port; + memcpy(&buf.sin_addr, &m_SocketAddr.sin6_addr.s6_addr32[3], sizeof(uint32)); + } + else // no conversion. set it to NO_ADDRESS instead + { + memset(&buf, 0, sizeof(struct sockaddr_in)); + } +#else + memcpy(&buf, &m_SocketAddr, sizeof(struct sockaddr_in)); +#endif +} + +#if INET6 +void IPAddress::GetSockAddr(struct sockaddr_in6 &buf) +{ + memcpy(&buf, &m_SockAddr, sizeof(struct sockaddr_in6)); +} +#endif + +#if INET6 +void IPAddress::Map4to6(struct in_addr &in, struct in6_addr &out) +{ + memset(&out, 0, sizeof(struct in6_addr)); + out.s6_addr32[3] = in.s_addr; + out.s6_addr16[5] = (unsigned short)0xFFFF; + return out; +} +void IPAddress::Map6to4(struct in6_addr &in, struct in_addr &out) +{ + memset(&out, 0, sizeof(struct in_addr)); + out.s_addr = in.s6_addr32[3]; +} +#endif + +#if INET6 +void IPAddress::GetInAddr(in6_addr &buf) { + assert(false); + if(m_Type & IPv6) + { + memcpy(&buf, &m_SocketAddr.sin6_addr, sizeof(struct in6_addr)); + } + else // its an IPv4-Native Structure + { + // convert to an IPv6-mapped IPA + Map4to6(&m_SocketAddr.sin_addr, &buf); + } +} +#endif + +bool IPAddress::GetInAddr(struct in_addr &buf) { + switch(m_Type & IPv64) + { +#if INET6 + case IPv64: // IPv4-Compatible IPv6 Address + Map6to4(&m_SocketAddr.sin6_addr, &buf); + return true; +#endif + + case IPv4: // Pure IPv4 Address. + memcpy(&buf, &m_SocketAddr.sin_addr, sizeof(struct in_addr)); + return true; + + case IPv6: // non-compatible IPv6 Pure Address + default: + // flow through to error case. + // FIXME: Log the call to this function ?? + // FIXME: Or return the IPv4 version of 'no address' and let the ACL deal with it?? + return false; + } +} --- /dev/null Thu Mar 1 01:20:21 2007 +++ squid3/src/IPAddress.h Thu Mar 1 01:20:21 2007 @@ -0,0 +1,111 @@ +/* + * Class to hold and manipulate IPv4, IPv6 and Sock Addresses + * This is primarily to reduce old c-style code and improve + * the success of Protocol Changes now and in the future. + * Will also centralise and improve code-reusage where IPA are involved. + * + * Intended for use by the DNS, ACLs, and Client-Server connection parts of Squid3. + * + * $Id: IPAddress.h,v 1.1.2.1 2007/02/17 11:03:37 amosjeffries Exp $ + */ +#ifndef _INC_IPADDRESS_H +#define _INC_IPADDRESS_H + +#include +#include +#if INET6 +#include +#endif + +enum IPAddressType { + None =0, + SockAddr =1, // Full SocketAddr Details Stored. + IPv4 =2, // Pure IPv4 address stored (conversion up must be done explicitly) + IPv6 =4, // Pure IPv6 Address Stored (no conversion to IPv4 possible) + IPv64 =6 // Dual-Address Stored (can return either IPv6 OR IPv4) +}; + +static const unsigned int MAX_IP4_STRLEN = 16; +#if INET6 +static const unsigned int MAX_IP6_STRLEN = 74; +static const unsigned int MAX_IPSTRLEN = 75; +#else +static const unsigned int MAX_IPSTRLEN = MAX_IP4_STRLEN; +#endif + +class IPAddress +{ +public: + IPAddress() {}; + IPAddress(const IPAddress &dat) { *this = dat; }; + IPAddress(const struct in_addr &dat) { *this = dat; }; + IPAddress(const struct sockaddr_in &dat) { *this = dat; }; +#if INET6 + IPAddress(const struct in6_addr &dat) { *this = dat; }; + IPAddress(const struct sockaddr_in6 &dat) { *this = dat; }; +#endif + ~IPAddress() {}; + + /* Assignment Operators */ + inline IPAddress operator =(const IPAddress &s) { memcpy(this, &s, sizeof(struct IPAddress)); return *this; }; + IPAddress operator =(sockaddr_in const &s); + IPAddress operator =(in_addr const &s); +#if INET6 + IPAddress operator =(in6_addr const &s); + IPAddress operator =(sockaddr_in const &s); +#endif + + /* Boolean Operators */ + bool operator ==(IPAddress const &s); + + +public: + /* methods */ + inline bool IsIPv4() { return (m_Type & IPv4); }; + inline bool IsIPv6() { return (m_Type & IPv6); }; + + bool GetReverseString(char buf[MAX_IPSTRLEN], IPAddressType show_type = None); + u_short GetPort(); + u_short SetPort(u_short port); + bool GetString(char *buf, unsigned int len); + bool IsAnyAddr(); + + /* variables */ + + +public: + /* FIXME: When C => C++ conversion is done will be fully private. */ + /* Legacy Transition Methods */ + /* These are here solely to simplify the transition */ + /* when moving from converted code to unconverted */ + /* these functions can be used to convert this object */ + /* and pull out the data needed by the unconverted code */ + /* they are intentionaly hard to use, to encourage less use. */ + + void GetSockAddr(struct sockaddr_in &); + bool GetInAddr(struct in_addr &); /* false if could not convert IPv6 down to IPv4 */ +#if INET6 + void GetSockAddr(struct sockaddr_in6 &); + void GetInAddr(struct in6_addr &); +#endif + +private: + /* methods */ + /* Conversion for dual-type internals */ + bool GetReverseString4(char buf[], struct in_addr &); +#if INET6 + bool GetReverseString6(char buf[], struct in6_addr &); + void Map4to6(in_addr &src, in6_addr &dest); + void Map6to4(in6_addr &src, in_addr &dest); +#endif + + /* variables */ + IPAddressType m_Type; +#if INET6 + struct sockaddr_in6 m_SocketAddr; +#else + struct sockaddr_in m_SocketAddr; +#endif +}; + +#endif /* _INC_IPADDRESS_H */ Index: squid3/src/comm.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/comm.cc,v retrieving revision 1.47.2.7 retrieving revision 1.47.2.8 diff -u -r1.47.2.7 -r1.47.2.8 --- squid3/src/comm.cc 5 Jan 2007 16:59:11 -0000 1.47.2.7 +++ squid3/src/comm.cc 17 Feb 2007 11:03:37 -0000 1.47.2.8 @@ -1,6 +1,6 @@ /* - * $Id: comm.cc,v 1.47.2.7 2007/01/05 16:59:11 hno Exp $ + * $Id: comm.cc,v 1.47.2.8 2007/02/17 11:03:37 amosjeffries Exp $ * * DEBUG: section 5 Socket Functions * AUTHOR: Harvest Derived @@ -54,6 +54,8 @@ #include #endif +#include "IPAddress.h" + /* * New C-like simple comm code. This stuff is a mess and doesn't really buy us anything. */ @@ -233,7 +235,7 @@ char *host; u_short port; - struct SOCKADDR_IN S; + IPAddress S; CallBack callback; struct IN_ADDR in_addr; @@ -1159,18 +1161,17 @@ void ConnectStateData::defaults() { - FAMILY_FROM_SA(S) = AF_FAMILY; - ADDR_FROM_SA(S) = in_addr; - PORT_FROM_SA(S) = htons(port); + S = in_addr; + S.SetPort(htons(port)); } void ConnectStateData::connect() { - if (ADDR_IS_ANYADDR(ADDR_FROM_SA(S))) + if (S.IsAnyAddr()) defaults(); - switch (comm_connect_addr(fd, &S)) { + switch (comm_connect_addr(fd, S) ) { case COMM_INPROGRESS: debug(5, 5) ("ConnectStateData::connect: FD %d: COMM_INPROGRESS\n", fd); @@ -1178,16 +1179,16 @@ break; case COMM_OK: - ipcacheMarkGoodAddr(host, ADDR_FROM_SA(S)); + ipcacheMarkGoodAddr(host, S); callCallback(COMM_OK, 0); break; default: tries++; - ipcacheMarkBadAddr(host, ADDR_FROM_SA(S)); + ipcacheMarkBadAddr(host, S); if (Config.onoff.test_reachability) - netdbDeleteAddrNetwork(ADDR_FROM_SA(S)); + netdbDeleteAddrNetwork(S); if (commRetryConnect()) { eventAdd("commReconnect", commReconnect, this, this->addrcount == 1 ? 0.05 : 0.0, 0); @@ -1225,14 +1226,20 @@ int -comm_connect_addr(int sock, const struct SOCKADDR_IN *address) +comm_connect_addr(int sock, IPAddress &address) { +#if INET6 + struct sockadr_in6 saddr; +#else + struct sockaddr_in saddr; +#endif + address.GetSockAddr(saddr); comm_err_t status = COMM_OK; fde *F = &fd_table[sock]; int x; int err = 0; socklen_t errlen; - assert(ntohs(PORT_FROM_SA(*address)) != 0); + assert(address.GetPort() != 0); PROF_start(comm_connect_addr); /* Establish connection. */ errno = 0; @@ -1242,7 +1249,7 @@ F->flags.called_connect = 1; statCounter.syscalls.sock.connects++; - x = connect(sock, (struct sockaddr *) address, sizeof(*address)); + x = connect(sock, (struct sockaddr *)&saddr, sizeof(saddr)); if (x < 0) debug(5, 9) ("connect FD %d: %s\n", sock, xstrerror()); @@ -1251,7 +1258,7 @@ #if defined(_SQUID_NEWSOS6_) /* Makoto MATSUSHITA */ - connect(sock, (struct sockaddr *) address, sizeof(*address)); + connect(sock, (struct sockaddr *)&saddr, sizeof(saddr)); if (errno == EINVAL) { errlen = sizeof(err); @@ -1293,9 +1300,10 @@ else return COMM_ERROR; - xstrncpy(F->ipaddr, INET_NTOA(ADDR_FROM_SA(*address)), 16); + /* FIXME : magic 16 will cause problems in IPv6. Try MAX_IPSTRLEN instead. */ + address.GetString(F->ipaddr, 16); - F->remote_port = ntohs(PORT_FROM_SA(*address)); + F->remote_port = ntohs(address.GetPort()); if (status == COMM_OK) { Index: squid3/src/comm.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/comm.h,v retrieving revision 1.16.8.2 retrieving revision 1.16.8.3 diff -u -r1.16.8.2 -r1.16.8.3 --- squid3/src/comm.h 5 Jan 2007 16:59:12 -0000 1.16.8.2 +++ squid3/src/comm.h 17 Feb 2007 11:03:38 -0000 1.16.8.3 @@ -6,6 +6,7 @@ #include "CompletionDispatcher.h" #include "StoreIOBuffer.h" #include "Array.h" +#include "IPAddress.h" #define COMMIO_FD_READCB(fd) (&commfd_table[(fd)].readcb) #define COMMIO_FD_WRITECB(fd) (&commfd_table[(fd)].writecb) @@ -46,7 +47,7 @@ #endif SQUIDCEXTERN void commConnectStart(int fd, const char *, u_short, CNCB *, void *); -SQUIDCEXTERN int comm_connect_addr(int sock, const struct sockaddr_in *); +SQUIDCEXTERN int comm_connect_addr(int sock, IPAddress &addr); SQUIDCEXTERN void comm_init(void); SQUIDCEXTERN int comm_open(int, int, struct IN_ADDR, u_short port, int, const char *note); Index: squid3/src/ipc.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ipc.cc,v retrieving revision 1.9.4.3 retrieving revision 1.9.4.4 diff -u -r1.9.4.3 -r1.9.4.4 --- squid3/src/ipc.cc 5 Jan 2007 16:59:23 -0000 1.9.4.3 +++ squid3/src/ipc.cc 17 Feb 2007 11:03:38 -0000 1.9.4.4 @@ -1,6 +1,6 @@ /* - * $Id: ipc.cc,v 1.9.4.3 2007/01/05 16:59:23 hno Exp $ + * $Id: ipc.cc,v 1.9.4.4 2007/02/17 11:03:38 amosjeffries Exp $ * * DEBUG: section 54 Interprocess Communication * AUTHOR: Duane Wessels @@ -246,7 +246,7 @@ cwfd = crfd = -1; if (type == IPC_TCP_SOCKET || type == IPC_UDP_SOCKET) { - if (comm_connect_addr(pwfd, &ChS) == COMM_ERROR) + if (comm_connect_addr(pwfd, ChS) == COMM_ERROR) return ipcCloseAllFD(prfd, pwfd, crfd, cwfd); } @@ -317,7 +317,7 @@ close(crfd); cwfd = crfd = fd; } else if (type == IPC_UDP_SOCKET) { - if (comm_connect_addr(crfd, &PaS) == COMM_ERROR) + if (comm_connect_addr(crfd, PaS) == COMM_ERROR) return ipcCloseAllFD(prfd, pwfd, crfd, cwfd); } Index: squid3/src/ipcache.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ipcache.cc,v retrieving revision 1.9.2.11 retrieving revision 1.9.2.12 diff -u -r1.9.2.11 -r1.9.2.12 --- squid3/src/ipcache.cc 25 Jan 2007 10:43:24 -0000 1.9.2.11 +++ squid3/src/ipcache.cc 17 Feb 2007 11:03:39 -0000 1.9.2.12 @@ -1,6 +1,6 @@ /* - * $Id: ipcache.cc,v 1.9.2.11 2007/01/25 10:43:24 amosjeffries Exp $ + * $Id: ipcache.cc,v 1.9.2.12 2007/02/17 11:03:39 amosjeffries Exp $ * * DEBUG: section 14 IP Cache * AUTHOR: Harvest Derived @@ -845,7 +845,7 @@ */ void -ipcacheMarkBadAddr(const char *name, struct IN_ADDR addr) +ipcacheMarkBadAddr(const char *name, IPAddress addr) { ipcache_entry *i; ipcache_addrs *ia; @@ -858,7 +858,7 @@ for (k = 0; k < (int) ia->count; k++) { - if (ADDR_EQUALS(ia->in_addrs[k], addr)) + if (addr == ia->in_addrs[k] ) break; } @@ -870,7 +870,12 @@ ia->bad_mask[k] = TRUE; ia->badcount++; i->expires = XMIN(squid_curtime + XMAX((time_t)60, Config.negativeDnsTtl), i->expires); - debug(14, 2) ("ipcacheMarkBadAddr: %s %s\n", name, INET_NTOA(addr)); + + /* FIXME INET6 : We definitely need a better way of sending a string copy of IPAddress to debug */ + char tmp[MAX_IPSTRLEN+1]; + addr.GetString(tmp, MAX_IPSTRLEN+1); + + debug(14, 2) ("ipcacheMarkBadAddr: %s %s\n", name, tmp); } ipcacheCycleAddr(name, ia); @@ -878,7 +883,7 @@ void -ipcacheMarkGoodAddr(const char *name, struct IN_ADDR addr) +ipcacheMarkGoodAddr(const char *name, IPAddress addr) { ipcache_entry *i; ipcache_addrs *ia; @@ -891,7 +896,7 @@ for (k = 0; k < (int) ia->count; k++) { - if (ADDR_EQUALS(ia->in_addrs[k], addr)) + if (addr == ia->in_addrs[k]) break; } @@ -905,7 +910,11 @@ ia->badcount--; - debug(14, 2) ("ipcacheMarkGoodAddr: %s [%s]\n", name, INET_NTOA(addr)); + /* FIXME INET6 : We definitely need a better way of sending a string copy of IPAddress to debug */ + char tmp[MAX_IPSTRLEN+1]; + addr.GetString(tmp, MAX_IPSTRLEN+1); + + debug(14, 2) ("ipcacheMarkGoodAddr: %s [%s]\n", name, tmp); } static void Index: squid3/src/net_db.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/net_db.cc,v retrieving revision 1.13.4.4 retrieving revision 1.13.4.5 diff -u -r1.13.4.4 -r1.13.4.5 --- squid3/src/net_db.cc 5 Jan 2007 16:59:30 -0000 1.13.4.4 +++ squid3/src/net_db.cc 17 Feb 2007 11:03:39 -0000 1.13.4.5 @@ -1,6 +1,6 @@ /* - * $Id: net_db.cc,v 1.13.4.4 2007/01/05 16:59:30 hno Exp $ + * $Id: net_db.cc,v 1.13.4.5 2007/02/17 11:03:39 amosjeffries Exp $ * * DEBUG: section 38 Network Measurement Database * AUTHOR: Duane Wessels @@ -250,7 +250,7 @@ static netdbEntry * -netdbLookupAddr(struct IN_ADDR addr) +netdbLookupAddr(IPAddress addr) { netdbEntry *n; char *key = (char *)INET_NTOA(networkFromInaddr(addr)); @@ -348,8 +348,10 @@ static struct IN_ADDR - networkFromInaddr(struct IN_ADDR a) + networkFromInaddr(IPAddress in) { + struct IN_ADDR a; + in.GetInAddr(a); struct IN_ADDR b; #ifdef INET6 @@ -1192,7 +1194,7 @@ void -netdbDeleteAddrNetwork(struct IN_ADDR addr) +netdbDeleteAddrNetwork(IPAddress addr) { #if USE_ICMP netdbEntry *n = netdbLookupAddr(addr); Index: squid3/src/protos.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/protos.h,v retrieving revision 1.48.4.6 retrieving revision 1.48.4.7 diff -u -r1.48.4.6 -r1.48.4.7 --- squid3/src/protos.h 5 Jan 2007 16:59:32 -0000 1.48.4.6 +++ squid3/src/protos.h 17 Feb 2007 11:03:39 -0000 1.48.4.7 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.48.4.6 2007/01/05 16:59:32 hno Exp $ + * $Id: protos.h,v 1.48.4.7 2007/02/17 11:03:39 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -43,6 +43,8 @@ */ #include "HttpRequestMethod.h" /* for routines still in this file that take CacheManager parameters */ +#include "IPAddress.h" +/* for routines in here that need it as a parameter. */ class CacheManager; @@ -323,9 +325,9 @@ SQUIDCEXTERN void stat_ipcache_get(StoreEntry *); SQUIDCEXTERN void ipcacheCycleAddr(const char *name, ipcache_addrs *); -SQUIDCEXTERN void ipcacheMarkBadAddr(const char *name, struct IN_ADDR); +SQUIDCEXTERN void ipcacheMarkBadAddr(const char *name, IPAddress); -SQUIDCEXTERN void ipcacheMarkGoodAddr(const char *name, struct IN_ADDR); +SQUIDCEXTERN void ipcacheMarkGoodAddr(const char *name, IPAddress); SQUIDCEXTERN void ipcacheFreeMemory(void); SQUIDCEXTERN ipcache_addrs *ipcacheCheckNumeric(const char *name); SQUIDCEXTERN void ipcache_restart(void); @@ -404,7 +406,7 @@ SQUIDCEXTERN int netdbHostRtt(const char *host); SQUIDCEXTERN void netdbUpdatePeer(HttpRequest *, peer * e, int rtt, int hops); -SQUIDCEXTERN void netdbDeleteAddrNetwork(struct IN_ADDR addr); +SQUIDCEXTERN void netdbDeleteAddrNetwork(IPAddress addr); SQUIDCEXTERN void netdbBinaryExchange(StoreEntry *); SQUIDCEXTERN void netdbExchangeStart(void *);