]> git.ipfire.org Git - thirdparty/pdns.git/blob - pdns/lua-auth4.hh
Merge pull request #6106 from pieterlexis/issue-6105-dnsdist-opcode-docs
[thirdparty/pdns.git] / pdns / lua-auth4.hh
1 #pragma once
2 #include "iputils.hh"
3 #include "dnsname.hh"
4 #include "dnspacket.hh"
5 #include "dnsparser.hh"
6 #include <unordered_map>
7 #ifdef HAVE_CONFIG_H
8 #include "config.h"
9 #endif
10 #include "lua-base4.hh"
11
12 class AuthLua4 : public BaseLua4
13 {
14 public:
15 AuthLua4();
16 bool updatePolicy(const DNSName &qname, QType qtype, const DNSName &zonename, DNSPacket *packet);
17 bool axfrfilter(const ComboAddress&, const DNSName&, const DNSResourceRecord&, std::vector<DNSResourceRecord>&);
18 DNSPacket *prequery(DNSPacket *p);
19
20 ~AuthLua4(); // this is so unique_ptr works with an incomplete type
21 protected:
22 virtual void postPrepareContext() override;
23 virtual void postLoad() override;
24 private:
25 struct UpdatePolicyQuery {
26 DNSName qname;
27 DNSName zonename;
28 uint16_t qtype;
29 ComboAddress local, remote;
30 Netmask realRemote;
31 DNSName tsigName;
32 std::string peerPrincipal;
33 };
34
35 typedef std::function<bool(const UpdatePolicyQuery&)> luacall_update_policy_t;
36 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;
37 typedef std::function<bool(DNSPacket*)> luacall_prequery_t;
38
39 luacall_update_policy_t d_update_policy;
40 luacall_axfr_filter_t d_axfr_filter;
41 luacall_prequery_t d_prequery;
42 };