src/auth/Makefile \
src/adaptation/Makefile \
src/ICAP/Makefile \
+ src/icmp/Makefile \
src/eCAP/Makefile \
contrib/Makefile \
snmplib/Makefile \
static int TheDepth; // level of nested debugging calls
};
+extern FILE *debug_log;
+
/* Debug stream */
#define debugs(SECTION, LEVEL, CONTENT) \
do { \
TESTS=$(check_PROGRAMS)
check_PROGRAMS=
-SUBDIRS = fs repl auth
+SUBDIRS = fs repl auth icmp
if USE_ADAPTATION
SUBDIRS += adaptation
UNLINKD =
endif
-if ENABLE_PINGER
-PINGER = pinger
-else
-PINGER =
-endif
-
-# Squid Internal ICMP sources
-ICMPSOURCE = \
- ICMP.h \
- icmp.cc \
- ICMPConfig.h \
- ICMPSquid.h \
- ICMPSquid.cc
-
SSL_ALL_SOURCE = \
ACLCertificateData.cc \
ACLCertificateData.h \
EXTRA_PROGRAMS = \
DiskIO/DiskDaemon/diskd \
unlinkd \
- pinger \
+ icmp/pinger \
dnsserver \
recv-announce \
tests/testUfs \
libexec_PROGRAMS = \
- $(PINGER) \
$(DNSSERVER) \
@DISK_PROGRAMS@ \
$(UNLINKD)
HttpRequestMethod.cc \
HttpRequestMethod.h \
HttpVersion.h \
- $(ICMPSOURCE) \
ICP.h \
icp_v2.cc \
icp_v3.cc \
mime.cc \
multicast.cc \
neighbors.cc \
- net_db.cc \
Packer.cc \
Packer.h \
Parsing.cc \
squid_LDADD = \
libsquid.la \
libauth.la \
+ libsquid-icmp.la \
-L../lib \
@XTRA_OBJS@ \
@DISK_LINKOBJS@ \
unlinkd_SOURCES = unlinkd_daemon.cc SquidNew.cc
-## NP: the pinger contains the squid-external helper code
-## $(ICMPSOURCE) contains the interface bit to go inside squid
-pinger_SOURCES = \
- ICMP.h \
- icmp.cc \
- ICMPPinger.h \
- ICMPPinger.cc \
- ICMPv4.h \
- ICMPv4.cc \
- ICMPv6.h \
- ICMPv6.cc \
- pinger.cc \
- debug.cc \
- time.cc \
- SquidNew.cc
-
dnsserver_SOURCES = dnsserver.cc SquidNew.cc
recv_announce_SOURCES = recv-announce.cc SquidNew.cc
HttpReply.cc \
HttpRequest.cc \
HttpRequestMethod.cc \
- $(ICMPSOURCE) \
icp_v2.cc \
icp_v3.cc \
$(IDENT_SOURCE) \
mime.cc \
multicast.cc \
neighbors.cc \
- net_db.cc \
Packer.cc \
Parsing.cc \
$(XPROF_STATS_SOURCE) \
ufsdump_LDADD = \
libsquid.la \
libauth.la \
+ libsquid-icmp.la \
-L../lib \
@XTRA_OBJS@ \
@REPL_OBJS@ \
globals.cc \
string_arrays.c
-nodist_pinger_SOURCES = \
- globals.cc
-
BUILT_SOURCES = \
cf_gen_defines.h \
cf_parser.h \
DISTCLEANFILES = cf_gen_defines.h cf.data cf_parser.h squid.conf.default squid.conf.documented \
globals.cc string_arrays.c repl_modules.cc
-##install-pinger:
-## @f=$(PINGER_EXE); \
-## if test -f $(libexecdir)/$$f; then \
-## echo $(MV) $(libexecdir)/$$f $(libexecdir)/-$$f; \
-## $(MV) $(libexecdir)/$$f $(libexecdir)/-$$f; \
-## fi; \
-## echo $(INSTALL_SUID) $$f $(libexecdir); \
-## $(INSTALL_SUID) $$f $(libexecdir) || exit 1; \
-## if test -f $(libexecdir)/-$$f; then \
-## echo $(RM) -f $(libexecdir)/-$$f; \
-## $(RM) -f $(libexecdir)/-$$f; \
-## fi
-
# stock tools for unit tests - library independent versions of dlink_list
# etc.
# globals.cc is needed by test_tools.cc
tests/testEventLoop \
tests/test_http_range \
tests/testHttpRequest \
- tests/testICMP \
tests/testStore \
tests/testString \
tests/testURL \
HttpMsg.cc \
HttpReply.cc \
HttpStatusLine.cc \
- $(ICMPSOURCE) \
icp_v2.cc \
icp_v3.cc \
$(IDENT_SOURCE) \
MemObject.cc \
mime.cc \
neighbors.cc \
- net_db.cc \
Packer.cc \
Parsing.cc \
pconn.cc \
tests_testCacheManager_LDADD = \
libsquid.la \
libauth.la \
+ libsquid-icmp.la \
@REPL_OBJS@ \
${ADAPTATION_LIBS} \
@REGEXLIB@ \
HttpMsg.cc \
HttpReply.cc \
HttpStatusLine.cc \
- $(ICMPSOURCE) \
icp_v2.cc \
icp_v3.cc \
$(IDENT_SOURCE) \
MemObject.cc \
mime.cc \
neighbors.cc \
- net_db.cc \
Packer.cc \
Parsing.cc \
pconn.cc \
HttpMsg.cc \
HttpReply.cc \
HttpStatusLine.cc \
- $(ICMPSOURCE) \
icp_v2.cc \
icp_v3.cc \
$(IDENT_SOURCE) \
MemObject.cc \
mime.cc \
neighbors.cc \
- net_db.cc \
Packer.cc \
Parsing.cc \
pconn.cc \
HttpRequest.cc \
HttpRequestMethod.cc \
HttpStatusLine.cc \
- $(ICMPSOURCE) \
icp_v2.cc \
icp_v3.cc \
$(IDENT_SOURCE) \
mime.cc \
multicast.cc \
neighbors.cc \
- net_db.cc \
Parsing.cc \
peer_digest.cc \
peer_select.cc \
HttpMsg.cc \
HttpReply.cc \
HttpStatusLine.cc \
- $(ICMPSOURCE) \
icp_v2.cc \
icp_v3.cc \
$(IDENT_SOURCE) \
MemObject.cc \
mime.cc \
neighbors.cc \
- net_db.cc \
Packer.cc \
Parsing.cc \
pconn.cc \
@REPL_OBJS@ \
@SQUID_CPPUNIT_LA@
-## Tests of the ICMP base module.
-# Its used by pinger so SHOULD NOT require more dependancies! :-(
-tests_testICMP_SOURCES=\
- ICMP.h \
- icmp.cc \
- tests/testICMP.h \
- tests/testICMP.cc \
- tests/testMain.cc \
- SquidTime.h \
- time.cc \
- $(TESTSOURCES)
-tests_testICMP_LDFLAGS = $(LIBADD_DL)
-tests_testICMP_LDADD=\
- @SQUID_CPPUNIT_LIBS@ \
- @SQUID_CPPUNIT_LA@ \
- -L../lib -lmiscutil
-tests_testICMP_DEPENDENCIES= @SQUID_CPPUNIT_LA@ \
- $(top_builddir)/lib/libmiscutil.a
-
# TODO:mime.cc drags in HttpReply.cc
# delay pools need client_side_request.cc
# store_key_md5 wants the method.
HttpMsg.cc \
HttpReply.cc \
HttpStatusLine.cc \
- $(ICMPSOURCE) \
icp_v2.cc \
icp_v3.cc \
$(IDENT_SOURCE) \
MemObject.cc \
mime.cc \
neighbors.cc \
- net_db.cc \
Packer.cc \
Parsing.cc \
pconn.cc \
int Debug::Levels[MAX_DEBUG_SECTIONS];
int Debug::level;
-
+FILE *debug_log = NULL;
static char *debug_log_file = NULL;
static int Ctx_Lock = 0;
static const char *debugLogTime(void);
{
#endif
- extern FILE *debug_log; /* NULL */
+//MOVED:Debug.h extern FILE *debug_log; /* NULL */
//MOVED:structs.h extern SquidConfig Config;
//MOVED:structs.h extern SquidConfig2 Config2;
extern char *ConfigFile; /* NULL */
*
*/
#include "squid.h"
-#include "ICMP.h"
+#include "Icmp.h"
#include "SquidTime.h"
#include "Debug.h"
-ICMP::ICMP()
+Icmp::Icmp()
{
#if USE_ICMP
icmp_sock = -1;
}
void
-ICMP::Close()
+Icmp::Close()
{
#if USE_ICMP
if (icmp_sock > 0)
#if USE_ICMP
int
-ICMP::CheckSum(unsigned short *ptr, int size)
+Icmp::CheckSum(unsigned short *ptr, int size)
{
long sum;
unsigned short oddbyte;
}
int
-ICMP::ipHops(int ttl)
+Icmp::ipHops(int ttl)
{
if (ttl < 33)
return 33 - ttl;
}
void
-ICMP::Log(const IPAddress &addr, const u_int8_t type, const char* pkt_str, const int rtt, const int hops)
+Icmp::Log(const IPAddress &addr, const u_int8_t type, const char* pkt_str, const int rtt, const int hops)
{
debugs(42, 2, "pingerLog: " << std::setw(9) << current_time.tv_sec <<
"." << std::setfill('0') << std::setw(6) <<
* Child implementations define specific parts of these operations
* using these methods as a naming and parameter template.
*
- * ICMPSquid - implements the squid side of squid-pinger interface
- * ICMPPinger - implements the pinger side of the squid-pinger interface
- * ICMPv4 - implements pinger helper for ICMPv4
- * ICMPv6 - implements pinger helper for ICMPv6
+ * IcmpSquid - implements the squid side of squid-pinger interface
+ * IcmpPinger - implements the pinger side of the squid-pinger interface
+ * Icmpv4 - implements pinger helper for Icmpv4
+ * Icmpv6 - implements pinger helper for Icmpv6
*/
-class ICMP
+class Icmp
{
public:
- ICMP();
- virtual ~ICMP() {};
+ Icmp();
+ virtual ~Icmp() {};
/// Start pinger helper and initiate control channel
virtual int Open() =0;
#if USE_ICMP
#include "SquidTime.h"
-#include "ICMPv4.h"
-#include "ICMPPinger.h"
+#include "Icmp4.h"
+#include "IcmpPinger.h"
#include "Debug.h"
const char *icmpPktStr[] = {
"Out of Range Type"
};
-ICMPv4::ICMPv4() : ICMP()
+Icmp4::Icmp4() : Icmp()
{
;
}
-ICMPv4::~ICMPv4()
+Icmp4::~Icmp4()
{
Close();
}
int
-ICMPv4::Open(void)
+Icmp4::Open(void)
{
icmp_sock = socket(PF_INET, SOCK_RAW, IPPROTO_ICMP);
}
void
-ICMPv4::SendEcho(IPAddress &to, int opcode, const char *payload, int len)
+Icmp4::SendEcho(IPAddress &to, int opcode, const char *payload, int len)
{
int x;
LOCAL_ARRAY(char, pkt, MAX_PKT4_SZ);
}
void
-ICMPv4::Recv(void)
+Icmp4::Recv(void)
{
int n;
struct addrinfo *from = NULL;
#define _INCLUDE_ICMPV4_H
#include "config.h"
-#include "ICMP.h"
+#include "Icmp.h"
#include "IPAddress.h"
#if HAVE_NETINET_IN_SYSTM_H
* Class partially implementing RFC 792 - ICMP for IP version 4.
* Provides ECHO-REQUEST, ECHO-REPLY (secion 4.1)
*/
-class ICMPv4 : public ICMP
+class Icmp4 : public Icmp
{
public:
- ICMPv4();
- virtual ~ICMPv4();
+ Icmp4();
+ virtual ~Icmp4();
virtual int Open();
#if USE_ICMP
/// pinger helper contains one of these as a global object.
-SQUIDCEXTERN ICMPv4 icmp4;
+SQUIDCEXTERN Icmp4 icmp4;
#endif /* USE_ICMP && SQUID_HELPER */
#include "SquidTime.h"
#include "Debug.h"
-#include "ICMPv6.h"
-#include "ICMPPinger.h"
+#include "Icmp6.h"
+#include "IcmpPinger.h"
// Some system headers are only neeed internally here.
// They should not be included via the header.
#include <netinet/ip6.h>
#endif
-// ICMPv6 OP-Codes
+// Icmp6 OP-Codes
// see http://www.iana.org/assignments/icmpv6-parameters
// NP: LowPktStr is for codes 0-127
static const char *icmp6LowPktStr[] = {
"ICMP 160"
};
-ICMPv6::ICMPv6() : ICMP()
+Icmp6::Icmp6() : Icmp()
{
; // nothing new.
}
-ICMPv6::~ICMPv6()
+Icmp6::~Icmp6()
{
Close();
}
int
-ICMPv6::Open(void)
+Icmp6::Open(void)
{
icmp_sock = socket(PF_INET6, SOCK_RAW, IPPROTO_ICMPV6);
}
icmp_ident = getpid() & 0xffff;
- debugs(42, 1, "pinger: ICMPv6 socket opened");
+ debugs(42, 1, "pinger: Icmp6 socket opened");
return icmp_sock;
}
/**
- * Generates an RFC 4443 ICMPv6 ECHO Packet and sends into the network.
+ * Generates an RFC 4443 Icmp6 ECHO Packet and sends into the network.
*/
void
-ICMPv6::SendEcho(IPAddress &to, int opcode, const char *payload, int len)
+Icmp6::SendEcho(IPAddress &to, int opcode, const char *payload, int len)
{
int x;
LOCAL_ARRAY(char, pkt, MAX_PKT6_SZ);
len = 0;
}
- // Construct ICMPv6 ECHO header
+ // Construct Icmp6 ECHO header
icmp->icmp6_type = ICMP6_ECHO_REQUEST;
icmp->icmp6_code = 0;
icmp->icmp6_cksum = 0;
icmp6_pktsize = sizeof(struct icmp6_hdr);
- // Fill ICMPv6 ECHO data content
+ // Fill Icmp6 ECHO data content
echo = (icmpEchoData *) (pkt + sizeof(icmp6_hdr));
echo->opcode = (unsigned char) opcode;
memcpy(&echo->tv, ¤t_time, sizeof(struct timeval));
assert(icmp6_pktsize <= MAX_PKT6_SZ);
- debugs(42, 5, HERE << "Send ICMPv6 packet to " << to << ".");
+ debugs(42, 5, HERE << "Send Icmp6 packet to " << to << ".");
x = sendto(icmp_sock,
(const void *) pkt,
}
/**
- * Reads an RFC 4443 ICMPv6 ECHO-REPLY Packet from the network.
+ * Reads an RFC 4443 Icmp6 ECHO-REPLY Packet from the network.
*/
void
-ICMPv6::Recv(void)
+Icmp6::Recv(void)
{
int n;
struct addrinfo *from = NULL;
}
if (icmp6->icmp6_id != icmp_ident) {
- debugs(42, 8, HERE << "dropping ICMPv6 read. IDENT check failed. ident=='" << icmp_ident << "'=='" << icmp6->icmp6_id << "'");
+ debugs(42, 8, HERE << "dropping Icmp6 read. IDENT check failed. ident=='" << icmp_ident << "'=='" << icmp6->icmp6_id << "'");
return;
}
#if USE_IPV6
-#include "ICMP.h"
+#include "Icmp.h"
#include "IPAddress.h"
#if HAVE_NETINET_IN_H
* Class partially implementing RFC 4443 - ICMPv6 for IP version 6.
* Provides ECHO-REQUEST, ECHO-REPLY (secion 4)
*/
-class ICMPv6 : public ICMP
+class Icmp6 : public Icmp
{
public:
- ICMPv6();
- virtual ~ICMPv6();
+ Icmp6();
+ virtual ~Icmp6();
virtual int Open();
#if USE_ICMP
/// pinger helper contains one of these as a global object.
-SQUIDCEXTERN ICMPv6 icmp6;
+SQUIDCEXTERN Icmp6 icmp6;
#endif /* USE_ICMP && SQUID_HELPER */
-
#endif /* USE_IPV6 */
-
#endif /* _INCLUDE_ICMPV6_H */
* This structure is included as a child field of the global Config
* such that if ICMP is built it can be accessed as Config.pinger.*
*/
-class ICMPConfig
+class IcmpConfig
{
public:
/** \todo These methods should really be defined in an ICMPConfig.cc file
* alongside any custom parsing routines needed for this component.
* First though, the whole global Config dependancy tree needs fixing */
- ICMPConfig() : program(NULL), enable(0) {};
- ~ICMPConfig() { if (program) delete program; program = NULL; };
+ IcmpConfig() : program(NULL), enable(0) {};
+ ~IcmpConfig() { if (program) delete program; program = NULL; };
/* variables */
#if USE_ICMP
#include "SquidTime.h"
-#include "ICMPPinger.h"
-#include "ICMPv4.h"
-#include "ICMPv6.h"
+#include "IcmpPinger.h"
+#include "Icmp4.h"
+#include "Icmp6.h"
#include "Debug.h"
-ICMPPinger::ICMPPinger() : ICMP()
+IcmpPinger::IcmpPinger() : Icmp()
{
// these start invalid. Setup properly in Open()
socket_from_squid = -1;
socket_to_squid = -1;
}
-ICMPPinger::~ICMPPinger()
+IcmpPinger::~IcmpPinger()
{
Close();
}
#endif
int
-ICMPPinger::Open(void)
+IcmpPinger::Open(void)
{
#ifdef _SQUID_MSWIN_
}
void
-ICMPPinger::Close(void)
+IcmpPinger::Close(void)
{
#ifdef _SQUID_MSWIN_
}
void
-ICMPPinger::Recv(void)
+IcmpPinger::Recv(void)
{
static pingerEchoData pecho;
int n;
}
void
-ICMPPinger::SendResult(pingerReplyData &preply, int len)
+IcmpPinger::SendResult(pingerReplyData &preply, int len)
{
debugs(42, 2, HERE << "return result to squid. len=" << len);
#define _INCLUDE_ICMPPINGER_H
#include "config.h"
-#include "ICMP.h"
+#include "Icmp.h"
/**
* Implements the interface to squid for ICMP operations
*/
-class ICMPPinger : public ICMP
+class IcmpPinger : public Icmp
{
public:
- ICMPPinger();
- virtual ~ICMPPinger();
+ IcmpPinger();
+ virtual ~IcmpPinger();
/// Start and initiate control channel to squid
virtual int Open();
virtual void Recv(void);
private:
- // unused in ICMPPinger
+ // unused in IcmpPinger
virtual void SendEcho(IPAddress &to, int opcode, const char *payload, int len) {};
/**
#if USE_ICMP
/// pinger helper contains one of these as a global object.
-SQUIDCEXTERN ICMPPinger control;
+SQUIDCEXTERN IcmpPinger control;
#endif
*/
#include "squid.h"
-#include "ICMPSquid.h"
+#include "IcmpSquid.h"
#include "comm.h"
#include "SquidTime.h"
// Instance global to be available in main() and elsewhere.
-ICMPSquid icmpEngine;
+IcmpSquid icmpEngine;
#if USE_ICMP
#endif /* USE_ICMP */
-ICMPSquid::ICMPSquid() : ICMP()
+IcmpSquid::IcmpSquid() : Icmp()
{
; // nothing new.
}
-ICMPSquid::~ICMPSquid()
+IcmpSquid::~IcmpSquid()
{
Close();
}
#if USE_ICMP
void
-ICMPSquid::SendEcho(IPAddress &to, int opcode, const char *payload, int len)
+IcmpSquid::SendEcho(IPAddress &to, int opcode, const char *payload, int len)
{
static pingerEchoData pecho;
int x, slen;
}
// static Callback to wrap the squid-side ICMP handler.
-// the ICMPSquid::Recv cannot be declared both static and virtual.
+// the IcmpSquid::Recv cannot be declared both static and virtual.
static void
icmpSquidRecv(int unused1, void *unused2)
{
}
void
-ICMPSquid::Recv()
+IcmpSquid::Recv()
{
int n;
static int fail_count = 0;
#endif /* USE_ICMP */
void
-ICMPSquid::DomainPing(IPAddress &to, const char *domain)
+IcmpSquid::DomainPing(IPAddress &to, const char *domain)
{
#if USE_ICMP
debugs(37, 4, HERE << "'" << domain << "' (" << to << ")");
}
int
-ICMPSquid::Open(void)
+IcmpSquid::Open(void)
{
#if USE_ICMP
const char *args[2];
}
void
-ICMPSquid::Close(void)
+IcmpSquid::Close(void)
{
#if USE_ICMP
#define _INCLUDE_ICMPSQUID_H
#include "config.h"
-#include "ICMP.h"
+#include "Icmp.h"
#include "IPAddress.h"
/**
*
* Provides ECHO-REQUEST, ECHO-REPLY in a protocol-neutral manner.
*/
-class ICMPSquid : public ICMP
+class IcmpSquid : public Icmp
{
public:
- ICMPSquid();
- virtual ~ICMPSquid();
+ IcmpSquid();
+ virtual ~IcmpSquid();
virtual int Open();
virtual void Close();
};
// global engine within squid.
-SQUIDCEXTERN ICMPSquid icmpEngine;
+SQUIDCEXTERN IcmpSquid icmpEngine;
#endif /* _INCLUDE_ICMPSQUID_H */
#include "IPAddress.h"
#if USE_ICMP
-#include "ICMPSquid.h"
+#include "IcmpSquid.h"
#include "StoreClient.h"
#define NETDB_REQBUF_SZ 4096
#if USE_ICMP
-#include "ICMPv4.h"
-#include "ICMPv6.h"
-#include "ICMPPinger.h"
+#include "Icmp4.h"
+#include "Icmp6.h"
+#include "IcmpPinger.h"
#ifdef _SQUID_MSWIN_
#endif /* _SQUID_MSWIN_ */
// ICMP Engines are declared global here so they can call each other easily.
-ICMPPinger control;
-ICMPv4 icmp4;
+IcmpPinger control;
+Icmp4 icmp4;
#if USE_IPV6
-ICMPv6 icmp6;
+Icmp6 icmp6;
#endif
int icmp_pkts_sent = 0;
#include <cppunit/TestAssert.h>
-#include "testICMP.h"
+#include "testIcmp.h"
-CPPUNIT_TEST_SUITE_REGISTRATION( testICMP );
+CPPUNIT_TEST_SUITE_REGISTRATION( testIcmp );
#if USE_ICMP
void
-testICMP::testChecksum()
+testIcmp::testChecksum()
{
- stubICMP icmp;
+ stubIcmp icmp;
short unsigned int buf[10] = {1,2,3,4,5,6,7,8,9};
// NULL data
}
void
-testICMP::testHops()
+testIcmp::testHops()
{
- stubICMP icmp;
+ stubIcmp icmp;
/* test invalid -(under values) */
// negative : n > 33
#include <cppunit/extensions/HelperMacros.h>
-#include "ICMP.h"
+#include "Icmp.h"
#if USE_ICMP
-class stubICMP : public ICMP
+class stubIcmp : public Icmp
{
public:
- stubICMP() {};
- virtual ~stubICMP() {};
+ stubIcmp() {};
+ virtual ~stubIcmp() {};
virtual int Open() { return 0; };
virtual void Close() {};
/**
* test the ICMP base class.
*/
-class testICMP : public CPPUNIT_NS::TestFixture
+class testIcmp : public CPPUNIT_NS::TestFixture
{
- CPPUNIT_TEST_SUITE( testICMP );
+ CPPUNIT_TEST_SUITE( testIcmp );
#if USE_ICMP
CPPUNIT_TEST( testChecksum );
CPPUNIT_TEST( testHops );
#endif
#if USE_ICMP
-#include "ICMPConfig.h"
+#include "icmp/IcmpConfig.h"
#endif
/* forward decl for SquidConfig, see RemovalPolicy.h */
#endif
#if USE_ICMP
- ICMPConfig pinger;
+ IcmpConfig pinger;
#endif
char *as_whois_server;