g_lua.registerFunction("tostring", &ComboAddress::toString);
-
+ g_lua.registerFunction("tostringWithPort", &ComboAddress::toStringWithPort);
+ g_lua.registerFunction<uint16_t(ComboAddress::*)()>("getPort", [](const ComboAddress& ca) { return ntohs(ca.sin4.sin_port); } );
g_lua.registerFunction("isPartOf", &DNSName::isPartOf);
g_lua.registerFunction<string(DNSName::*)()>("tostring", [](const DNSName&dn ) { return dn.toString(); });
g_lua.writeFunction("newDNSName", [](const std::string& name) { return DNSName(name); });
d_lw->registerFunction("__eq", &DNSName::operator==);
d_lw->registerFunction<string(ComboAddress::*)()>("toString", [](const ComboAddress& ca) { return ca.toString(); });
+ d_lw->registerFunction<string(ComboAddress::*)()>("toStringWithPort", [](const ComboAddress& ca) { return ca.toStringWithPort(); });
+ d_lw->registerFunction<uint16_t(ComboAddress::*)()>("getPort", [](const ComboAddress& ca) { return ntohs(ca.sin4.sin_port); } );
+
d_lw->writeFunction("newCA", [](const std::string& a) { return ComboAddress(a); });
d_lw->registerFunction<bool(ComboAddress::*)(const ComboAddress&)>("equal", [](const ComboAddress& lhs, const ComboAddress& rhs) {
-- this check is applied before any packet parsing is done
function ipfilter(rem, loc, dh)
- print("ipfilter called, rem: ", rem:toString(), "loc: ",loc:toString(),"match:", badips:match(rem))
+ print("ipfilter called, rem: ", rem:toStringWithPort(), "loc: ",loc:toStringWithPort(),"match:", badips:match(rem))
print("id: ",dh:getID(), "aa: ", dh:getAA(), "ad: ", dh:getAD(), "arcount: ", dh:getARCOUNT())
+ print("ports: ",rem:getPort(),loc:getPort())
return badips:match(rem)
end