#include <Icmp4.h>
![Inheritance graph](classIcmp4__inherit__graph.png)
![Collaboration graph](classIcmp4__coll__graph.png)
Public Member Functions | |
Icmp4 () | |
~Icmp4 () override | |
int | Open () override |
Start pinger helper and initiate control channel. More... | |
void | SendEcho (Ip::Address &, int, const char *, int) override |
void | Recv (void) override |
Handle ICMP responses. More... | |
virtual void | Close () |
Shutdown pinger helper and control channel. 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
Class partially implementing RFC 792 - ICMP for IP version 4. Provides ECHO-REQUEST, ECHO-REPLY (section 4.1)
Constructor & Destructor Documentation
◆ Icmp4()
◆ ~Icmp4()
|
override |
Definition at line 60 of file Icmp4.cc.
References Icmp::Close().
Member Function Documentation
◆ CheckSum()
Definition at line 38 of file Icmp.cc.
References size.
Referenced by Icmp6::SendEcho(), SendEcho(), and IcmpStub::testChecksum().
◆ Close()
|
virtualinherited |
Reimplemented in IcmpSquid, IcmpPinger, and IcmpStub.
Definition at line 25 of file Icmp.cc.
References Icmp::icmp_ident, and Icmp::icmp_sock.
Referenced by IcmpPinger::Close(), main(), ~Icmp4(), and Icmp6::~Icmp6().
◆ ipHops()
Translate TTL to a hop distance
- Parameters
-
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 67 of file Icmp.cc.
Referenced by Recv(), and IcmpStub::testHops().
◆ Log()
|
protectedinherited |
Definition at line 88 of file Icmp.cc.
References current_time, and debugs.
Referenced by Icmp6::Recv(), Recv(), Icmp6::SendEcho(), and SendEcho().
◆ Open()
|
overridevirtual |
Implements Icmp.
Definition at line 66 of file Icmp4.cc.
References DBG_CRITICAL, DBG_IMPORTANT, debugs, Icmp::icmp_ident, Icmp::icmp_sock, IPPROTO_ICMP, MYNAME, and xstrerr().
Referenced by main().
◆ Recv()
|
overridevirtual |
Implements Icmp.
Definition at line 156 of file Icmp4.cc.
References control, DBG_CRITICAL, debugs, Ip::Address::FreeAddr(), pingerReplyData::from, pingerReplyData::hops, ICMP_ECHOREPLY, Icmp::icmp_ident, Icmp::icmp_sock, icmphdr, IcmpPacketType(), Ip::Address::InitAddr(), iphdr, Icmp::ipHops(), Icmp::Log(), MAX_PKT4_SZ, pingerReplyData::opcode, pingerReplyData::psize, pingerReplyData::rtt, IcmpPinger::SendResult(), tvSubMsec(), and xmalloc.
Referenced by main().
◆ SendEcho()
|
overridevirtual |
Construct and Send an ECHO request
- Parameters
-
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.
Implements Icmp.
Definition at line 83 of file Icmp4.cc.
References assert, Icmp::CheckSum(), current_time, DBG_IMPORTANT, debugs, Ip::Address::FreeAddr(), Ip::Address::getAddrInfo(), ICMP_ECHO, Icmp::icmp_ident, icmp_pkts_sent, Icmp::icmp_sock, icmphdr, LOCAL_ARRAY, Icmp::Log(), MAX_PAYLOAD, MAX_PKT4_SZ, MYNAME, icmpEchoData::opcode, icmpEchoData::payload, icmpEchoData::tv, and xstrerr().
Referenced by IcmpPinger::Recv().
Member Data Documentation
◆ icmp_ident
|
protectedinherited |
Definition at line 122 of file Icmp.h.
Referenced by Icmp::Close(), Icmp::Icmp(), Icmp6::Open(), Open(), Icmp6::Recv(), Recv(), Icmp6::SendEcho(), and SendEcho().
◆ icmp_sock
|
protectedinherited |
Definition at line 121 of file Icmp.h.
Referenced by IcmpPinger::Close(), IcmpSquid::Close(), Icmp::Close(), Icmp::Icmp(), IcmpPinger::Open(), IcmpSquid::Open(), Icmp6::Open(), Open(), IcmpSquid::Recv(), Icmp6::Recv(), Recv(), IcmpSquid::SendEcho(), Icmp6::SendEcho(), and SendEcho().
The documentation for this class was generated from the following files:
Introduction
- About Squid
- Why Squid?
- Squid Developers
- How to Donate
- How to Help Out
- Getting Squid
- Squid Source Packages
- Squid Deployment Case-Studies
- Squid Software Foundation
Documentation
- Quick Setup
- Configuration:
- FAQ and Wiki
- Guide Books:
- Non-English
- More...
Support
- Security Advisories
- Bugzilla Database
- Mailing lists
- Contacting us
- Commercial services
- Project Sponsors
- Squid-based products