The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
Data Structures | 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.

Data Structures

struct  lua_call_env_t
 
struct  lua_func_def_t
 

Macros

#define LOG_PREFIX   mctx->mi->name
 

Functions

static int8_t lua_func_def_cmp (void const *one, void const *two)
 How to compare two Lua function calls.
 
static void lua_func_name_safe (char *name)
 
static int lua_func_parse (TALLOC_CTX *ctx, call_env_parsed_head_t *out, UNUSED tmpl_rules_t const *t_rules, UNUSED CONF_ITEM *ci, call_env_ctx_t const *cec, UNUSED call_env_parser_t const *rule)
 
static int mod_detach (module_detach_ctx_t const *mctx)
 Close the global interpreter.
 
static int mod_instantiate (module_inst_ctx_t const *mctx)
 
static unlang_action_t mod_lua (rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
 
static int mod_thread_detach (module_thread_inst_ctx_t const *mctx)
 Free any thread specific interpreters.
 
static int mod_thread_instantiate (module_thread_inst_ctx_t const *mctx)
 Create thread-specific connections and buffers.
 

Variables

static const call_env_method_t lua_method_env
 
static const conf_parser_t module_config []
 
module_rlm_t rlm_lua
 

Detailed Description

Translates requests between the server an a Lua interpreter.

Id
5a0ba9d9ee23a129b831b492fec70268067a5224
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.


Data Structure Documentation

◆ lua_call_env_t

struct lua_call_env_t

Definition at line 60 of file rlm_lua.c.

+ Collaboration diagram for lua_call_env_t:
Data Fields
lua_func_def_t * func

◆ lua_func_def_t

struct lua_func_def_t

Definition at line 53 of file rlm_lua.c.

+ Collaboration diagram for lua_func_def_t:
Data Fields
char const * function_name Name of the function being called.
char * name1 Section name1 where this is called.
char * name2 Section name2 where this is called.
fr_rb_node_t node Node in tree of function calls.

Macro Definition Documentation

◆ LOG_PREFIX

#define LOG_PREFIX   mctx->mi->name

Definition at line 28 of file rlm_lua.c.

Function Documentation

◆ lua_func_def_cmp()

static int8_t lua_func_def_cmp ( void const *  one,
void const *  two 
)
static

How to compare two Lua function calls.

Definition at line 67 of file rlm_lua.c.

+ Here is the caller graph for this function:

◆ lua_func_name_safe()

static void lua_func_name_safe ( char *  name)
static

Definition at line 227 of file rlm_lua.c.

+ Here is the caller graph for this function:

◆ lua_func_parse()

static int lua_func_parse ( TALLOC_CTX *  ctx,
call_env_parsed_head_t *  out,
UNUSED tmpl_rules_t const *  t_rules,
UNUSED CONF_ITEM ci,
call_env_ctx_t const *  cec,
UNUSED call_env_parser_t const *  rule 
)
static

Definition at line 239 of file rlm_lua.c.

+ Here is the call graph for this function:

◆ mod_detach()

static int mod_detach ( module_detach_ctx_t const *  mctx)
static

Close the global interpreter.

Definition at line 120 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 144 of file rlm_lua.c.

+ Here is the call graph for this function:

◆ mod_lua()

static unlang_action_t mod_lua ( rlm_rcode_t p_result,
module_ctx_t const *  mctx,
request_t request 
)
static

Definition at line 80 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 89 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 108 of file rlm_lua.c.

+ Here is the call graph for this function:

Variable Documentation

◆ lua_method_env

const call_env_method_t lua_method_env
static
Initial value:
= {
.env = (call_env_parser_t[]) {
}
}
#define CALL_ENV_TERMINATOR
Definition call_env.h:236
#define FR_CALL_ENV_METHOD_OUT(_inst)
Helper macro for populating the size/type fields of a call_env_method_t from the output structure typ...
Definition call_env.h:240
@ CALL_ENV_FLAG_PARSE_MISSING
If this subsection is missing, still parse it.
Definition call_env.h:88
#define FR_CALL_ENV_SUBSECTION_FUNC(_name, _name2, _flags, _func)
Specify a call_env_parser_t which parses a subsection using a callback function.
Definition call_env.h:412
Per method call config.
Definition call_env.h:180
#define CF_IDENT_ANY
Definition cf_util.h:78
static int lua_func_parse(TALLOC_CTX *ctx, call_env_parsed_head_t *out, UNUSED tmpl_rules_t const *t_rules, UNUSED CONF_ITEM *ci, call_env_ctx_t const *cec, UNUSED call_env_parser_t const *rule)
Definition rlm_lua.c:239

Definition at line 288 of file rlm_lua.c.

◆ 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_xlat", rlm_lua_t, func_xlat), NULL},
}
#define CONF_PARSER_TERMINATOR
Definition cf_parse.h:658
#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:284
#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:272
@ CONF_FLAG_REQUIRED
Error out if no matching CONF_PAIR is found, and no dflt value is set.
Definition cf_parse.h:434
@ CONF_FLAG_FILE_INPUT
File matching value must exist, and must be readable.
Definition cf_parse.h:440

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(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_lua, .method_env = &lua_method_env },
}
}
}
#define MODULE_MAGIC_INIT
Stop people using different module/library/server versions together.
Definition dl_module.h:63
static int mod_detach(module_detach_ctx_t const *mctx)
Close the global interpreter.
Definition rlm_lua.c:120
static const call_env_method_t lua_method_env
Definition rlm_lua.c:288
static unlang_action_t mod_lua(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
Definition rlm_lua.c:80
static int mod_thread_instantiate(module_thread_inst_ctx_t const *mctx)
Create thread-specific connections and buffers.
Definition rlm_lua.c:108
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:89
static int mod_instantiate(module_inst_ctx_t const *mctx)
Definition rlm_lua.c:144
#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 306 of file rlm_lua.c.