#include "rec-snmp.hh"
#include <unordered_set>
-#if !defined(HAVE_LUA)
-RecursorLua4::RecursorLua4(const std::string &fname)
-{
- throw std::runtime_error("Attempt to load a Lua script in a PowerDNS binary without Lua support");
-}
-
-bool RecursorLua4::nxdomain(DNSQuestion& dq, int& res)
-{
- return false;
-}
-
-bool RecursorLua4::nodata(DNSQuestion& dq, int& res)
-{
- return false;
-}
-
-bool RecursorLua4::postresolve(DNSQuestion& dq, int& res)
-{
- return false;
-}
-
-bool RecursorLua4::prerpz(DNSQuestion& dq, int& ret)
-{
- return false;
-}
-
-bool RecursorLua4::preresolve(DNSQuestion& dq, int& res)
-{
- return false;
-}
-
-bool RecursorLua4::preoutquery(const ComboAddress& ns, const ComboAddress& requestor, const DNSName& query, const QType& qtype, bool isTcp, vector<DNSRecord>& res, int& ret)
-{
- return false;
-}
-
-bool RecursorLua4::ipfilter(const ComboAddress& remote, const ComboAddress& local, const struct dnsheader& dh)
-{
- return false;
-}
-
-unsigned int RecursorLua4::gettag(const ComboAddress& remote, const Netmask& ednssubnet, const ComboAddress& local, const DNSName& qname, uint16_t qtype, std::vector<std::string>* policyTags, std::unordered_map<string,string>& data)
-{
- return 0;
-}
-
-
-#else
#undef L
#include "ext/luawrapper/include/LuaContext.hpp"
return handled;
}
-#endif
RecursorLua4::~RecursorLua4(){}
class RecursorLua4 : public boost::noncopyable
{
private:
-#ifdef HAVE_LUA
std::unique_ptr<LuaContext> d_lw; // this is way on top because it must get destroyed _last_
-#endif
public:
explicit RecursorLua4(const std::string& fname);
bool& wantsRPZ;
unsigned int tag{0};
-#ifdef HAVE_LUA
void addAnswer(uint16_t type, const std::string& content, boost::optional<int> ttl, boost::optional<string> name);
void addRecord(uint16_t type, const std::string& content, DNSResourceRecord::Place place, boost::optional<int> ttl, boost::optional<string> name);
vector<pair<int,DNSRecord> > getRecords() const;
std::unordered_map<string,string> data;
DNSName followupName;
-#endif
};
unsigned int gettag(const ComboAddress& remote, const Netmask& ednssubnet, const ComboAddress& local, const DNSName& qname, uint16_t qtype, std::vector<std::string>* policyTags, std::unordered_map<string,string>& data);
#include "config.h"
-#ifdef HAVE_LUA
#include "ext/luawrapper/include/LuaContext.hpp"
-#endif
#include <fstream>
#include <thread>
return iter->second;
}
-#ifndef HAVE_LUA
-void loadRecursorLuaConfig(const std::string& fname, bool checkOnly)
-{
- if(!fname.empty())
- throw PDNSException("Asked to load a Lua configuration file '"+fname+"' in binary without Lua support");
-}
-#else
void loadRecursorLuaConfig(const std::string& fname, bool checkOnly)
{
}
-#endif
AS_IF([test "x$with_luajit" = "xno"], [
PDNS_WITH_LUA
])
+AS_IF([test "x$LUAPC" = "x" -a "x$LUAJITPC" = "x"], [
+ AC_MSG_ERROR([Neither Lua nor LuaJIT found, Lua support is not optional])
+])
PDNS_CHECK_LUA_HPP
PDNS_ENABLE_VERBOSE_LOGGING