PcapPlusPlus
|
#include <IpAddress.h>
Public Member Functions | |
IPv4Address (uint32_t addressAsInt) | |
IPv4Address (char *addressAsString) | |
IPv4Address (std::string addressAsString) | |
IPv4Address (in_addr *inAddr) | |
IPv4Address (const IPv4Address &other) | |
AddressType | getType () const |
IPAddress * | clone () const |
uint32_t | toInt () const |
in_addr * | toInAddr () |
bool | operator== (const IPv4Address &other) const |
bool | operator!= (const IPv4Address &other) const |
IPv4Address & | operator= (const IPv4Address &other) |
bool | matchSubnet (const IPv4Address &subnet, const std::string &subnetMask) |
Public Member Functions inherited from pcpp::IPAddress | |
std::string | toString () const |
bool | isValid () |
bool | equals (const IPAddress *other) |
Static Public Attributes | |
static IPv4Address | Zero |
Additional Inherited Members | |
Public Types inherited from pcpp::IPAddress | |
enum | AddressType { IPv4AddressType, IPv6AddressType } |
Static Public Member Functions inherited from pcpp::IPAddress | |
static Ptr_t | fromString (char *addressAsString) |
static Ptr_t | fromString (std::string addressAsString) |
Represents an IPv4 address (of type XXX.XXX.XXX.XXX). An instance of this class can be constructed from string, 4-byte integer or from the in_addr struct. It can be converted to each of these types
pcpp::IPv4Address::IPv4Address | ( | uint32_t | addressAsInt | ) |
A constructor that creates an instance of the class out of 4-byte integer value
[in] | addressAsInt | The address as 4-byte integer |
pcpp::IPv4Address::IPv4Address | ( | char * | addressAsString | ) |
A constructor that creates an instance of the class out of string (char*) value If the string doesn't represent a valid IPv4 address, instance will be invalid, meaning isValid() will return false
[in] | addressAsString | The string (char*) representation of the address |
pcpp::IPv4Address::IPv4Address | ( | std::string | addressAsString | ) |
A constructor that creates an instance of the class out of std::string value If the string doesn't represent a valid IPv4 address, instance will be invalid, meaning isValid() will return false
[in] | addressAsString | The std::string representation of the address |
pcpp::IPv4Address::IPv4Address | ( | in_addr * | inAddr | ) |
A constructor that creates an instance of the class out of in_addr struct pointer
[in] | inAddr | The in_addr struct representation of the address |
pcpp::IPv4Address::IPv4Address | ( | const IPv4Address & | other | ) |
A copy constructor for this class
|
virtual |
Clone the object
Implements pcpp::IPAddress.
|
inlinevirtual |
Implements pcpp::IPAddress.
bool pcpp::IPv4Address::matchSubnet | ( | const IPv4Address & | subnet, |
const std::string & | subnetMask | ||
) |
Checks whether the address matches a subnet. For example: if subnet is 10.1.1.X, subnet mask is 255.255.255.0 and address is 10.1.1.9 then the method will return true Another example: if subnet is 10.1.X.X, subnet mask is 255.0.0.0 and address is 11.1.1.9 then the method will return false
[in] | subnet | The subnet to be verified. Notice it's an IPv4Address type, so subnets with don't-cares (like 10.0.0.X) must have some number (it'll be ignored if subnet mask is correct) |
[in] | subnetMask | A string representing the subnet mask to compare the address with the subnet |
|
inline |
Overload of the non-equal operator
IPv4Address& pcpp::IPv4Address::operator= | ( | const IPv4Address & | other | ) |
Overload of the assignment operator
|
inline |
Overload of the comparison operator
|
inline |
Returns a in_addr struct pointer representing the IPv4 address
uint32_t pcpp::IPv4Address::toInt | ( | ) | const |
Converts the IPv4 address into a 4B integer
|
static |
A static value representing a zero value of IPv4 address, meaning address of value "0.0.0.0"