From 9d4da043a0f92ed7e04fb19f964a63ca58a3f590 Mon Sep 17 00:00:00 2001 From: Aki Tuomi Date: Wed, 13 Jul 2016 12:52:41 +0300 Subject: [PATCH] Add more Netmask methods for recursor Lua Closes #4167 --- pdns/lua-recursor4.cc | 6 ++++++ 1 file changed, 6 insertions(+) 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) -- 2.47.2