PcapPlusPlus
|
#include <IpAddress.h>
Public Types | |
enum | AddressType { IPv4AddressType, IPv6AddressType } |
Public Member Functions | |
virtual AddressType | getType () const =0 |
std::string | toString () const |
bool | isValid () const |
virtual IPAddress * | clone () const =0 |
bool | equals (const IPAddress *other) |
Static Public Member Functions | |
static Ptr_t | fromString (char *addressAsString) |
static Ptr_t | fromString (std::string addressAsString) |
Base class for IPv4Address and IPv6Address. It's an abstract class and cannot be used as is. The only useful method in this class are the 2 static methods that constructs an IP address class from string
|
pure virtual |
Clone the object
Implemented in pcpp::IPv6Address, and pcpp::IPv4Address.
bool pcpp::IPAddress::equals | ( | const IPAddress * | other | ) |
Compare between this IP address and another IP address. This method is different than operator==() implemented in IPv4Address and IPv6Address in the sense that you can compare any IP type: IPv6 to IPv6, IPv4 to IPv4 or IPv4 to IPv6. It fits cases when you're not sure which type you currently have
|
static |
Constructs an IP address of type IPv4 or IPv6 from a string (char*) representation
[in] | addressAsString | The address in string (char*) representation |
|
static |
Constructs an IP address of type IPv4 or IPv6 from a std::string representation
[in] | addressAsString | The address in std::string representation |
|
pure virtual |
Gets the address type: IPv4 or IPv6
Implemented in pcpp::IPv6Address, and pcpp::IPv4Address.
|
inline |
Get an indication if the address is valid. An address can be invalid if it was constructed from illegal input, for example: An IPv4 address that was constructed form the string "999.999.999.999"
|
inline |
Returns a std::string representation of the address