summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2017-01-18 04:03:51 +0100
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2017-01-23 20:15:20 +0100
commit4198291cd45da7fce278d21cd5ef4a506086d5f8 (patch)
tree8ac91936c56f9e846d18dbc663a7759d73f510ee /core
parent98a7e2b4e09791705cd9dfd4d13611bc02fe47d4 (diff)
IP_Address can now be a wildcard (not a valid IP, used for binding)
Diffstat (limited to 'core')
-rw-r--r--core/io/ip_address.cpp7
-rw-r--r--core/io/ip_address.h2
2 files changed, 8 insertions, 1 deletions
diff --git a/core/io/ip_address.cpp b/core/io/ip_address.cpp
index 2d9708f5e5..69c7df619d 100644
--- a/core/io/ip_address.cpp
+++ b/core/io/ip_address.cpp
@@ -175,6 +175,7 @@ void IP_Address::clear() {
memset(&field8[0], 0, sizeof(field8));
valid = false;
+ wildcard = false;
};
bool IP_Address::is_ipv4() const{
@@ -208,7 +209,11 @@ IP_Address::IP_Address(const String& p_string) {
clear();
- if (p_string.find(":") >= 0) {
+ if (p_string == "*") {
+ // Wildcard (not a vaild IP)
+ wildcard = true;
+
+ } else if (p_string.find(":") >= 0) {
// IPv6
_parse_ipv6(p_string);
valid = true;
diff --git a/core/io/ip_address.h b/core/io/ip_address.h
index 3e86e0bcba..257836601a 100644
--- a/core/io/ip_address.h
+++ b/core/io/ip_address.h
@@ -42,6 +42,7 @@ private:
};
bool valid;
+ bool wildcard;
protected:
void _parse_ipv6(const String& p_string);
@@ -67,6 +68,7 @@ public:
}
void clear();
+ bool is_wildcard() const {return wildcard;}
bool is_valid() const {return valid;}
bool is_ipv4() const;
const uint8_t *get_ipv4() const;