32 enum IpType { IPv4 = 0x0800, IPv6 = 0x86DD };
35 IpAddress() : m_Type(IPv4), m_Ipv4(0), m_Ipv6(), m_bSet(false), m_Ipv6Prefix(128) {}
36 IpAddress(IpType type) : m_Type(type), m_Ipv4(0), m_Ipv6(), m_bSet(false), m_Ipv6Prefix(128) {}
38 : m_Type(IPv4), m_Ipv4(ipv4), m_Ipv6(), m_bSet(true), m_Ipv6Prefix(128) {}
39 IpAddress(uint8_t* ipv6) : m_Type(IPv6), m_Ipv4(0), m_Ipv6(), m_bSet(true), m_Ipv6Prefix(128) {
40 MemoryCopy(m_Ipv6, ipv6, 16);
43 if (other.getType() == IPv6) {
47 m_Ipv6Prefix = other.getIpv6Prefix();
58 ByteSet(m_Ipv6, 0, 16);
63 void setIp(uint8_t* ipv6) {
65 MemoryCopy(m_Ipv6, ipv6, 16);
76 inline void getIp(uint8_t* ipv6)
const {
78 MemoryCopy(ipv6, m_Ipv6, 16);
90 if (a.
getType() != m_Type || m_Type == IPv6 || a.
getType() == IPv6)
99 if (a.
getType() != m_Type || m_Type == IPv6 || a.
getType() == IPv6)
121 return (a.
getIp() == getIp());
123 return !MemoryCompare(m_Ipv6, a.m_Ipv6, 16);
127 bool operator!=(
const IpAddress& a)
const {
129 return (a.
getIp() != getIp());
131 return !MemoryCompare(m_Ipv6, a.m_Ipv6, 16);
136 if (getType() == IPv4)
137 return (a == getIp());
142 bool operator!=(uint32_t a)
const {
143 if (getType() != IPv4)
144 return (a != getIp());
152 String prefixString(
size_t override = 256)
const;
155 bool isLinkLocal()
const;
158 bool isMulticast()
const;
162 return !isMulticast();
172 m_Ipv6Prefix = prefix;
bool operator==(const Iterator< originalT, Struct, FunctionPrev, FunctionNext, T1 > &x1, const Iterator< originalT, Struct, FunctionPrev, FunctionNext, T2 > &x2)