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

Translates requests between the server an an mruby interpreter. More...

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

Go to the source code of this file.

Data Structures

struct  rlm_mruby_t
 

Macros

#define A(x)   mrb_define_const(mrb, inst->mruby_module, #x, mrb_fixnum_value(x));
 
#define RLM_MRUBY_FUNC(foo)
 

Functions

static void add_vp_tuple (TALLOC_CTX *ctx, request_t *request, fr_pair_list_t *vps, mrb_state *mrb, mrb_value value, char const *function_name)
 
static unlang_action_t do_mruby (rlm_rcode_t *p_result, request_t *request, rlm_mruby_t const *inst, char const *function_name)
 
static int mod_detach (module_detach_ctx_t const *mctx)
 
static int mod_instantiate (module_inst_ctx_t const *mctx)
 
static mrb_value mruby_log (mrb_state *mrb, UNUSED mrb_value self)
 
static void mruby_parse_config (mrb_state *mrb, CONF_SECTION *cs, int lvl, mrb_value hash)
 
static int mruby_set_vps (request_t *request, mrb_state *mrb, mrb_value mruby_request, char const *list_name, fr_pair_list_t *vps)
 
static int mruby_vps_to_array (request_t *request, mrb_value *out, mrb_state *mrb, fr_pair_list_t *vps)
 

Variables

static const conf_parser_t module_config []
 
module_rlm_t rlm_mruby
 

Detailed Description

Translates requests between the server an an mruby interpreter.

Id
6da6d896f5309ff932d9f2f4a2a53bc4b90cdff0
Id
9b3290940629e0a41f8e355bb87886c5e7c65805

Definition in file rlm_mruby.c.


Data Structure Documentation

◆ rlm_mruby_t

struct rlm_mruby_t

Definition at line 41 of file rlm_mruby.c.

Data Fields
char const * filename
char const * module_name
mrb_state * mrb
struct RClass * mruby_module
struct RClass * mruby_request
mrb_value mrubyconf_hash

Macro Definition Documentation

◆ A

#define A (   x)    mrb_define_const(mrb, inst->mruby_module, #x, mrb_fixnum_value(x));

◆ RLM_MRUBY_FUNC

#define RLM_MRUBY_FUNC (   foo)
Value:
static unlang_action_t mod_##foo(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request) \
{ \
return do_mruby(p_result, \
request, \
(rlm_mruby_t const *)mctx->mi->data, \
#foo); \
}
unlang_action_t
Returned by unlang_op_t calls, determine the next action of the interpreter.
Definition: action.h:35
Temporary structure to hold arguments for module calls.
Definition: module_ctx.h:41
rlm_rcode_t
Return codes indicating the result of the module call.
Definition: rcode.h:40
static unlang_action_t do_mruby(rlm_rcode_t *p_result, request_t *request, rlm_mruby_t const *inst, char const *function_name)
Definition: rlm_mruby.c:406

Definition at line 472 of file rlm_mruby.c.

Function Documentation

◆ add_vp_tuple()

static void add_vp_tuple ( TALLOC_CTX *  ctx,
request_t request,
fr_pair_list_t vps,
mrb_state *  mrb,
mrb_value  value,
char const *  function_name 
)
static

Definition at line 306 of file rlm_mruby.c.

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

◆ do_mruby()

static unlang_action_t do_mruby ( rlm_rcode_t p_result,
request_t request,
rlm_mruby_t const *  inst,
char const *  function_name 
)
static

Definition at line 406 of file rlm_mruby.c.

+ Here is the call graph for this function:

◆ mod_detach()

static int mod_detach ( module_detach_ctx_t const *  mctx)
static

Definition at line 491 of file rlm_mruby.c.

◆ mod_instantiate()

static int mod_instantiate ( module_inst_ctx_t const *  mctx)
static

Definition at line 132 of file rlm_mruby.c.

+ Here is the call graph for this function:

◆ mruby_log()

static mrb_value mruby_log ( mrb_state *  mrb,
UNUSED mrb_value  self 
)
static

Definition at line 61 of file rlm_mruby.c.

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

◆ mruby_parse_config()

static void mruby_parse_config ( mrb_state *  mrb,
CONF_SECTION cs,
int  lvl,
mrb_value  hash 
)
static

Definition at line 72 of file rlm_mruby.c.

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

◆ mruby_set_vps()

static int mruby_set_vps ( request_t request,
mrb_state *  mrb,
mrb_value  mruby_request,
char const *  list_name,
fr_pair_list_t vps 
)
inlinestatic

Definition at line 392 of file rlm_mruby.c.

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

◆ mruby_vps_to_array()

static int mruby_vps_to_array ( request_t request,
mrb_value *  out,
mrb_state *  mrb,
fr_pair_list_t vps 
)
static

Definition at line 213 of file rlm_mruby.c.

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

Variable Documentation

◆ module_config

const conf_parser_t module_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET("module", rlm_mruby_t, module_name), .dflt = "Radiusd" },
}
#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 55 of file rlm_mruby.c.

◆ rlm_mruby

module_rlm_t rlm_mruby
Initial value:
= {
.common = {
.name = "mruby",
.inst_size = sizeof(rlm_mruby_t),
.detach = mod_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 const conf_parser_t config[]
Definition: base.c:183
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)
Definition: rlm_mruby.c:491
static const conf_parser_t module_config[]
Definition: rlm_mruby.c:55
static int mod_instantiate(module_inst_ctx_t const *mctx)
Definition: rlm_mruby.c:132
static int instantiate(module_inst_ctx_t const *mctx)
Definition: rlm_rest.c:1302
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
@ MODULE_TYPE_THREAD_UNSAFE
Module is not threadsafe.
Definition: module.h:48
#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 510 of file rlm_mruby.c.