|
PcapPlusPlus
20.08
|
Go to the documentation of this file. 1 #ifndef PCAPPP_IP_ADDRESSES
2 #define PCAPPP_IP_ADDRESSES
38 IPv4Address(uint32_t addrAsInt) { memcpy(m_Bytes, &addrAsInt,
sizeof(m_Bytes)); }
44 IPv4Address(
const uint8_t bytes[4]) { memcpy(m_Bytes, bytes,
sizeof(m_Bytes)); }
57 inline uint32_t
toInt()
const;
62 const uint8_t*
toBytes()
const {
return m_Bytes; }
128 memcpy(&addr, m_Bytes,
sizeof(m_Bytes));
152 IPv6Address(
const uint8_t bytes[16]) { memcpy(m_Bytes, bytes,
sizeof(m_Bytes)); }
164 const uint8_t*
toBytes()
const {
return m_Bytes; }
198 void copyTo(uint8_t** arr,
size_t& length)
const;
205 void copyTo(uint8_t* arr)
const { memcpy(arr, m_Bytes,
sizeof(m_Bytes)); }
276 IPAddress(
const std::string& addrAsString);
356 return rhs.
isIPv4() ? (m_IPv4 == rhs.m_IPv4) :
false;
358 return rhs.
isIPv6() ? m_IPv6 == rhs.m_IPv6 :
false;
367 return rhs.
isIPv4() ? (m_IPv4 < rhs.m_IPv4) :
true;
369 return rhs.
isIPv6() ? m_IPv6 < rhs.m_IPv6 :
false;
void copyTo(uint8_t *arr) const
Definition: IpAddress.h:205
@ IPv4AddressType
Definition: IpAddress.h:247
Definition: IpAddress.h:26
Definition: IpAddress.h:140
IPAddress(const IPv4Address &addr)
Definition: IpAddress.h:263
@ IPv6AddressType
Definition: IpAddress.h:251
void copyTo(uint8_t **arr, size_t &length) const
std::string toString() const
bool operator!=(const IPv4Address &rhs) const
Definition: IpAddress.h:89
bool operator==(const IPv6Address &rhs) const
Definition: IpAddress.h:180
**
Definition: IpAddress.h:236
IPv6Address(const uint8_t bytes[16])
Definition: IpAddress.h:152
bool matchSubnet(const IPv4Address &subnet, const std::string &subnetMask) const
bool operator<(const IPv4Address &rhs) const
Definition: IpAddress.h:84
IPv4Address()
Definition: IpAddress.h:32
bool operator!=(const IPv6Address &rhs) const
Definition: IpAddress.h:190
bool isValid() const
Definition: IpAddress.h:175
bool operator!=(const IPAddress &rhs) const
Definition: IpAddress.h:342
bool isIPv4() const
Definition: IpAddress.h:310
bool operator<(const IPAddress &rhs) const
Definition: IpAddress.h:361
bool isIPv6() const
Definition: IpAddress.h:315
IPAddress()
Definition: IpAddress.h:257
bool operator==(const IPAddress &rhs) const
Definition: IpAddress.h:353
std::string toString() const
Definition: IpAddress.h:300
uint32_t toInt() const
Definition: IpAddress.h:125
const uint8_t * toBytes() const
Definition: IpAddress.h:164
bool isValid() const
Definition: IpAddress.h:305
bool isValid() const
Definition: IpAddress.h:74
static const IPv4Address Zero
Definition: IpAddress.h:116
The main namespace for the PcapPlusPlus lib.
IPv4Address(const uint8_t bytes[4])
Definition: IpAddress.h:44
const IPv6Address & getIPv6() const
Definition: IpAddress.h:327
IPAddress & operator=(const IPv4Address &addr)
Definition: IpAddress.h:372
bool operator<(const IPv6Address &rhs) const
Definition: IpAddress.h:185
bool matchSubnet(const IPv6Address &subnet, uint8_t prefixLength) const
static const IPv6Address Zero
Definition: IpAddress.h:221
const IPv4Address & getIPv4() const
Definition: IpAddress.h:321
AddressType
Definition: IpAddress.h:242
bool operator==(const IPv4Address &rhs) const
Definition: IpAddress.h:79
const uint8_t * toBytes() const
Definition: IpAddress.h:62
IPv4Address(uint32_t addrAsInt)
Definition: IpAddress.h:38
IPAddress(const IPv6Address &addr)
Definition: IpAddress.h:269
std::string toString() const
AddressType getType() const
Definition: IpAddress.h:294
IPv6Address()
Definition: IpAddress.h:146