summaryrefslogtreecommitdiff
path: root/src/net/ip.cpp
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2015-01-08 14:36:40 -0800
committerBen Longbons <b.r.longbons@gmail.com>2015-01-23 01:44:26 -0800
commit35b95e24ea1915acf0ef13047209f76bce6d9b7b (patch)
tree650cc854b324b0b6f3e269075a394914d0834b26 /src/net/ip.cpp
parentfc07b1e9c72e795e18f9d212e7a72bdb31904c5b (diff)
downloadtmwa-35b95e24ea1915acf0ef13047209f76bce6d9b7b.tar.gz
tmwa-35b95e24ea1915acf0ef13047209f76bce6d9b7b.tar.bz2
tmwa-35b95e24ea1915acf0ef13047209f76bce6d9b7b.tar.xz
tmwa-35b95e24ea1915acf0ef13047209f76bce6d9b7b.zip
Use generated config for login
Diffstat (limited to 'src/net/ip.cpp')
-rw-r--r--src/net/ip.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/net/ip.cpp b/src/net/ip.cpp
index 3dc242d..bedbca8 100644
--- a/src/net/ip.cpp
+++ b/src/net/ip.cpp
@@ -105,6 +105,33 @@ bool impl_extract(XString str, IP4Mask *rv)
return true;
}
+bool impl_extract(XString str, std::vector<IP4Mask> *iv)
+{
+ if (str == "all"_s)
+ {
+ iv->clear();
+ iv->push_back(IP4Mask());
+ return true;
+ }
+ if (str == "clear"_s)
+ {
+ iv->clear();
+ return true;
+ }
+ // don't add if already 'all'
+ if (iv->size() == 1 && iv->front().mask() == IP4Address())
+ {
+ return true;
+ }
+ IP4Mask mask;
+ if (extract(str, &mask))
+ {
+ iv->push_back(mask);
+ return true;
+ }
+ return false;
+}
+
VString<15> convert_for_printf(IP4Address a_)
{
const uint8_t *a = a_.bytes();