mirror of
https://github.com/esp8266/Arduino.git
synced 2025-08-01 03:47:23 +03:00
IPAddress updates (#5409)
* restore definition of ip_addr (=ipv4_addr) when IPv6 is not enabled * overload IPAddress:operator == and != to avoid ambiguousness * brings lwIP's INADDR_NONE (which is IPv4 255.255.255.255, suposed to be invalid address but it is) * inet_aton is a lwIP define, rename Ethernet DNS implementation of this to prevent name collision that's because IPAddress now includes lwip/inet.h
This commit is contained in:
@ -38,9 +38,12 @@
|
||||
#define IP4_ADDR_ANY4 IPADDR_ANY
|
||||
#define IPADDR4_INIT(x) { x }
|
||||
#define CONST /* nothing: lwIP-v1 does not use const */
|
||||
#else
|
||||
#else // lwIP-v2+
|
||||
#define CONST const
|
||||
#endif
|
||||
#if !LWIP_IPV6
|
||||
#define ip_addr ipv4_addr
|
||||
#endif // !LWIP_IPV6
|
||||
#endif // lwIP-v2+
|
||||
|
||||
// A class to make it easier to handle and pass around IP addresses
|
||||
// IPv6 update:
|
||||
@ -96,9 +99,15 @@ class IPAddress: public Printable {
|
||||
bool operator==(uint32_t addr) const {
|
||||
return isV4() && v4() == addr;
|
||||
}
|
||||
bool operator==(u32_t addr) const {
|
||||
return isV4() && v4() == addr;
|
||||
}
|
||||
bool operator!=(uint32_t addr) const {
|
||||
return !(isV4() && v4() == addr);
|
||||
}
|
||||
bool operator!=(u32_t addr) const {
|
||||
return !(isV4() && v4() == addr);
|
||||
}
|
||||
bool operator==(const uint8_t* addr) const;
|
||||
|
||||
// Overloaded index operator to allow getting and setting individual octets of the address
|
||||
@ -193,6 +202,7 @@ class IPAddress: public Printable {
|
||||
|
||||
extern CONST IPAddress IPNoAddress;
|
||||
|
||||
#include <AddrList.h>
|
||||
#include <lwip/inet.h> // bring definition of INADDR_NONE
|
||||
#include <AddrList.h> // bring interface iterator
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user