#include <Icmp.h>

Inheritance diagram for Icmp:
Collaboration diagram for Icmp:

Public Member Functions

 Icmp ()
 
virtual ~Icmp ()
 
virtual int Open ()=0
 Start pinger helper and initiate control channel. More...
 
virtual void Close ()
 Shutdown pinger helper and control channel. More...
 
virtual void SendEcho (Ip::Address &to, int opcode, const char *payload=NULL, int len=0)=0
 
virtual void Recv (void)=0
 Handle ICMP responses. 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
 

Detailed Description

Implements the squid interface to access ICMP operations

Child implementations define specific parts of these operations using these methods as a naming and parameter template.

IcmpSquid - implements the squid side of squid-pinger interface IcmpPinger - implements the pinger side of the squid-pinger interface Icmpv4 - implements pinger helper for Icmpv4 Icmpv6 - implements pinger helper for Icmpv6

Definition at line 64 of file Icmp.h.

Constructor & Destructor Documentation

Icmp::Icmp ( )

Definition at line 16 of file Icmp.cc.

References icmp_ident, and icmp_sock.

virtual Icmp::~Icmp ( )
inlinevirtual

Definition at line 68 of file Icmp.h.

Member Function Documentation

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

Definition at line 38 of file Icmp.cc.

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

void Icmp::Close ( void  )
virtual

Reimplemented in IcmpSquid, IcmpPinger, and stubIcmp.

Definition at line 25 of file Icmp.cc.

References icmp_ident, and icmp_sock.

Referenced by IcmpPinger::Close(), main(), Icmp4::~Icmp4(), and Icmp6::~Icmp6().

int Icmp::ipHops ( int  ttl)
protected

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

Definition at line 88 of file Icmp.cc.

References current_time, and debugs.

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

virtual int Icmp::Open ( )
pure virtual

Implemented in Icmp4, Icmp6, IcmpSquid, IcmpPinger, and stubIcmp.

virtual void Icmp::Recv ( void  )
pure virtual

Implemented in Icmp4, Icmp6, IcmpSquid, IcmpPinger, and stubIcmp.

virtual void Icmp::SendEcho ( Ip::Address to,
int  opcode,
const char *  payload = NULL,
int  len = 0 
)
pure virtual

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.

Implemented in Icmp4, Icmp6, IcmpPinger, IcmpSquid, and stubIcmp.

Member Data Documentation

int Icmp::icmp_ident
protected

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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors