]> granicus.if.org Git - pdns/commitdiff
rec: Instruct LuaWrapper to stay away from our FFI pdns_ffi_param struct
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 12 Mar 2018 16:20:26 +0000 (17:20 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 14 Mar 2018 10:04:23 +0000 (11:04 +0100)
pdns/lua-recursor4.hh

index 6f630831456f03e28dd4a3e3be3f23881d8ae6c5..e25cd62daedb8696c1bf50f438722cf1a7b2bd7d 100644 (file)
 string GenUDPQueryResponse(const ComboAddress& dest, const string& query);
 unsigned int getRecursorThreadId();
 
+// pdns_ffi_param_t is a lightuserdata
+template<>
+struct LuaContext::Pusher<pdns_ffi_param*> {
+    static const int minSize = 1;
+    static const int maxSize = 1;
+
+    static PushedObject push(lua_State* state, pdns_ffi_param* ptr) noexcept {
+        lua_pushlightuserdata(state, ptr);
+        return PushedObject{state, 1};
+    }
+};
+
 class RecursorLua4 : public BaseLua4
 {
 public: