22 #include <lwip/init.h>
23 #include <lwip/ip_addr.h>
27 #if LWIP_VERSION_MAJOR == 2
28 #define LWIP_IP_ADDR_T const ip_addr_t
32 #define IP_ADDR4(IP, A, B, C, D) IP4_ADDR(IP, A, B, C, D)
33 #define ip_addr_set_ip4_u32(IP, U32) ip4_addr_set_u32(IP, U32)
34 #define ip_addr_get_ip4_u32(IP) ip4_addr_get_u32(IP)
35 #define ip_2_ip4(IP) (IP)
36 #define ip4_addr_netcmp(A, B, C) ip_addr_netcmp(A, B, C)
37 #define LWIP_IP_ADDR_T ip_addr_t
49 void fromString(
const String& address);
55 IpAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet)
57 IP_ADDR4(&address, first_octet, second_octet, third_octet, fourth_octet);
73 #if LWIP_VERSION_MAJOR == 2 && LWIP_IPV6
76 ip_addr_copy_from_ip4(address, addr);
85 IP_ADDR4(&this->address, address[0], address[1], address[2], address[3]);
93 operator uint32_t()
const
108 #if LWIP_VERSION_MAJOR == 2 && LWIP_IPV6
122 return ip_addr_cmp(&address, &otherAddress.address);
132 return !ip_addr_cmp(&address, &otherAddress.address);
142 return ip_addr_isany(&address);
149 return ip_addr_netcmp(&address, &addr.address,
ip_2_ip4(&mask.address));
159 return reinterpret_cast<const uint8_t*
>(&
ip_2_ip4(&address)->addr)[index];
168 return reinterpret_cast<uint8_t*
>(&
ip_2_ip4(&address)->addr)[index];
174 IP_ADDR4(&this->address, address[0], address[1], address[2], address[3]);
199 #define INADDR_NONE IpAddress()
ip_addr_t ip4_addr_t
Definition: IpAddress.h:31
#define ip_addr_get_ip4_u32(IP)
Definition: IpAddress.h:34
struct ip_addr ip_addr_t
Definition: IpAddress.h:30
#define ip_addr_set_ip4_u32(IP, U32)
Definition: IpAddress.h:33
String toString(IpAddress address)
Definition: IpAddress.h:193
#define IP_ADDR4(IP, A, B, C, D)
Definition: IpAddress.h:32
#define ip_2_ip4(IP)
Definition: IpAddress.h:35
bool fromString(const char *s, Uuid &uuid)
Definition: Uuid.h:147
A class to make it easier to handle and pass around IP addresses.
Definition: IpAddress.h:45
bool isNull() const
Definition: IpAddress.h:140
bool operator!=(const uint8_t addr[4]) const
Definition: IpAddress.h:135
uint8_t operator[](int index) const
Definition: IpAddress.h:153
IpAddress & operator=(uint32_t address)
Definition: IpAddress.h:178
bool operator==(const uint8_t addr[4]) const
Definition: IpAddress.h:125
IpAddress & operator=(const uint8_t address[4])
Definition: IpAddress.h:172
uint8_t & operator[](int index)
Definition: IpAddress.h:162
IpAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet)
Definition: IpAddress.h:55
bool compare(const IpAddress &addr, const IpAddress &mask) const
Definition: IpAddress.h:147
IpAddress(uint32_t address)
Definition: IpAddress.h:60
IpAddress(ip_addr_t &addr)
Definition: IpAddress.h:65
IpAddress(const ip_addr_t &addr)
Definition: IpAddress.h:69
IpAddress(const uint8_t address[4])
Definition: IpAddress.h:83
IpAddress & operator=(const String &address)
Definition: IpAddress.h:184
bool operator!=(const IpAddress &otherAddress) const
Definition: IpAddress.h:130
size_t printTo(Print &p) const
bool operator==(const IpAddress &otherAddress) const
Definition: IpAddress.h:120
IpAddress(const String &address)
Definition: IpAddress.h:88
Provides formatted output to stream.
Definition: Print.h:37
The String class.
Definition: WString.h:133