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->mi->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
f65d06bfcf8297adb3e158d97fefe2ade77acd77
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->mi->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:282

Definition at line 58 of file rlm_lua.c.

◆ LOG_PREFIX

#define LOG_PREFIX   mctx->mi->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:627
#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:405
@ CONF_FLAG_FILE_INPUT
File matching value must exist, and must be readable.
Definition: cf_parse.h:411

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_group = {
.bindings = (module_method_binding_t[]){
{ .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting },
{ .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate },
{ .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize },
{ .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct },
{ .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize },
{ .section = SECTION_NAME("send", 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:63
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:246
#define SECTION_NAME(_name1, _name2)
Define a section name consisting of a verb and a noun.
Definition: section.h:40
#define MODULE_BINDING_TERMINATOR
Terminate a module binding list.
Definition: module.h:151
Named methods exported by a module.
Definition: module.h:173

Definition at line 168 of file rlm_lua.c.