The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
rlm_mruby.h
Go to the documentation of this file.
1#pragma once
2/*
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or (at
6 * your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
16 */
17
18/**
19 * @file rlm_mruby.h
20 * @brief Translates requests between the server an an mruby interpreter.
21 *
22 * @copyright 2016 Herwin Weststrate (freeradius@herwinw.nl)
23 * @copyright 2016 The FreeRADIUS server project
24 */
25
27DIAG_OFF(documentation)
28#include <mruby.h>
29#include <mruby/compile.h>
30#include <mruby/array.h>
31#include <mruby/hash.h>
32#include <mruby/numeric.h>
33#include <mruby/string.h>
34#include <mruby/variable.h>
35#include <mruby/class.h>
36#include <mruby/data.h>
37DIAG_ON(documentation)
39#include <freeradius-devel/server/base.h>
40
41typedef struct {
42 char const *filename;
43 char const *module_name;
44
45 fr_rb_tree_t funcs; //!< Tree of function calls found by call_env parser.
46 bool funcs_init; //!< Has the tree been initialised.
47
48 mrb_state *mrb;
49
50 struct RClass *mruby_module;
51 struct RClass *mruby_request;
52 struct RClass *mruby_ptr;
53 struct RClass *mruby_pair_list;
54 struct RClass *mruby_pair;
55 mrb_value mrubyconf_hash;
57
58struct RClass *mruby_request_class(mrb_state *mrb, struct RClass *parent);
59struct RClass *mruby_pair_list_class(mrb_state *mrb, struct RClass *parent);
60struct RClass *mruby_pair_class(mrb_state *mrb, struct RClass *parent);
61mrb_value mruby_inst_object(mrb_state *mrb, struct RClass *klass, rlm_mruby_t const *inst);
62mrb_value mruby_request_object(mrb_state *mrb, struct RClass *klass, request_t *request);
63mrb_value mruby_value_pair_object(mrb_state *mrb, struct RClass *klass, fr_pair_t *vp);
64mrb_value mruby_dict_attr_object(mrb_state *mrb, struct RClass *klass, fr_dict_attr_t const *da);
#define DIAG_UNKNOWN_PRAGMAS
Definition build.h:458
#define DIAG_ON(_x)
Definition build.h:460
#define DIAG_OFF(_x)
Definition build.h:459
The main red black tree structure.
Definition rb.h:73
struct RClass * mruby_request_class(mrb_state *mrb, struct RClass *parent)
Definition mruby.c:63
struct RClass * mruby_pair_list
Definition rlm_mruby.h:53
mrb_value mruby_request_object(mrb_state *mrb, struct RClass *klass, request_t *request)
Definition mruby.c:114
mrb_value mrubyconf_hash
Definition rlm_mruby.h:55
char const * filename
Definition rlm_mruby.h:42
struct RClass * mruby_pair
Definition rlm_mruby.h:54
mrb_state * mrb
Definition rlm_mruby.h:48
mrb_value mruby_value_pair_object(mrb_state *mrb, struct RClass *klass, fr_pair_t *vp)
Definition mruby.c:124
struct RClass * mruby_ptr
Definition rlm_mruby.h:52
char const * module_name
Definition rlm_mruby.h:43
struct RClass * mruby_request
Definition rlm_mruby.h:51
struct RClass * mruby_module
Definition rlm_mruby.h:50
mrb_value mruby_dict_attr_object(mrb_state *mrb, struct RClass *klass, fr_dict_attr_t const *da)
Definition mruby.c:119
fr_rb_tree_t funcs
Tree of function calls found by call_env parser.
Definition rlm_mruby.h:45
bool funcs_init
Has the tree been initialised.
Definition rlm_mruby.h:46
struct RClass * mruby_pair_list_class(mrb_state *mrb, struct RClass *parent)
Definition mruby.c:611
struct RClass * mruby_pair_class(mrb_state *mrb, struct RClass *parent)
Definition mruby.c:625
mrb_value mruby_inst_object(mrb_state *mrb, struct RClass *klass, rlm_mruby_t const *inst)
Definition mruby.c:109
eap_aka_sim_process_conf_t * inst
fr_pair_t * vp
Stores an attribute, a value and various bits of other data.
Definition pair.h:68
static fr_slen_t parent
Definition pair.h:839