tests_testEvent_LDADD = \
libsquid.la \
libauth.la \
+ icmp/libicmp.la icmp/libicmp-core.la \
@REPL_OBJS@ \
${ADAPTATION_LIBS} \
@REGEXLIB@ \
tests_testEventLoop_LDADD = \
libsquid.la \
libauth.la \
+ icmp/libicmp.la icmp/libicmp-core.la \
@REPL_OBJS@ \
${ADAPTATION_LIBS} \
@REGEXLIB@ \
tests_test_http_range_LDADD = \
libsquid.la \
libauth.la \
+ icmp/libicmp.la icmp/libicmp-core.la \
@REPL_OBJS@ \
@STORE_OBJS@ \
${ADAPTATION_LIBS} \
tests_testHttpRequest_LDADD = \
libsquid.la \
libauth.la \
+ icmp/libicmp.la icmp/libicmp-core.la \
@REPL_OBJS@ \
${ADAPTATION_LIBS} \
@REGEXLIB@ \
tests_testURL_LDADD = \
libsquid.la \
libauth.la \
+ icmp/libicmp.la icmp/libicmp-core.la \
@REGEXLIB@ \
@REPL_OBJS@ \
${ADAPTATION_LIBS} \
#include "IPAddress.h"
#include "IPInterception.h"
#include "DescriptorSet.h"
+#include "icmp/net_db.h"
#if defined(_SQUID_CYGWIN_)
#include <sys/ioctl.h>
tries++;
ipcacheMarkBadAddr(host, S);
+#if USE_ICMP
if (Config.onoff.test_reachability)
netdbDeleteAddrNetwork(S);
+#endif
if (commRetryConnect()) {
eventAdd("commReconnect", commReconnect, this, this->addrcount == 1 ? 0.05 : 0.0, 0);
#include "squid.h"
#include "fde.h"
#include "SquidTime.h"
+#include "Debug.h"
int default_read_method(int, char *, int);
int default_write_method(int, const char *, int);
#include "pconn.h"
#include "SquidTime.h"
#include "Store.h"
-
-/* for IPInterceptor API */
+#include "icmp/net_db.h"
#include "IPInterception.h"
static PSC fwdStartCompleteWrapper;
#include "comm.h"
#include "MemBuf.h"
#include "http.h"
+#include "icmp/net_db.h"
typedef struct _Countstr Countstr;
}
static void
-
htcpTstReply(htcpDataHeader * dhdr, StoreEntry * e, htcpSpecifier * spec, IPAddress &from)
{
htcpStuff stuff;
Packer p;
ssize_t pktlen;
char *host;
- int rtt = 0;
- int hops = 0;
- int samp = 0;
char cto_buf[128];
memset(&stuff, '\0', sizeof(stuff));
stuff.op = HTCP_TST;
hdr.reset();
+#if USE_ICMP
if ((host = urlHostname(spec->uri))) {
+ int rtt = 0;
+ int hops = 0;
+ int samp = 0;
netdbHostData(host, &samp, &rtt, &hops);
if (rtt || hops) {
hdr.putExt("Cache-to-Origin", cto_buf);
}
}
+#endif /* USE_ICMP */
hdr.packInto(&p);
stuff.D.cache_hdrs = xstrdup(mb.buf);
*/
#include "squid.h"
-#include "IcmpSquid.h"
+#include "icmp/IcmpSquid.h"
+#include "icmp/net_db.h"
#include "comm.h"
#include "SquidTime.h"
*/
#include "squid.h"
+#include "icmp/net_db.h"
#include "cbdata.h"
#include "event.h"
#include "CacheManager.h"
#include "IPAddress.h"
#if USE_ICMP
-#include "IcmpSquid.h"
+#include "icmp/IcmpSquid.h"
#include "StoreClient.h"
#define NETDB_REQBUF_SZ 4096
xfree(list);
#else
- storeAppendPrintf(sentry,
- "NETDB support not compiled into this Squid cache.\n");
+ storeAppendPrintf(sentry,"NETDB support not compiled into this Squid cache.\n");
#endif
}
}
void
-
netdbDeleteAddrNetwork(IPAddress &addr)
{
#if USE_ICMP
debugs(38, 3, "netdbDeleteAddrNetwork: " << n->network);
netdbRelease(n);
-
#endif
}
+
void
netdbBinaryExchange(StoreEntry * s)
{
#ifndef ICMP_NET_DB_H
#define ICMP_NET_DB_H
+#include "config.h"
class IPAddress;
class StoreEntry;
SQUIDCEXTERN peer *netdbClosestParent(HttpRequest *);
SQUIDCEXTERN void netdbHostData(const char *host, int *samp, int *rtt, int *hops);
-
#endif /* ICMP_NET_DB_H */
#include "SquidTime.h"
#include "SwapDir.h"
#include "IPAddress.h"
+#include "icmp/net_db.h"
/// \ingroup ServerProtocolICPInternal2
static void icpLogIcp(const IPAddress &, log_type, int, const char *, int);
if (icpCheckUdpHit(entry, request)) {
codeToSend = ICP_HIT;
} else {
+#if USE_ICMP
if (Config.onoff.test_reachability && rtt == 0) {
if ((rtt = netdbHostRtt(request->GetHost())) == 0)
netdbPingSite(request->GetHost());
}
+#endif /* USE_ICMP */
if (icpGetCommonOpcode() != ICP_ERR)
codeToSend = icpGetCommonOpcode();
HTTPMSGUNLOCK(icp_request);
return;
}
-
+#if USE_ICMP
if (header.flags & ICP_FLAG_SRC_RTT) {
rtt = netdbHostRtt(icp_request->GetHost());
int hops = netdbHostHops(icp_request->GetHost());
if (rtt)
flags |= ICP_FLAG_SRC_RTT;
}
+#endif /* USE_ICMP */
/* The peer is allowed to use this cache */
ICP2State *state = new ICP2State (header, icp_request);
#include "MemBuf.h"
#include "SquidTime.h"
#include "wordlist.h"
+#include "icmp/net_db.h"
/* called when we "miss" on an internal object;
* generate known dynamic objects,
const char *msgbuf = "This cache is currently building its digest.\n";
#else
- const char *msgbuf = "This cache does not suport Cache Digests.\n";
+ const char *msgbuf = "This cache does not support Cache Digests.\n";
#endif
HttpVersion version(1, 0);
#include "SwapDir.h"
#include "forward.h"
#include "MemPool.h"
-#include "ICMPSquid.h"
+#include "icmp/IcmpSquid.h"
+#include "icmp/net_db.h"
#include "TextException.h"
#if USE_LOADABLE_MODULES
#include "SquidTime.h"
#include "Store.h"
#include "IPAddress.h"
+#include "icmp/net_db.h"
/* count mcast group peers every 15 minutes */
#define MCAST_COUNT_RATE 900
if (p->type == PEER_MULTICAST)
peerCountMcastPeersSchedule(p, 10);
+#if USE_ICMP
if (p->type != PEER_MULTICAST)
if (!p->options.no_netdb_exchange)
eventAddIsh("netdbExchangeStart", netdbExchangeStart, p, 30.0, 1);
+#endif
+
}
static void
#include "htcp.h"
#include "forward.h"
#include "SquidTime.h"
+#include "icmp/net_db.h"
const char *hier_strings[] = {
"NONE",
static int
peerCheckNetdbDirect(ps_state * psstate)
{
+#if USE_ICMP
peer *p;
int myrtt;
int myhops;
if (psstate->direct == DIRECT_NO)
return 0;
+ /* base lookup on RTT and Hops if ICMP NetDB is enabled. */
+
myrtt = netdbHostRtt(psstate->request->GetHost());
debugs(44, 3, "peerCheckNetdbDirect: MY RTT = " << myrtt << " msec");
debugs(44, 3, "peerCheckNetdbDirect: minimum_direct_rtt = " << Config.minDirectRtt << " msec");
-
if (myrtt && myrtt <= Config.minDirectRtt)
return 1;
debugs(44, 3, "peerCheckNetdbDirect: MY hops = " << myhops);
debugs(44, 3, "peerCheckNetdbDirect: minimum_direct_hops = " << Config.minDirectHops);
-
if (myhops && myhops <= Config.minDirectHops)
return 1;
if (myrtt && myrtt <= psstate->ping.p_rtt)
return 1;
+#endif /* USE_ICMP */
+
return 0;
}
* following methods:
* Cache Digests
* CARP
- * Netdb RTT estimates
+ * ICMP Netdb RTT estimates
* ICP/HTCP queries
*/
static void
peerIcpParentMiss(peer * p, icp_common_t * header, ps_state * ps)
{
int rtt;
- int hops;
+#if USE_ICMP
if (Config.onoff.query_icmp) {
if (header->flags & ICP_FLAG_SRC_RTT) {
rtt = header->pad & 0xFFFF;
- hops = (header->pad >> 16) & 0xFFFF;
+ int hops = (header->pad >> 16) & 0xFFFF;
if (rtt > 0 && rtt < 0xFFFF)
netdbUpdatePeer(ps->request, p, rtt, hops);
}
}
}
+#endif /* USE_ICMP */
/* if closest-only is set, then don't allow FIRST_PARENT_MISS */
if (p->options.closest_only)
peerHtcpParentMiss(peer * p, htcpReplyData * htcp, ps_state * ps)
{
int rtt;
- int hops;
+#if USE_ICMP
if (Config.onoff.query_icmp) {
if (htcp->cto.rtt > 0) {
rtt = (int) htcp->cto.rtt * 1000;
- hops = (int) htcp->cto.hops * 1000;
+ int hops = (int) htcp->cto.hops * 1000;
netdbUpdatePeer(ps->request, p, rtt, hops);
if (rtt && (ps->ping.p_rtt == 0 || rtt < ps->ping.p_rtt)) {
}
}
}
+#endif /* USE_ICMP */
/* if closest-only is set, then don't allow FIRST_PARENT_MISS */
if (p->options.closest_only)
#include "MemBuf.h"
#include "forward.h"
#include "SquidTime.h"
+#include "icmp/net_db.h"
#define URN_REQBUF_SZ 4096
char *token;
char *url;
char *host;
- int rtt;
url_entry *list;
url_entry *old;
int n = 32;
if (NULL == host)
continue;
- rtt = netdbHostRtt(host);
+#if USE_ICMP
+ list[i].rtt = netdbHostRtt(host);
- if (0 == rtt) {
+ if (0 == list[i].rtt) {
debugs(52, 3, "urnParseReply: Pinging " << host);
netdbPingSite(host);
}
+#else
+ list[i].rtt = 0;
+#endif
list[i].url = url;
list[i].host = xstrdup(host);
- list[i].rtt = rtt;
list[i].flags.cached = storeGetPublic(url, m) ? 1 : 0;
i++;
}
#include <iostream>
#include <sstream>
+/* AYJ: the debug stuff here should really be in a stub_debug.cc file for tests to link */
+
+/* for correct pre-definitions of debug objects */
+#include "Debug.h"
+
+FILE *debug_log = NULL;
+
void
xassert(const char *msg, const char *file, int line)
{