From: Aki Tuomi Date: Wed, 13 Jul 2016 09:52:41 +0000 (+0300) Subject: Add more Netmask methods for recursor Lua X-Git-Tag: auth-4.0.1~19^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F4168%2Fhead;p=thirdparty%2Fpdns.git Add more Netmask methods for recursor Lua Closes #4167 --- diff --git a/pdns/lua-recursor4.cc b/pdns/lua-recursor4.cc index f3b9ace731..93a4d29c17 100644 --- a/pdns/lua-recursor4.cc +++ b/pdns/lua-recursor4.cc @@ -280,8 +280,14 @@ RecursorLua4::RecursorLua4(const std::string& fname) d_lw->registerFunction("getNetwork", [](const Netmask& nm) { return nm.getNetwork(); } ); // const reference makes this necessary + d_lw->registerFunction("getMaskedNetwork", [](const Netmask& nm) { return nm.getMaskedNetwork(); } ); + d_lw->registerFunction("isIpv4", &Netmask::isIpv4); + d_lw->registerFunction("isIpv6", &Netmask::isIpv6); + d_lw->registerFunction("getBits", &Netmask::getBits); d_lw->registerFunction("toString", &Netmask::toString); d_lw->registerFunction("empty", &Netmask::empty); + d_lw->registerFunction("match", (bool (Netmask::*)(const string&) const)&Netmask::match); + d_lw->registerFunction("__eq", &Netmask::operator==); d_lw->writeFunction("newNMG", []() { return NetmaskGroup(); }); d_lw->registerFunction("addMask", [](NetmaskGroup&nmg, const std::string& mask)