#include <IcmpPinger.h>

Inheritance diagram for IcmpPinger:
Collaboration diagram for IcmpPinger:

Public Member Functions

 IcmpPinger ()
virtual ~IcmpPinger ()
virtual int Open ()
 Start and initiate control channel to squid. More...
virtual void Close ()
 Shutdown pinger helper and control channel. More...
void SendResult (pingerReplyData &preply, int len)
 Send ICMP results back to squid. More...
virtual void Recv (void)
 Handle ICMP requests from squid, passing to helpers. More...

Protected Member Functions

int CheckSum (unsigned short *ptr, int size)
 Calculate a packet checksum. More...
int ipHops (int ttl)
void Log (const Ip::Address &addr, const uint8_t type, const char *pkt_str, const int rtt, const int hops)
 Log the packet. More...

Protected Attributes

int icmp_sock
int icmp_ident

Private Member Functions

virtual void SendEcho (Ip::Address &, int, const char *, int)

Private Attributes

int socket_from_squid
int socket_to_squid

Detailed Description

Implements the interface to squid for ICMP operations

Definition at line 18 of file IcmpPinger.h.

Constructor & Destructor Documentation

◆ IcmpPinger()

IcmpPinger::IcmpPinger ( )

Definition at line 25 of file IcmpPinger.cc.

References socket_from_squid, and socket_to_squid.

◆ ~IcmpPinger()

IcmpPinger::~IcmpPinger ( )

Definition at line 32 of file IcmpPinger.cc.

References Close().

Member Function Documentation

◆ CheckSum()

int Icmp::CheckSum ( unsigned short *  ptr,
int  size 

Definition at line 38 of file Icmp.cc.

References size.

Referenced by Icmp4::SendEcho(), Icmp6::SendEcho(), and stubIcmp::testChecksum().

◆ Close()

void IcmpPinger::Close ( void  )

Reimplemented from Icmp.

Definition at line 148 of file IcmpPinger.cc.

References Icmp::Close(), icmp4, icmp6, and Icmp::icmp_sock.

Referenced by ~IcmpPinger(), main(), Recv(), and SendResult().

◆ ipHops()

int Icmp::ipHops ( int  ttl)

Translate TTL to a hop distance

ttlnegative : n > 33
ttln(0...32) : 32 >= n >= 1
ttln(33...62) : 32 >= n >= 1
ttln(63...64) : 2 >= n >= 1
ttln(65...128) : 64 >= n >= 1
ttln(129...192) : 64 >= n >= 1
ttln(193...) : n < 255
BUG? ttl<0 can produce high hop values
BUG? ttl>255 can produce zero or negative hop values

Definition at line 67 of file Icmp.cc.

Referenced by Icmp4::Recv(), and stubIcmp::testHops().

◆ Log()

void Icmp::Log ( const Ip::Address addr,
const uint8_t  type,
const char *  pkt_str,
const int  rtt,
const int  hops 

Definition at line 88 of file Icmp.cc.

References current_time, debugs, and type.

Referenced by Icmp4::Recv(), Icmp6::Recv(), Icmp4::SendEcho(), and Icmp6::SendEcho().

◆ Open()

int IcmpPinger::Open ( void  )

◆ Recv()

◆ SendEcho()

virtual void IcmpPinger::SendEcho ( Ip::Address to,
int  opcode,
const char *  payload,
int  len 

Construct and Send an ECHO request

toDestination address being 'pinged'
opcodeSpecific code for ECHO request, see RFC ????.
payloadA payload MAY be sent in the ICMP message. Content longer than MAX_PAYLOAD will be truncated.
lenLength of the payload in bytes if any is to be sent or 0.

Implements Icmp.

Definition at line 40 of file IcmpPinger.h.

◆ SendResult()

void IcmpPinger::SendResult ( pingerReplyData preply,
int  len 

Definition at line 216 of file IcmpPinger.cc.

References Close(), DBG_CRITICAL, debugs, HERE(), socket_to_squid, and xstrerr().

Referenced by Icmp4::Recv(), and Icmp6::Recv().

Member Data Documentation

◆ icmp_ident

int Icmp::icmp_ident

◆ icmp_sock

◆ socket_from_squid

int IcmpPinger::socket_from_squid

Control channel(s) to squid. May be STDIN/STDOUT pipes or an IP socket depending on the OS

Definition at line 46 of file IcmpPinger.h.

Referenced by IcmpPinger(), Open(), and Recv().

◆ socket_to_squid

int IcmpPinger::socket_to_squid

Definition at line 47 of file IcmpPinger.h.

Referenced by IcmpPinger(), Open(), and SendResult().

The documentation for this class was generated from the following files:






Web Site Translations