From a460cb793574dd4b055ef4c409ebc57d6394888f Mon Sep 17 00:00:00 2001 From: Ruggero Tomaselli Date: Wed, 9 Sep 2020 12:24:35 +0200 Subject: [PATCH] Add clear method to IPAddress (#7586) --- cores/esp8266/IPAddress.cpp | 4 ++++ cores/esp8266/IPAddress.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/cores/esp8266/IPAddress.cpp b/cores/esp8266/IPAddress.cpp index 5b502d873..c269d0050 100644 --- a/cores/esp8266/IPAddress.cpp +++ b/cores/esp8266/IPAddress.cpp @@ -183,6 +183,10 @@ bool IPAddress::isValid(const char* arg) { const IPAddress INADDR_ANY; // generic "0.0.0.0" for IPv4 & IPv6 const IPAddress INADDR_NONE(255,255,255,255); +void IPAddress::clear() { + (*this) = INADDR_ANY; +} + /**************************************/ #if LWIP_IPV6 diff --git a/cores/esp8266/IPAddress.h b/cores/esp8266/IPAddress.h index d2170017e..33305f424 100644 --- a/cores/esp8266/IPAddress.h +++ b/cores/esp8266/IPAddress.h @@ -125,6 +125,8 @@ class IPAddress: public Printable { virtual size_t printTo(Print& p) const; String toString() const; + void clear(); + /* check if input string(arg) is a valid IPV4 address or not. return true on valid.