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

Translates requests between the server an a Lua interpreter. More...

#include <freeradius-devel/server/base.h>
#include <freeradius-devel/util/debug.h>
#include <freeradius-devel/server/module_rlm.h>
#include "lua.h"
+ Include dependency graph for rlm_lua.c:

Go to the source code of this file.

Macros

#define DO_LUA(_s)
 
#define LOG_PREFIX   mctx->inst->name
 

Functions

static int mod_detach (module_detach_ctx_t const *mctx)
 Close the global interpreter. More...
 
static int mod_instantiate (module_inst_ctx_t const *mctx)
 
static int mod_thread_detach (module_thread_inst_ctx_t const *mctx)
 Free any thread specific interpreters. More...
 
static int mod_thread_instantiate (module_thread_inst_ctx_t const *mctx)
 Create thread-specific connections and buffers. More...
 

Variables

static const conf_parser_t module_config []
 
module_rlm_t rlm_lua
 

Detailed Description

Translates requests between the server an a Lua interpreter.

Id
10ed6f412b481fbeb7bb1cb9a3fc5b67ecf7bc86
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 rlm_lua.c.

Macro Definition Documentation

◆ DO_LUA

#define DO_LUA (   _s)
Value:
static unlang_action_t mod_##_s(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request) \
{\
rlm_lua_t const *inst = talloc_get_type_abort_const(mctx->inst->data, rlm_lua_t);\
if (!inst->func_##_s) RETURN_MODULE_NOOP;\
return fr_lua_run(p_result, mctx, request, inst->func_##_s);\
}
unlang_action_t
Returned by unlang_op_t calls, determine the next action of the interpreter.
Definition: action.h:35
unlang_action_t fr_lua_run(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request, char const *funcname)
Definition: lua.c:754
Definition: lua.h:43
Temporary structure to hold arguments for module calls.
Definition: module_ctx.h:41
#define RETURN_MODULE_NOOP
Definition: rcode.h:62
rlm_rcode_t
Return codes indicating the result of the module call.
Definition: rcode.h:40
eap_aka_sim_process_conf_t * inst
#define talloc_get_type_abort_const
Definition: talloc.h:270

Definition at line 58 of file rlm_lua.c.

◆ LOG_PREFIX

#define LOG_PREFIX   mctx->inst->name

Definition at line 28 of file rlm_lua.c.

Function Documentation

◆ mod_detach()

static int mod_detach ( module_detach_ctx_t const *  mctx)
static

Close the global interpreter.

Definition at line 107 of file rlm_lua.c.

+ Here is the call graph for this function:

◆ mod_instantiate()

static int mod_instantiate ( module_inst_ctx_t const *  mctx)
static

Definition at line 131 of file rlm_lua.c.

+ Here is the call graph for this function:

◆ mod_thread_detach()

static int mod_thread_detach ( module_thread_inst_ctx_t const *  mctx)
static

Free any thread specific interpreters.

Definition at line 76 of file rlm_lua.c.

◆ mod_thread_instantiate()

static int mod_thread_instantiate ( module_thread_inst_ctx_t const *  mctx)
static

Create thread-specific connections and buffers.

Parameters
[in]mctxspecific data (where we write the interpreter).
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 95 of file rlm_lua.c.

+ Here is the call graph for this function:

Variable Documentation

◆ module_config

const conf_parser_t module_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET("func_instantiate", rlm_lua_t, func_instantiate), NULL},
{ FR_CONF_OFFSET("func_detach", rlm_lua_t, func_detach), NULL},
{ FR_CONF_OFFSET("func_authorize", rlm_lua_t, func_authorize), NULL},
{ FR_CONF_OFFSET("func_authenticate", rlm_lua_t, func_authenticate), NULL},
{ FR_CONF_OFFSET("func_accounting", rlm_lua_t, func_accounting), NULL},
{ FR_CONF_OFFSET("func_preacct", rlm_lua_t, func_preacct), NULL},
{ FR_CONF_OFFSET("func_xlat", rlm_lua_t, func_xlat), NULL},
{ FR_CONF_OFFSET("func_post_auth", rlm_lua_t, func_post_auth), NULL},
}
#define CONF_PARSER_TERMINATOR
Definition: cf_parse.h:626
#define FR_CONF_OFFSET(_name, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
Definition: cf_parse.h:268
#define FR_CONF_OFFSET_FLAGS(_name, _flags, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
Definition: cf_parse.h:256
@ CONF_FLAG_REQUIRED
Error out if no matching CONF_PAIR is found, and no dflt value is set.
Definition: cf_parse.h:406
@ CONF_FLAG_FILE_INPUT
File matching value must exist, and must be readable.
Definition: cf_parse.h:412

Definition at line 44 of file rlm_lua.c.

◆ rlm_lua

module_rlm_t rlm_lua
Initial value:
= {
.common = {
.name = "lua",
.inst_size = sizeof(rlm_lua_t),
.thread_inst_size = sizeof(rlm_lua_thread_t),
.config = module_config,
.instantiate = mod_instantiate,
.thread_instantiate = mod_thread_instantiate,
.detach = mod_detach,
.thread_detach = mod_thread_detach
},
.method_names = (module_method_name_t[]){
{ .name1 = "authorize", .name2 = CF_IDENT_ANY, .method = mod_authorize },
{ .name1 = "recv", .name2 = "accounting-request", .method = mod_preacct },
{ .name1 = "recv", .name2 = CF_IDENT_ANY, .method = mod_authorize },
{ .name1 = "accounting", .name2 = CF_IDENT_ANY, .method = mod_accounting },
{ .name1 = "authenticate", .name2 = CF_IDENT_ANY, .method = mod_authenticate },
{ .name1 = "send", .name2 = CF_IDENT_ANY, .method = mod_post_auth },
}
}
#define CF_IDENT_ANY
Definition: cf_util.h:78
#define MODULE_MAGIC_INIT
Stop people using different module/library/server versions together.
Definition: dl_module.h:65
Specifies a module method identifier.
Definition: module_method.c:36
static unlang_action_t mod_authenticate(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
Definition: rlm_chap.c:228
static unlang_action_t mod_authorize(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
Definition: rlm_chap.c:176
static unlang_action_t mod_accounting(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
Write accounting data to Couchbase documents.
static unlang_action_t mod_post_auth(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
Definition: rlm_detail.c:400
static int mod_detach(module_detach_ctx_t const *mctx)
Close the global interpreter.
Definition: rlm_lua.c:107
static int mod_thread_instantiate(module_thread_inst_ctx_t const *mctx)
Create thread-specific connections and buffers.
Definition: rlm_lua.c:95
static const conf_parser_t module_config[]
Definition: rlm_lua.c:44
static int mod_thread_detach(module_thread_inst_ctx_t const *mctx)
Free any thread specific interpreters.
Definition: rlm_lua.c:76
static int mod_instantiate(module_inst_ctx_t const *mctx)
Definition: rlm_lua.c:131
static unlang_action_t mod_preacct(rlm_rcode_t *p_result, module_ctx_t const *mctx, UNUSED request_t *request)
Definition: rlm_test.c:248
@ MODULE_TYPE_THREAD_SAFE
Module is threadsafe.
Definition: module.h:49
#define MODULE_NAME_TERMINATOR
Definition: module.h:135

Definition at line 168 of file rlm_lua.c.