root/trunk/pdns/pdns/lua-pdns-recursor.hh @ 1509

Revision 1509, 1.0 KB (checked in by ahu, 3 years ago)

WARNING WARNING! This changes the Lua/PowerDNS interface in SVN, and restores the 3.1.7.* API!
From now, use getlocaladdress() call to get the address to which a query was sent. Implemented after advice from the ever helpful #lua!

Line 
1#ifndef PDNS_LUA_PDNS_RECURSOR_HH
2#define PDNS_LUA_PDNS_RECURSOR_HH
3#include "dns.hh"
4#include "iputils.hh"
5
6struct lua_State;
7
8class PowerDNSLua
9{
10public:
11  explicit PowerDNSLua(const std::string& fname);
12  ~PowerDNSLua();
13  void reload();
14  bool preresolve(const ComboAddress& remote,const ComboAddress& local, const string& query, const QType& qtype, vector<DNSResourceRecord>& res, int& ret);
15  bool nxdomain(const ComboAddress& remote, const ComboAddress& local, const string& query, const QType& qtype, vector<DNSResourceRecord>& res, int& ret);
16 
17  ComboAddress getLocal()
18  {
19    return d_local;
20  }
21private:
22  lua_State* d_lua;
23  bool passthrough(const string& func, const ComboAddress& remote,const ComboAddress& local, const string& query, const QType& qtype, vector<DNSResourceRecord>& ret, int& res);
24  bool getFromTable(const std::string& key, std::string& value);
25  bool getFromTable(const std::string& key, uint32_t& value);
26  bool d_failed;
27 
28  ComboAddress d_local;
29};
30
31#endif
Note: See TracBrowser for help on using the browser.