]>
Commit | Line | Data |
---|---|---|
5704e107 PD |
1 | #ifndef PDNS_LUA_RECURSOR_HH |
2 | #define PDNS_LUA_RECURSOR_HH | |
827b769a BH |
3 | #include "dns.hh" |
4 | #include "iputils.hh" | |
5704e107 | 5 | #include "lua-pdns.hh" |
827b769a | 6 | |
5704e107 | 7 | class RecursorLua : public PowerDNSLua |
827b769a BH |
8 | { |
9 | public: | |
5704e107 PD |
10 | explicit RecursorLua(const std::string& fname); |
11 | // ~RecursorLua(); | |
99c69ed3 BH |
12 | bool preresolve(const ComboAddress& remote,const ComboAddress& local, const string& query, const QType& qtype, vector<DNSResourceRecord>& res, int& ret, bool* variable); |
13 | bool nxdomain(const ComboAddress& remote, const ComboAddress& local, const string& query, const QType& qtype, vector<DNSResourceRecord>& res, int& ret, bool* variable); | |
bd53ea9d PD |
14 | bool nodata(const ComboAddress& remote, const ComboAddress& local, const string& query, const QType& qtype, vector<DNSResourceRecord>& res, int& ret, bool* variable); |
15 | bool postresolve(const ComboAddress& remote, const ComboAddress& local, const string& query, const QType& qtype, vector<DNSResourceRecord>& res, int& ret, bool* variable); | |
4ea94941 | 16 | bool preoutquery(const ComboAddress& ns, const ComboAddress& requestor, const string& query, const QType& qtype, vector<DNSResourceRecord>& res, int& ret); |
17 | bool ipfilter(const ComboAddress& remote, const ComboAddress& local); | |
827b769a | 18 | private: |
99c69ed3 | 19 | bool passthrough(const string& func, const ComboAddress& remote,const ComboAddress& local, const string& query, const QType& qtype, vector<DNSResourceRecord>& ret, int& res, bool* variable); |
4ea94941 | 20 | |
21 | struct NoFuncs | |
22 | { | |
23 | NoFuncs() : preresolve(0), nxdomain(0), nodata(0), postresolve(0), preoutquery(0), ipfilter() | |
24 | {} | |
25 | ||
26 | void regist(const std::string& func) | |
27 | { | |
28 | if(func=="preresolve") preresolve=1; | |
29 | else if(func=="nxdomain") nxdomain=1; | |
30 | else if(func=="nodata") nodata=1; | |
31 | else if(func=="postresolve") postresolve=1; | |
32 | else if(func=="preoutquery") preoutquery=1; | |
33 | else if(func=="ipfilter") ipfilter=1; | |
34 | else throw std::runtime_error("Attempting to blacklist unknown Lua function"); | |
35 | ||
36 | } | |
37 | ||
38 | void reset() | |
39 | { | |
40 | *this = NoFuncs(); | |
41 | } | |
42 | bool preresolve, nxdomain, nodata, postresolve, preoutquery, ipfilter; | |
43 | } d_nofuncs; | |
44 | ||
827b769a BH |
45 | }; |
46 | ||
47 | #endif |