11 #define SQUID_HELPER 1
63 #define PINGER_TIMEOUT 5
66 #define LINK_TO_SQUID squid_link
72 Win32__WSAFDIsSet(
int fd, fd_set FAR * set)
75 SOCKET s =
F->win32.handle;
77 return __WSAFDIsSet(s, set);
82 #define PINGER_TIMEOUT 10
85 #define LINK_TO_SQUID 1
108 time_t last_check_time = 0;
114 int icmp4_worker = -1;
115 int icmp6_worker = -1;
128 if (icmp4_worker < 0) {
131 max_fd =
max(max_fd, icmp4_worker);
135 if (icmp6_worker <0 ) {
138 max_fd =
max(max_fd, icmp6_worker);
142 if (icmp4_worker < 0 && icmp6_worker < 0) {
153 max_fd =
max(max_fd, squid_link);
155 if (setgid(getgid()) < 0) {
162 if (setuid(getuid()) < 0) {
183 if (cap_set_proc(caps) != 0) {
202 if (icmp4_worker >= 0) {
203 FD_SET(icmp4_worker, &R);
205 if (icmp6_worker >= 0) {
206 FD_SET(icmp6_worker, &R);
209 FD_SET(squid_link, &R);
210 x = select(max_fd+1, &R,
NULL,
NULL, &tv);
220 if (FD_ISSET(squid_link, &R)) {
224 if (icmp6_worker >= 0 && FD_ISSET(icmp6_worker, &R)) {
227 if (icmp4_worker >= 0 && FD_ISSET(icmp4_worker, &R)) {
250 main(
int argc,
char *argv[])
252 std::cerr << argv[0] <<
": ICMP support not compiled in." << std::endl;
static void NameThisHelper(const char *name)
virtual void Recv(void)
Handle ICMP responses.
virtual int Open()
Start pinger helper and initiate control channel.
virtual int Open()
Start pinger helper and initiate control channel.
virtual void Close()
Shutdown pinger helper and control channel.
virtual void Recv(void)
Handle ICMP requests from squid, passing to helpers.
virtual int Open()
Start and initiate control channel to squid.
virtual void Close()
Shutdown pinger helper and control channel.
A const & max(A const &lhs, A const &rhs)
#define debugs(SECTION, LEVEL, CONTENT)
static uint32 F(uint32 X, uint32 Y, uint32 Z)
void ProbeTransport(void)
Probe to discover IPv6 capabilities.
IcmpPinger control
pinger helper contains one of these as a global object.
Icmp6 icmp6
pinger helper contains one of these as a global object.
Icmp4 icmp4
pinger helper contains one of these as a global object.
time_t getCurrentTime() STUB_RETVAL(0) int tvSubUsec(struct timeval
const char * xstrerr(int error)