54 char buf[
sizeof(wpi)+1];
57 struct sockaddr_in PS;
60 static_assert(
sizeof(WSAPROTOCOL_INFO) >=
sizeof(PS),
"PS must fit into wpi-sized buf");
62 WSAStartup(2, &wsaData);
72 x =
xread(0, buf,
sizeof(wpi));
74 if (x < (
int)
sizeof(wpi)) {
82 memcpy(&wpi, buf,
sizeof(wpi));
85 x =
xread(0, buf,
sizeof(PS));
87 if (x < (
int)
sizeof(PS)) {
95 memcpy(&PS, buf,
sizeof(PS));
97 icmp_sock = WSASocket(FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO, &wpi, 0, 0);
118 memset(buf, 0,
sizeof(buf));
130 if (x < 3 || strncmp(
"OK\n", buf, 3)) {
195 if (guess_size != pecho.
psize) {
196 debugs(42, 2,
"size mismatch, guess=" << guess_size <<
", psize=" << pecho.
psize);
203 debugs(42, 2,
" Pass " << pecho.
to <<
" off to ICMPv6 module.");
212 debugs(42, 2,
" Pass " << pecho.
to <<
" off to ICMPv4 module.");
225 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 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)
ssize_t xrecv(int socketFd, void *buf, size_t bufLength, int flags)
POSIX recv(2) equivalent.
ssize_t xsend(int socketFd, const void *buf, size_t bufLength, int flags)
POSIX send(2) equivalent.
int xconnect(int socketFd, const struct sockaddr *sa, socklen_t saLength)
POSIX connect(2) equivalent.
char payload[PINGER_PAYLOAD_SZ]
time_t getCurrentTime() STUB_RETVAL(0) int tvSubUsec(struct timeval
int xread(int fd, void *buf, size_t bufSize)
POSIX read(2) equivalent.
int xwrite(int fd, const void *buf, size_t bufSize)
POSIX write(2) equivalent.
int xclose(int fd)
POSIX close(2) equivalent.
static void Win32SockCleanup(void)
const char * xstrerr(int error)