Library function signatures for lua module.
More...
#include <lua.h>
#include <lauxlib.h>
#include <freeradius-devel/server/base.h>
Go to the source code of this file.
Library function signatures for lua module.
- Id
- d56b20956527e1e8b7c112243107c032db548045
Definition in file rlm_lua.h.
◆ rlm_lua_t
Definition at line 43 of file rlm_lua.h.
| Data Fields |
|
const char * |
func_detach |
Name of function to run on detach. |
|
const char *const char * |
func_instantiate |
< Full path to lua script to load and execute. Name of function to run on instantiation.
|
|
const char * |
func_xlat |
Name of function to be called for string expansions. |
|
fr_rb_tree_t |
funcs |
Tree of function calls found by call_env parser. |
|
bool |
funcs_init |
Has the tree been initialised. |
|
lua_State * |
interpreter |
Interpreter used for single threaded mode, and environment tests. |
|
bool |
jit |
Whether the linked interpreter is Lua 5.1 or LuaJIT. |
|
bool |
threads |
Whether to create new interpreters on a per-instance/per-thread basis, or use a single mutex protected interpreter. |
◆ rlm_lua_thread_t
Definition at line 60 of file rlm_lua.h.
| Data Fields |
|
lua_State * |
interpreter |
Thread specific interpreter. |
◆ fr_lua_check_func()
| int fr_lua_check_func |
( |
module_inst_ctx_t const * |
mctx, |
|
|
lua_State * |
L, |
|
|
char const * |
name |
|
) |
| |
Check if a given function was loaded into an index in the global table.
Also check what was loaded there is a function and that it accepts the correct arguments.
- Parameters
-
| [in] | mctx | module instantiation data. |
| [in] | L | the lua state. |
| [in] | name | of function to check. |
- Returns
- 0 on success (function is present and correct), or -1 on failure.
Definition at line 695 of file lua.c.
◆ fr_lua_init()
Initialise a new Lua/LuaJIT interpreter.
Creates a new lua_State and verifies all required functions have been loaded correctly.
- Parameters
-
| [in] | out | Where to write a pointer to the new state. |
| [in] | mctx | configuration data for the |
- Returns
- 0 on success else -1.
Definition at line 1002 of file lua.c.
◆ fr_lua_isjit()
| bool fr_lua_isjit |
( |
lua_State * |
L | ) |
|
Check whether the Lua interpreter were actually linked to is LuaJIT.
- Parameters
-
- Returns
- true if were running with LuaJIT else false.
Definition at line 652 of file lua.c.
◆ fr_lua_run()
◆ fr_lua_util_fr_register()
| void fr_lua_util_fr_register |
( |
lua_State * |
L | ) |
|
◆ fr_lua_util_get_mctx()
Get the thread local instance.
- Returns
- mctx all helper and C functions callable from Lua should use.
Definition at line 330 of file util.c.
◆ fr_lua_util_get_request()
Get the thread local request.
- Returns
- request all helper and C functions callable from Lua should use.
Definition at line 348 of file util.c.
◆ fr_lua_util_jit_log_debug()
| void fr_lua_util_jit_log_debug |
( |
char const * |
msg | ) |
|
Emit a debug log message.
- Parameters
-
Definition at line 154 of file util.c.
◆ fr_lua_util_jit_log_error()
| void fr_lua_util_jit_log_error |
( |
char const * |
msg | ) |
|
Emit a error log message.
- Parameters
-
Definition at line 187 of file util.c.
◆ fr_lua_util_jit_log_info()
| void fr_lua_util_jit_log_info |
( |
char const * |
msg | ) |
|
Emit an info log message.
- Parameters
-
Definition at line 165 of file util.c.
◆ fr_lua_util_jit_log_register()
| int fr_lua_util_jit_log_register |
( |
lua_State * |
L | ) |
|
Insert cdefs into the lua environment.
For LuaJIT using the FFI is significantly faster than the Lua interface. Help people wishing to use the FFI by inserting cdefs for standard functions.
- Parameters
-
- Returns
- 0 (no arguments).
Definition at line 202 of file util.c.
◆ fr_lua_util_jit_log_warn()
| void fr_lua_util_jit_log_warn |
( |
char const * |
msg | ) |
|
Emit a warning log message.
- Parameters
-
Definition at line 176 of file util.c.
◆ fr_lua_util_log_register()
| int fr_lua_util_log_register |
( |
lua_State * |
L | ) |
|
Register utililiary functions in the lua environment.
- Parameters
-
- Returns
- 0 (no arguments).
Definition at line 280 of file util.c.
◆ fr_lua_util_set_mctx()
Set the thread local instance.
- Parameters
-
| [in] | mctx | all helper and C functions callable from Lua should use. |
Definition at line 321 of file util.c.
◆ fr_lua_util_set_request()
| void fr_lua_util_set_request |
( |
request_t * |
request | ) |
|
Set the thread local request.
- Parameters
-
| [in] | request | all helper and C functions callable from Lua should use. |
Definition at line 339 of file util.c.
◆ fr_lua_version()
| char const * fr_lua_version |
( |
lua_State * |
L | ) |
|