-
Notifications
You must be signed in to change notification settings - Fork 905
/
lua-pdns.hh
40 lines (36 loc) · 1.23 KB
/
lua-pdns.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef PDNS_LUA_PDNS_HH
#define PDNS_LUA_PDNS_HH
#include "dns.hh"
#include "iputils.hh"
struct lua_State;
class PowerDNSLua
{
public:
explicit PowerDNSLua(const std::string& fname);
~PowerDNSLua();
void reload();
ComboAddress getLocal()
{
return d_local;
}
void setVariable()
{
d_variable=true;
}
protected: // FIXME?
lua_State* d_lua;
bool passthrough(const string& func, const ComboAddress& remote,const ComboAddress& local, const string& query, const QType& qtype, vector<DNSResourceRecord>& ret, int& res, bool* variable);
bool getFromTable(const std::string& key, std::string& value);
bool getFromTable(const std::string& key, uint32_t& value);
bool d_failed;
bool d_variable;
ComboAddress d_local;
};
// this enum creates constants to track the pdns_recursor behaviour when returned from the Lua call
namespace RecursorBehaviour { enum returnTypes { PASS=-1, DROP=-2 }; };
void pushResourceRecordsTable(lua_State* lua, const vector<DNSResourceRecord>& records);
void popResourceRecordsTable(lua_State *lua, const string &query, vector<DNSResourceRecord>& ret);
void pushSyslogSecurityLevelTable(lua_State *lua);
int getLuaTableLength(lua_State* lua, int depth);
void luaStackDump (lua_State *L);
#endif