22 #include <user_config.h> 26 #if LWIP_VERSION_MAJOR == 2 27 #define LWIP_IP_ADDR_T const ip_addr_t 30 #define LWIP_IP_ADDR_T ip_addr_t 42 void fromString(
const String& address);
50 IpAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet)
52 IP4_ADDR(&address, first_octet, second_octet, third_octet, fourth_octet);
57 this->address.addr = address;
62 this->address.addr = address.addr;
65 #if LWIP_VERSION_MAJOR == 2 68 this->address = address;
74 IP4_ADDR(&this->address, address[0], address[1], address[2], address[3]);
84 operator uint32_t()
const 89 operator ip_addr()
const 91 return {address.addr};
96 return reinterpret_cast<ip_addr*
>(&address);
99 #if LWIP_VERSION_MAJOR == 2 108 return ip_addr_cmp(&address, &addr.address);
118 return !ip_addr_cmp(&address, &addr.address);
128 return ip_addr_isany(&address);
135 return ip_addr_netcmp(&address, &addr.address, &mask.address);
141 if(
unsigned(index) >=
sizeof(address)) {
144 return reinterpret_cast<const uint8_t*
>(&address)[index];
149 if(
unsigned(index) >=
sizeof(address)) {
152 return reinterpret_cast<uint8_t*
>(&address)[index];
158 IP4_ADDR(&this->address, address[0], address[1], address[2], address[3]);
164 this->address.addr = address;
181 #define INADDR_NONE IpAddress() A class to make it easier to handle and pass around IP addresses.
Definition: IpAddress.h:37
bool operator!=(const IpAddress &addr) const
Definition: IpAddress.h:116
IpAddress()
Definition: IpAddress.h:46
uint8_t & operator[](int index)
Definition: IpAddress.h:147
uint8_t operator[](int index) const
Definition: IpAddress.h:139
The String class.
Definition: WString.h:136
Provides formatted output to stream.
Definition: Print.h:36
bool operator==(const IpAddress &addr) const
Definition: IpAddress.h:106
bool operator!=(const uint8_t *addr) const
Definition: IpAddress.h:121
IpAddress(const uint8_t *address)
Definition: IpAddress.h:72
IpAddress(const String &address)
Definition: IpAddress.h:77
bool operator==(const uint8_t *addr) const
Definition: IpAddress.h:111
IpAddress(ip_addr address)
Definition: IpAddress.h:60
bool isNull() const
Definition: IpAddress.h:126
IpAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet)
Definition: IpAddress.h:50
#define SMING_DEPRECATED
Definition: sming_attr.h:30
IpAddress & operator=(const uint8_t *address)
Definition: IpAddress.h:156
bool compare(const IpAddress &addr, const IpAddress &mask) const
Definition: IpAddress.h:133
IpAddress & operator=(uint32_t address)
Definition: IpAddress.h:162
Definition: Printable.h:42
IpAddress(uint32_t address)
Definition: IpAddress.h:55
IpAddress & operator=(const String address)
Definition: IpAddress.h:168
size_t printTo(Print &p) const override
struct ip_addr ip_addr_t
Definition: IpAddress.h:29