1 #ifndef PCAPPP_IPADDRESS 2 #define PCAPPP_IPADDRESS 8 #define MAX_ADDR_STRING_LEN 40 //xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx 31 char m_AddressAsString[MAX_ADDR_STRING_LEN];
36 #if __cplusplus > 199711L 37 typedef std::unique_ptr<IPAddress> Ptr_t;
39 typedef std::auto_ptr<IPAddress> Ptr_t;
68 std::string
toString()
const {
return std::string(m_AddressAsString); }
75 bool isValid()
const {
return m_IsValid; }
97 static Ptr_t
fromString(
char* addressAsString);
105 static Ptr_t
fromString(std::string addressAsString);
117 void init(
char* addressAsString);
164 uint32_t
toInt()
const;
216 void init(
char* addressAsString);
264 void copyTo(uint8_t** arr,
size_t& length);
271 void copyTo(uint8_t* arr)
const;
AddressType getType() const
Definition: IpAddress.h:249
bool operator!=(const IPv6Address &other)
IPv6Address(uint8_t *addressAsUintArr)
Definition: IpAddress.h:49
bool operator!=(const IPv4Address &other) const
Definition: IpAddress.h:182
static Ptr_t fromString(char *addressAsString)
Definition: IpAddress.h:113
bool matchSubnet(const IPv4Address &subnet, const std::string &subnetMask)
virtual IPAddress * clone() const =0
IPv4Address & operator=(const IPv4Address &other)
bool isValid() const
Definition: IpAddress.h:75
static IPv6Address Zero
Definition: IpAddress.h:294
bool operator==(const IPv4Address &other) const
Definition: IpAddress.h:176
Definition: IpAddress.h:27
IPAddress * clone() const
in_addr * toInAddr()
Definition: IpAddress.h:170
Definition: IpAddress.h:212
Definition: IpAddress.h:53
static IPv4Address Zero
Definition: IpAddress.h:203
bool operator==(const IPv6Address &other) const
AddressType getType() const
Definition: IpAddress.h:156
IPv6Address & operator=(const IPv6Address &other)
virtual AddressType getType() const =0
IPAddress * clone() const
AddressType
Definition: IpAddress.h:45
std::string toString() const
Definition: IpAddress.h:68
The main namespace for the PcapPlusPlus lib.
in6_addr * toIn6Addr()
Definition: IpAddress.h:257
IPv4Address(uint32_t addressAsInt)
bool equals(const IPAddress *other)
void copyTo(uint8_t **arr, size_t &length)