4 #include "dnspacket.hh"
5 #include "dnsparser.hh"
6 #include <unordered_map>
10 #include "lua-base4.hh"
12 class AuthLua4 : public BaseLua4
16 bool updatePolicy(const DNSName &qname, const QType& qtype, const DNSName &zonename, const DNSPacket& packet);
17 bool axfrfilter(const ComboAddress&, const DNSName&, const DNSResourceRecord&, std::vector<DNSResourceRecord>&);
20 std::unique_ptr<DNSPacket> prequery(const DNSPacket& p);
22 ~AuthLua4() override; // this is so unique_ptr works with an incomplete type
24 void postPrepareContext() override;
25 void postLoad() override;
28 struct UpdatePolicyQuery {
32 ComboAddress local, remote;
35 std::string peerPrincipal;
38 typedef std::function<bool(const UpdatePolicyQuery&)> luacall_update_policy_t;
39 typedef std::function<std::tuple<int, std::unordered_map<int, std::unordered_map<std::string,boost::variant<unsigned int,std::string> > > >(const ComboAddress&, const DNSName&, const DNSResourceRecord&)> luacall_axfr_filter_t;
40 typedef std::function<bool(DNSPacket*)> luacall_prequery_t;
42 luacall_update_policy_t d_update_policy;
43 luacall_axfr_filter_t d_axfr_filter;
44 luacall_prequery_t d_prequery;
46 std::vector<shared_ptr<DNSRecordContent>> luaSynth(const std::string& code, const DNSName& qname,
47 const DNSName& zone, int zoneid, const DNSPacket& dnsp, uint16_t qtype, unique_ptr<AuthLua4>& LUA);