The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Macros | Functions | Variables
util.c File Reference

Helper Lua land functions. More...

#include <freeradius-devel/server/base.h>
#include "config.h"
#include "lua.h"
#include <lauxlib.h>
#include <lualib.h>
+ Include dependency graph for util.c:

Go to the source code of this file.

Macros

#define LOG_PREFIX   fr_lua_mctx->inst->name
 

Functions

static int _util_log_debug (lua_State *L)
 Lua function to output debug messages. More...
 
static int _util_log_error (lua_State *L)
 Lua function to output error messages. More...
 
static int _util_log_info (lua_State *L)
 Lua function to output informational messages. More...
 
static int _util_log_newindex (UNUSED lua_State *L)
 
static int _util_log_warn (lua_State *L)
 Lua function to output warning messages. More...
 
void fr_lua_util_fr_register (lua_State *L)
 
module_ctx_t const * fr_lua_util_get_mctx (void)
 Get the thread local instance. More...
 
request_tfr_lua_util_get_request (void)
 Get the thread local request. More...
 
void fr_lua_util_jit_log_debug (char const *msg)
 Emit a debug log message. More...
 
void fr_lua_util_jit_log_error (char const *msg)
 Emit a error log message. More...
 
void fr_lua_util_jit_log_info (char const *msg)
 Emit an info log message. More...
 
int fr_lua_util_jit_log_register (lua_State *L)
 Insert cdefs into the lua environment. More...
 
void fr_lua_util_jit_log_warn (char const *msg)
 Emit a warning log message. More...
 
int fr_lua_util_log_register (lua_State *L)
 Register utililiary functions in the lua environment. More...
 
void fr_lua_util_set_mctx (module_ctx_t const *mctx)
 Set the thread local instance. More...
 
void fr_lua_util_set_request (request_t *request)
 Set the thread local request. More...
 

Variables

static _Thread_local module_ctx_t const * fr_lua_mctx
 
static _Thread_local request_tfr_lua_request
 

Detailed Description

Helper Lua land functions.

Id
1d4c3ee70b185ee350bdf5a4c5faf9429ad53007
Author
Arran Cudbard-Bell (a.cud.nosp@m.bard.nosp@m.b@fre.nosp@m.erad.nosp@m.ius.o.nosp@m.rg)

Definition in file util.c.

Macro Definition Documentation

◆ LOG_PREFIX

#define LOG_PREFIX   fr_lua_mctx->inst->name

Definition at line 27 of file util.c.

Function Documentation

◆ _util_log_debug()

static int _util_log_debug ( lua_State *  L)
static

Lua function to output debug messages.

Lua arguments are one or more strings. Each successive argument will be printed on a new line.

Parameters
LLua interpreter.
Returns
0 (no arguments)

Definition at line 55 of file util.c.

+ Here is the caller graph for this function:

◆ _util_log_error()

static int _util_log_error ( lua_State *  L)
static

Lua function to output error messages.

Lua arguments are one or more strings. Each successive argument will be printed on a new line.

Parameters
LLua interpreter.
Returns
0 (no arguments)

Definition at line 125 of file util.c.

+ Here is the caller graph for this function:

◆ _util_log_info()

static int _util_log_info ( lua_State *  L)
static

Lua function to output informational messages.

Lua arguments are one or more strings. Each successive argument will be printed on a new line.

Parameters
LLua interpreter.
Returns
0 (no arguments)

Definition at line 78 of file util.c.

+ Here is the caller graph for this function:

◆ _util_log_newindex()

static int _util_log_newindex ( UNUSED lua_State *  L)
static

Definition at line 141 of file util.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _util_log_warn()

static int _util_log_warn ( lua_State *  L)
static

Lua function to output warning messages.

Lua arguments are one or more strings. Each successive argument will be printed on a new line.

Parameters
LLua interpreter.
Returns
0 (no arguments)

Definition at line 102 of file util.c.

+ Here is the caller graph for this function:

◆ fr_lua_util_fr_register()

void fr_lua_util_fr_register ( lua_State *  L)

Definition at line 40 of file util.c.

+ Here is the caller graph for this function:

◆ fr_lua_util_get_mctx()

module_ctx_t const* fr_lua_util_get_mctx ( void  )

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.

+ Here is the caller graph for this function:

◆ fr_lua_util_get_request()

request_t* fr_lua_util_get_request ( void  )

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.

+ Here is the caller graph for this function:

◆ fr_lua_util_jit_log_debug()

void fr_lua_util_jit_log_debug ( char const *  msg)

Emit a debug log message.

Parameters
msgto be printed.

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
msgto be printed.

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
msgto be printed.

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
LLua interpreter.
Returns
0 (no arguments).

Definition at line 202 of file util.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_lua_util_jit_log_warn()

void fr_lua_util_jit_log_warn ( char const *  msg)

Emit a warning log message.

Parameters
msgto be printed.

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
LLua interpreter.
Returns
0 (no arguments).

Definition at line 280 of file util.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_lua_util_set_mctx()

void fr_lua_util_set_mctx ( module_ctx_t const *  mctx)

Set the thread local instance.

Parameters
[in]mctxall helper and C functions callable from Lua should use.

Definition at line 321 of file util.c.

+ Here is the caller graph for this function:

◆ fr_lua_util_set_request()

void fr_lua_util_set_request ( request_t request)

Set the thread local request.

Parameters
[in]requestall helper and C functions callable from Lua should use.

Definition at line 339 of file util.c.

+ Here is the caller graph for this function:

Variable Documentation

◆ fr_lua_mctx

_Thread_local module_ctx_t const* fr_lua_mctx
static

Definition at line 38 of file util.c.

◆ fr_lua_request

_Thread_local request_t* fr_lua_request
static

Definition at line 37 of file util.c.