|
PcapPlusPlus
19.12
|
Go to the documentation of this file. 1 #ifndef PCAPPP_IPADDRESS
2 #define PCAPPP_IPADDRESS
8 #define MAX_ADDR_STRING_LEN 40 //xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx\0
9 #define MAX_IPV4_STRING_LEN 16 //xxx.xxx.xxx.xxx\0
32 char m_AddressAsString[MAX_ADDR_STRING_LEN];
35 IPAddress() : m_IsValid(
false) { m_AddressAsString[0] =
'\0'; }
42 #if __cplusplus > 199711L || _MSC_VER >= 1800 //Maybe this can be 1600 for VS2010
43 typedef std::unique_ptr<IPAddress> Ptr_t;
45 typedef std::auto_ptr<IPAddress> Ptr_t;
74 std::string
toString()
const {
return std::string(m_AddressAsString); }
81 bool isValid()
const {
return m_IsValid; }
103 static Ptr_t
fromString(
char* addressAsString);
111 static Ptr_t
fromString(std::string addressAsString);
123 void init(
const char* addressAsString);
170 uint32_t
toInt()
const;
233 void init(
char* addressAsString);
281 void copyTo(uint8_t** arr,
size_t& length)
const;
288 void copyTo(uint8_t* arr)
const;
Definition: IpAddress.h:55
Definition: IpAddress.h:119
Definition: IpAddress.h:229
bool equals(const IPAddress *other) const
Definition: IpAddress.h:59
void copyTo(uint8_t **arr, size_t &length) const
static IPv4Address Zero
Definition: IpAddress.h:220
Definition: IpAddress.h:28
bool operator!=(const IPv6Address &other) const
bool matchSubnet(const IPv4Address &subnet, const std::string &subnetMask) const
IPv4Address(uint32_t addressAsInt)
bool operator==(const IPv6Address &other) const
IPAddress * clone() const
static IPv6Address Zero
Definition: IpAddress.h:311
std::string toString() const
Definition: IpAddress.h:74
in6_addr * toIn6Addr() const
Definition: IpAddress.h:274
virtual AddressType getType() const =0
AddressType getType() const
Definition: IpAddress.h:266
IPv6Address & operator=(const IPv6Address &other)
bool isValid() const
Definition: IpAddress.h:81
The main namespace for the PcapPlusPlus lib.
bool operator==(const IPv4Address &other) const
Definition: IpAddress.h:182
IPv6Address(uint8_t *addressAsUintArr)
static Ptr_t fromString(char *addressAsString)
AddressType
Definition: IpAddress.h:51
IPAddress * clone() const
in_addr * toInAddr() const
Definition: IpAddress.h:176
AddressType getType() const
Definition: IpAddress.h:162
IPv4Address & operator=(const IPv4Address &other)
bool operator!=(const IPv4Address &other) const
Definition: IpAddress.h:188
virtual IPAddress * clone() const =0