|
Squid Web Cache master
|
#include <Icmp.h>
Public Member Functions | |
| Icmp () | |
| virtual | ~Icmp () |
| virtual int | Open ()=0 |
| Start pinger helper and initiate control channel. | |
| virtual void | Close () |
| Shutdown pinger helper and control channel. | |
| virtual void | SendEcho (Ip::Address &to, int opcode, const char *payload=nullptr, int len=0)=0 |
| virtual void | Recv (void)=0 |
| Handle ICMP responses. | |
Protected Member Functions | |
| int | CheckSum (unsigned short *ptr, int size) |
| Calculate a packet checksum. | |
| 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. | |
Protected Attributes | |
| int | icmp_sock |
| int | icmp_ident |
Implements the squid interface to access ICMP operations
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
| Icmp::Icmp | ( | ) |
Definition at line 17 of file Icmp.cc.
References icmp_ident, and icmp_sock.
Definition at line 39 of file Icmp.cc.
References size.
Referenced by Icmp4::SendEcho(), Icmp6::SendEcho(), and IcmpStub::testChecksum().
|
virtual |
Reimplemented in IcmpPinger, IcmpSquid, and IcmpStub.
Definition at line 26 of file Icmp.cc.
References icmp_ident, icmp_sock, and xclose().
Referenced by Icmp4::~Icmp4(), Icmp6::~Icmp6(), IcmpPinger::Close(), and main().
Translate TTL to a hop distance
| ttl | negative : n > 33 |
| ttl | n(0...32) : 32 >= n >= 1 |
| ttl | n(33...62) : 32 >= n >= 1 |
| ttl | n(63...64) : 2 >= n >= 1 |
| ttl | n(65...128) : 64 >= n >= 1 |
| ttl | n(129...192) : 64 >= n >= 1 |
| ttl | n(193...) : n < 255 |
XXX: BUG? ttl<0 can produce high hop values XXX: BUG? ttl>255 can produce zero or negative hop values
Definition at line 68 of file Icmp.cc.
Referenced by Icmp4::Recv(), and IcmpStub::testHops().
|
protected |
Definition at line 89 of file Icmp.cc.
References current_time, and debugs.
|
pure virtual |
Implemented in Icmp4, Icmp6, IcmpPinger, IcmpSquid, and IcmpStub.
|
pure virtual |
Implemented in Icmp4, Icmp6, IcmpPinger, IcmpSquid, and IcmpStub.
|
pure virtual |
Construct and Send an ECHO request
| to | Destination address being 'pinged' |
| opcode | Specific code for ECHO request, see RFC ????. |
| payload | A payload MAY be sent in the ICMP message. Content longer than MAX_PAYLOAD will be truncated. |
| len | Length of the payload in bytes if any is to be sent or 0. |
Implemented in Icmp4, Icmp6, IcmpPinger, IcmpStub, and IcmpSquid.
|
protected |
Definition at line 122 of file Icmp.h.
Referenced by Icmp(), Close(), Icmp4::Open(), Icmp6::Open(), Icmp4::Recv(), Icmp6::Recv(), Icmp4::SendEcho(), and Icmp6::SendEcho().
|
protected |
Definition at line 121 of file Icmp.h.
Referenced by Icmp(), Close(), IcmpPinger::Close(), IcmpSquid::Close(), Icmp4::Open(), Icmp6::Open(), IcmpPinger::Open(), IcmpSquid::Open(), Icmp4::Recv(), Icmp6::Recv(), IcmpSquid::Recv(), Icmp4::SendEcho(), Icmp6::SendEcho(), and IcmpSquid::SendEcho().