52 char buf[
sizeof(wpi)];
55 struct sockaddr_in PS;
58 WSAStartup(2, &wsaData);
68 x = read(0, buf,
sizeof(wpi));
70 if (x < (
int)
sizeof(wpi)) {
78 memcpy(&wpi, buf,
sizeof(wpi));
81 x = read(0, buf,
sizeof(PS));
83 if (x < (
int)
sizeof(PS)) {
91 memcpy(&PS, buf,
sizeof(PS));
93 icmp_sock = WSASocket(FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO, &wpi, 0, 0);
103 x = connect(
icmp_sock, (
struct sockaddr *) &PS,
sizeof(PS));
105 if (SOCKET_ERROR == x) {
109 write(1,
"ERR\n", 4);
114 memset(buf, 0,
sizeof(buf));
115 x = recv(
icmp_sock, (
void *) buf,
sizeof(buf), 0);
123 x = send(
icmp_sock, (
const void *) buf, strlen(buf), 0);
126 if (x < 3 || strncmp(
"OK\n", buf, 3)) {
190 if (guess_size != pecho.
psize) {
191 debugs(42, 2,
"size mismatch, guess=" << guess_size <<
", psize=" << pecho.
psize);
198 debugs(42, 2,
" Pass " << pecho.
to <<
" off to ICMPv6 module.");
207 debugs(42, 2,
" Pass " << pecho.
to <<
" off to ICMPv4 module.");
220 debugs(42, 2,
"return result to squid. len=" << len);
Icmp4 icmp4
pinger helper contains one of these as a global object.
Icmp6 icmp6
pinger helper contains one of these as a global object.
#define PINGER_PAYLOAD_SZ
static void Win32SockCleanup(void)
static char * debugOptions
static void BanCacheLogUse()
void SendEcho(Ip::Address &, int, const char *, int) override
void SendEcho(Ip::Address &, int, const char *, int) override
void SendResult(pingerReplyData &preply, int len)
Send ICMP results back to squid.
void Recv(void) override
Handle ICMP requests from squid, passing to helpers.
void Close() override
Shutdown pinger helper and control channel.
int Open() override
Start and initiate control channel to squid.
virtual void Close()
Shutdown pinger helper and control channel.
#define debugs(SECTION, LEVEL, CONTENT)
char payload[PINGER_PAYLOAD_SZ]
time_t getCurrentTime() STUB_RETVAL(0) int tvSubUsec(struct timeval
const char * xstrerr(int error)