Common interface for an IPv4 destination we wish to ping with ICMP or TCP. More...
#include <DwmPingDestination.hh>

Public Member Functions | |
| PingDestination () | |
| Constructor. | |
| PingDestination (const std::string &destination) | |
| Construct from a string of the form 'a.b.c.d:n' where a.b.c.d is the IP address and n is the port number. More... | |
| PingDestination (const Ipv4Address &addr, uint16_t port=0) | |
| Construct from an IP address (for an ICMP destination), or an IP address and port number (for a TCP destination). More... | |
| const Ipv4Address & | Address () const |
| Returns the destination IP address. | |
| const Ipv4Address & | Address (const Ipv4Address &address) |
| Sets and returns the destination IP address. | |
| uint16_t | Port () const |
| Returns the port number (0 for ICMP). | |
| const std::string & | Hostname () const |
| Returns the hostname (an empty string if it was not set). | |
| const std::string & | Hostname (const std::string &hostname) |
| Sets and returns the hostname. | |
| bool | SendTo (Socket &socket, const Ipv4Address &myAddress, uint16_t identifier) const |
| Sends a 'ping' to the destination. More... | |
| bool | operator< (const PingDestination &pd) const |
| operator < | |
| bool | operator== (const PingDestination &pd) const |
| operator == | |
| virtual | operator std::string () const |
| Returns the destination as a string (IP address in dotted-decimal for an ICMP destination, IP address and port separated by a ':' for a TCP destination). More... | |
Protected Member Functions | |
| void | GetPacket (std::string &packet, const Ipv4Address &myAddress, uint16_t identifier) const |
| void | GetIcmpPacket (std::string &packet, const Ipv4Address &myAddress, uint16_t identifier) const |
| void | GetTcpPacket (std::string &packet, const Ipv4Address &myAddress, uint16_t identifier) const |
Protected Attributes | |
| Ipv4Address | _addr |
| uint16_t | _port |
| std::string | _hostname |
| bool | _primed |
| uint16_t | _sequenceNumber |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const PingDestination &pd) |
| Prints a PingDestination to an ostream in human-readable form. | |
Common interface for an IPv4 destination we wish to ping with ICMP or TCP.
| Dwm::PingDestination::PingDestination | ( | const std::string & | destination | ) |
Construct from a string of the form 'a.b.c.d:n' where a.b.c.d is the IP address and n is the port number.
If only an IP address is given, we will use ICMP to probe the destination. If a non-zero port number is given, we will use TCP to probe the destination.
| Dwm::PingDestination::PingDestination | ( | const Ipv4Address & | addr, |
| uint16_t | port = 0 |
||
| ) |
Construct from an IP address (for an ICMP destination), or an IP address and port number (for a TCP destination).
|
virtual |
Returns the destination as a string (IP address in dotted-decimal for an ICMP destination, IP address and port separated by a ':' for a TCP destination).
| bool Dwm::PingDestination::SendTo | ( | Socket & | socket, |
| const Ipv4Address & | myAddress, | ||
| uint16_t | identifier | ||
| ) | const |
Sends a 'ping' to the destination.
For ICMP, sends an echo request. For TCP, sends a pure ACK.