#include "log/File.h"
#include "cbdata.h"
#include "event.h"
-#include "CacheManager.h"
+#include "mgr/Registration.h"
#include "Store.h"
#include "SwapDir.h"
#include "HttpRequest.h"
#include "forward.h"
#include "SquidTime.h"
#include "wordlist.h"
-#include "ip/IpAddress.h"
+#include "ip/Address.h"
#if USE_ICMP
#include "icmp/IcmpSquid.h"
static hash_table *addr_table = NULL;
static hash_table *host_table = NULL;
-IpAddress networkFromInaddr(const IpAddress &a);
+Ip::Address networkFromInaddr(const Ip::Address &a);
static void netdbRelease(netdbEntry * n);
-static void netdbHashInsert(netdbEntry * n, IpAddress &addr);
+static void netdbHashInsert(netdbEntry * n, Ip::Address &addr);
static void netdbHashDelete(const char *key);
static void netdbHostInsert(netdbEntry * n, const char *hostname);
static void netdbHostDelete(const net_db_name * x);
static wordlist *peer_names = NULL;
static void
-netdbHashInsert(netdbEntry * n, IpAddress &addr)
+netdbHashInsert(netdbEntry * n, Ip::Address &addr)
{
networkFromInaddr(addr).NtoA(n->network, MAX_IPSTRLEN);
n->hash.key = n->network;
}
static netdbEntry *
-netdbLookupAddr(const IpAddress &addr)
+netdbLookupAddr(const Ip::Address &addr)
{
netdbEntry *n;
char *key = new char[MAX_IPSTRLEN];
networkFromInaddr(addr).NtoA(key,MAX_IPSTRLEN);
n = (netdbEntry *) hash_lookup(addr_table, key);
+ delete[] key;
return n;
}
static netdbEntry *
-netdbAdd(IpAddress &addr)
+netdbAdd(Ip::Address &addr)
{
netdbEntry *n;
static void
netdbSendPing(const ipcache_addrs *ia, const DnsLookupDetails &, void *data)
{
- IpAddress addr;
+ Ip::Address addr;
char *hostname = NULL;
static_cast<generic_cbdata *>(data)->unwrap(&hostname);
netdbEntry *n;
xfree(hostname);
}
-IpAddress
-networkFromInaddr(const IpAddress &in)
+Ip::Address
+networkFromInaddr(const Ip::Address &in)
{
- IpAddress out;
+ Ip::Address out;
out = in;
-#if USE_IPV6
/* in IPv6 the 'network' should be the routing section. */
-
if ( in.IsIPv6() ) {
out.ApplyMask(64, AF_INET6);
debugs(14, 5, "networkFromInaddr : Masked IPv6 Address to " << in << "/64 routing part.");
return out;
}
-#endif
#if USE_CLASSFUL
struct in_addr b;
netdbEntry *n;
netdbEntry N;
- IpAddress addr;
+ Ip::Address addr;
int count = 0;
struct timeval start = current_time;
static void
netdbExchangeHandleReply(void *data, StoreIOBuffer receivedData)
{
- IpAddress addr;
+ Ip::Address addr;
netdbExchangeState *ex = (netdbExchangeState *)data;
int rec_sz = 0;
static void
netdbRegisterWithCacheManager(void)
{
- CacheManager::GetInstance()->
- registerAction("netdb", "Network Measurement Database", netdbDump, 0, 1);
+ Mgr::RegisterAction("netdb", "Network Measurement Database", netdbDump, 0, 1);
}
#endif /* USE_ICMP */
}
void
-netdbHandlePingReply(const IpAddress &from, int hops, int rtt)
+netdbHandlePingReply(const Ip::Address &from, int hops, int rtt)
{
#if USE_ICMP
netdbEntry *n;
#if 0 // AYJ: Looks to be unused code.
int
-netdbHops(IpAddress &addr)
+netdbHops(Ip::Address &addr)
{
#if USE_ICMP
netdbEntry *n = netdbLookupAddr(addr);
}
void
-netdbExchangeUpdatePeer(IpAddress &addr, peer * e, double rtt, double hops)
+netdbExchangeUpdatePeer(Ip::Address &addr, peer * e, double rtt, double hops)
{
#if USE_ICMP
netdbEntry *n;
}
void
-netdbDeleteAddrNetwork(IpAddress &addr)
+netdbDeleteAddrNetwork(Ip::Address &addr)
{
#if USE_ICMP
netdbEntry *n = netdbLookupAddr(addr);
HttpReply *reply = new HttpReply;
#if USE_ICMP
- IpAddress addr;
+ Ip::Address addr;
netdbEntry *n;
int i;
struct in_addr line_addr;
s->buffer();
- HttpVersion version(1, 0);
- reply->setHeaders(version, HTTP_OK, "OK", NULL, -1, squid_curtime, -2);
+ reply->setHeaders(HTTP_OK, "OK", NULL, -1, squid_curtime, -2);
s->replaceHttpReply(reply);
rec_sz = 0;
rec_sz += 1 + sizeof(struct in_addr);
memFree(buf, MEM_4K_BUF);
#else
- HttpVersion version(1,0);
- reply->setHeaders(version, HTTP_BAD_REQUEST, "Bad Request",
- NULL, -1, squid_curtime, -2);
+ reply->setHeaders(HTTP_BAD_REQUEST, "Bad Request", NULL, -1, squid_curtime, -2);
s->replaceHttpReply(reply);
storeAppendPrintf(s, "NETDB support not compiled into this Squid cache.\n");
#endif
HTTPMSGLOCK(ex->r);
assert(NULL != ex->r);
- ex->r->http_ver = HttpVersion(1,0);
+ ex->r->http_ver = HttpVersion(1,1);
ex->connstate = STATE_HEADER;
ex->e = storeCreateEntry(uri, uri, request_flags(), METHOD_GET);
ex->buf_sz = NETDB_REQBUF_SZ;
urlCanonical(ex->r);
- FwdState::fwdStart(-1, ex->e, ex->r);
+ Comm::ConnectionPointer nul;
+ FwdState::fwdStart(nul, ex->e, ex->r);
#endif
}