]>
Commit | Line | Data |
---|---|---|
0ecc1158 AT |
1 | #pragma once |
2 | #include "iputils.hh" | |
3 | #include "dnsname.hh" | |
4 | #include "namespaces.hh" | |
5 | #include "dnsrecords.hh" | |
6 | #include "dnspacket.hh" | |
7 | #include <unordered_map> | |
66470601 | 8 | #include <boost/variant/variant.hpp> |
0ecc1158 AT |
9 | #ifdef HAVE_CONFIG_H |
10 | #include "config.h" | |
11 | #endif | |
12 | ||
13 | class LuaContext; | |
14 | ||
15 | class AuthLua4 : public boost::noncopyable | |
16 | { | |
17 | private: | |
18 | #ifdef HAVE_LUA | |
19 | std::unique_ptr<LuaContext> d_lw; // this is way on top because it must get destroyed _last_ | |
20 | #endif | |
21 | ||
22 | public: | |
23 | explicit AuthLua4(const std::string& fname); | |
24 | bool updatePolicy(const DNSName &qname, QType qtype, const DNSName &zonename, DNSPacket *packet); | |
66470601 | 25 | bool axfrfilter(const ComboAddress&, const DNSName&, const DNSResourceRecord&, std::vector<DNSResourceRecord>&); |
0ecc1158 AT |
26 | |
27 | ~AuthLua4(); // this is so unique_ptr works with an incomplete type | |
28 | private: | |
29 | struct UpdatePolicyQuery { | |
30 | DNSName qname; | |
31 | DNSName zonename; | |
32 | uint16_t qtype; | |
33 | ComboAddress local, remote; | |
34 | Netmask realRemote; | |
35 | DNSName tsigName; | |
36 | std::string peerPrincipal; | |
37 | }; | |
38 | ||
39 | typedef std::function<bool(const UpdatePolicyQuery&)> luacall_update_policy_t; | |
66470601 | 40 | 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; |
0ecc1158 AT |
41 | |
42 | luacall_update_policy_t d_update_policy; | |
66470601 | 43 | luacall_axfr_filter_t d_axfr_filter; |
0ecc1158 | 44 | }; |
5dbd408c | 45 | std::vector<shared_ptr<DNSRecordContent>> luaSynth(const std::string& code, const DNSName& qname, const ComboAddress& who, uint16_t qtype); |