From: Aki Tuomi Date: Fri, 26 Jan 2018 12:51:34 +0000 (+0200) Subject: lua-base4: Add QType methods X-Git-Tag: dnsdist-1.3.0~59^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=49f44df3aa54428a105a488f2e89ebf8313c4f10;p=thirdparty%2Fpdns.git lua-base4: Add QType methods --- diff --git a/pdns/lua-base4.cc b/pdns/lua-base4.cc index e571304fdd..6e0e1e5568 100644 --- a/pdns/lua-base4.cc +++ b/pdns/lua-base4.cc @@ -144,6 +144,13 @@ void BaseLua4::prepareContext() { d_lw->registerFunction("check",[](const cas_t& cas, const ComboAddress&ca) { return cas.count(ca)>0; }); d_lw->registerFunction("equal", [](const ComboAddress& lhs, const ComboAddress& rhs) { return ComboAddress::addressOnlyEqual()(lhs, rhs); }); + // QType + d_lw->writeFunction("newQType", [](const string& s) { QType q; q = s; return q; }); + d_lw->registerFunction("getCode", &QType::getCode); + d_lw->registerFunction("getName", &QType::getName); + d_lw->registerEqFunction([](const QType& a, const QType& b){ return a == b;}); // operator overloading confuses LuaContext + d_lw->registerToStringFunction(&QType::getName); + // Netmask d_lw->writeFunction("newNetmask", [](const string& s) { return Netmask(s); }); d_lw->registerFunction("getNetwork", [](const Netmask& nm) { return nm.getNetwork(); } ); // const reference makes this necessary