diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 15:26:00 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 15:26:00 +0000 |
commit | 830407e88f9d40d954356c3754f2647f91d5c06a (patch) | |
tree | d6a0ece6feea91f3c656166dbaa884ef8a29740e /daemon/ffimodule.h | |
parent | Initial commit. (diff) | |
download | knot-resolver-830407e88f9d40d954356c3754f2647f91d5c06a.tar.xz knot-resolver-830407e88f9d40d954356c3754f2647f91d5c06a.zip |
Adding upstream version 5.6.0.upstream/5.6.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'daemon/ffimodule.h')
-rw-r--r-- | daemon/ffimodule.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/daemon/ffimodule.h b/daemon/ffimodule.h new file mode 100644 index 0000000..beb1bf1 --- /dev/null +++ b/daemon/ffimodule.h @@ -0,0 +1,36 @@ +/* Copyright (C) CZ.NIC, z.s.p.o. <knot-resolver@labs.nic.cz> + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#pragma once + +#include "lib/defines.h" +#include "lib/layer.h" +#include <lua.h> +struct engine; +struct kr_module; + +/** + * Register Lua module as a FFI module. + * This fabricates a standard module interface, + * that trampolines to the Lua module methods. + * + * @note Lua module is loaded in it's own coroutine, + * so it's possible to yield and resume at arbitrary + * places except deinit() + * + * @param engine daemon engine + * @param module prepared module + * @param name module name + * @return 0 or an error + */ +int ffimodule_register_lua(struct engine *engine, struct kr_module *module, const char *name); + +int ffimodule_init(lua_State *L); +void ffimodule_deinit(lua_State *L); + +/** Static storage for faster passing of layer function parameters to lua callbacks. + * + * We don't need to declare it in a header, but let's give it visibility. */ +KR_EXPORT extern kr_layer_t kr_layer_t_static; + |