]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Add Lua bindings and documentation for the Lua FFI policies
authorRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 23 Jan 2020 13:20:33 +0000 (14:20 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 11 Feb 2020 10:49:58 +0000 (11:49 +0100)
pdns/dnsdist-lua-bindings.cc
pdns/dnsdistdist/docs/guides/serverselection.rst

index 60717e174dfa891dfa3f14c6b378ae18e9efd732..f86f79140d94e5cac5b86057238bb13e2c179442 100644 (file)
@@ -60,7 +60,9 @@ void setupLuaBindings(bool client)
   g_lua.writeFunction("newServerPolicy", [](string name, ServerPolicy::policyfunc_t policy) { return std::make_shared<ServerPolicy>(name, policy, true);});
   g_lua.registerMember("name", &ServerPolicy::name);
   g_lua.registerMember("policy", &ServerPolicy::policy);
+  g_lua.registerMember("ffipolicy", &ServerPolicy::ffipolicy);
   g_lua.registerMember("isLua", &ServerPolicy::isLua);
+  g_lua.registerMember("isFFI", &ServerPolicy::isFFI);
   g_lua.registerFunction("toString", &ServerPolicy::toString);
 
   g_lua.writeVariable("firstAvailable", ServerPolicy{"firstAvailable", firstAvailable, false});
index 53286c346e09f3452218889f39c7ff65ee5cb492..16f2084decdb1e05a35cb13b531beac671bc6468 100644 (file)
@@ -114,6 +114,35 @@ ServerPolicy Objects
   :param servers: A list of :class:`Server` objects
   :param DNSQuestion dq: The incoming query
 
+  .. attribute:: ServerPolicy.ffipolicy
+
+    .. versionadded: 1.5.0
+
+    For policies implemented using the Lua FFI interface, the policy function itself.
+
+  .. attribute:: ServerPolicy.isFFI
+
+    .. versionadded: 1.5.0
+
+    Whether a Lua-based policy is implemented using the FFI interface.
+
+  .. attribute:: ServerPolicy.isLua
+
+    Whether this policy is a native (C++) policy or a Lua-based one.
+
+  .. attribute:: ServerPolicy.name
+
+    The name of the policy.
+
+  .. attribute:: ServerPolicy.policy
+
+    The policy function itself, except for FFI policies.
+
+  .. method:: Server:toString()
+
+    Return a textual representation of the policy.
+
+
 Functions
 ---------