#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 &to, int opcode, const char *payload, int len)
 

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 ( )

Definition at line 25 of file IcmpPinger.cc.

References socket_from_squid, and socket_to_squid.

IcmpPinger::~IcmpPinger ( )
virtual

Definition at line 32 of file IcmpPinger.cc.

References Close().

Member Function Documentation

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

Definition at line 38 of file Icmp.cc.

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

void IcmpPinger::Close ( void  )
virtual

Reimplemented from Icmp.

Definition at line 148 of file IcmpPinger.cc.

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

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

int Icmp::ipHops ( int  ttl)
protectedinherited

Translate TTL to a hop distance

Parameters
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:

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().

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

Definition at line 88 of file Icmp.cc.

References current_time, and debugs.

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

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

Construct and Send an ECHO request

Parameters
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.

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 Icmp6::Recv(), and Icmp4::Recv().

Member Data Documentation

int Icmp::icmp_ident
protectedinherited
int IcmpPinger::socket_from_squid
private

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

Definition at line 40 of file IcmpPinger.h.

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

int IcmpPinger::socket_to_squid
private

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:

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors