Driver for the Redis noSQL key value store.
More...
#include <assert.h>
#include <stdint.h>
#include <freeradius-devel/redis/base.h>
#include <freeradius-devel/redis/cluster.h>
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/cf_util.h>
#include <freeradius-devel/server/modpriv.h>
#include <freeradius-devel/server/module_rlm.h>
#include <freeradius-devel/server/pool.h>
#include <freeradius-devel/unlang/xlat.h>
#include <freeradius-devel/unlang/xlat_func.h>
#include <freeradius-devel/util/base16.h>
#include <freeradius-devel/util/debug.h>
#include <freeradius-devel/util/log.h>
#include <freeradius-devel/util/talloc.h>
#include <freeradius-devel/util/types.h>
#include <freeradius-devel/util/value.h>
Go to the source code of this file.
|
static int | lua_func_body_parse (TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, conf_parser_t const *rule) |
| Do basic processing for a lua function body and compute its sha1 hash. More...
|
|
static int | mod_bootstrap (module_inst_ctx_t const *mctx) |
|
static int | mod_instantiate (module_inst_ctx_t const *mctx) |
|
static int | mod_load (void) |
|
static int | redis_command (fr_redis_rcode_t *status_out, redisReply **reply_out, request_t *request, fr_redis_conn_t *conn, bool read_only, int argc, char const **argv, size_t arg_len[]) |
| Issue a command against redis and get a response. More...
|
|
static int | redis_lua_func_instantiate (xlat_inst_ctx_t const *xctx) |
| Copies the function configuration into xlat function instance data. More...
|
|
static xlat_action_t | redis_lua_func_xlat (TALLOC_CTX *ctx, fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *in) |
| Call a lua function on the redis server. More...
|
|
static xlat_action_t | redis_node_xlat (TALLOC_CTX *ctx, fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *in) |
| Return the node that is currently servicing a particular key. More...
|
|
static xlat_action_t | redis_remap_xlat (TALLOC_CTX *ctx, fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *in) |
| Force a redis cluster remap. More...
|
|
static xlat_action_t | redis_xlat (TALLOC_CTX *ctx, fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *in) |
| Xlat to make calls to redis. More...
|
|
Driver for the Redis noSQL key value store.
- Id
- a393f98a94b4a32ca24ecc1c59adc2e0c5b668df
- Author
- Gabriel Blanchard
- Copyright
- 2015 Arran Cudbard-Bell (a.cud.nosp@m.bard.nosp@m.b@fre.nosp@m.erad.nosp@m.ius.o.nosp@m.rg)
-
2011 TekSavvy Solutions (gabe@.nosp@m.teks.nosp@m.avvy..nosp@m.com)
-
2000,2006,2015 The FreeRADIUS server project
Definition in file rlm_redis.c.
◆ redis_lua_func_inst_t
struct redis_lua_func_inst_t |
Instance of a redis lua func xlat.
Definition at line 66 of file rlm_redis.c.
◆ redis_lua_func_t
A lua function or stored procedure we make available as an xlat.
Definition at line 56 of file rlm_redis.c.
Data Fields |
char const * |
body |
the actual lua code. |
char |
digest[(SHA1_DIGEST_LENGTH *2)+1] |
pre-computed hash of lua code. |
char const * |
name |
Friendly name for the function. Used to register the equivalent xlat. |
bool |
read_only |
Function has no side effects. |
◆ rlm_redis_lua_t
◆ rlm_redis_t
rlm_redis module instance
Definition at line 79 of file rlm_redis.c.
◆ lua_func_body_parse()
static int lua_func_body_parse |
( |
TALLOC_CTX * |
ctx, |
|
|
void * |
out, |
|
|
void * |
parent, |
|
|
CONF_ITEM * |
ci, |
|
|
conf_parser_t const * |
rule |
|
) |
| |
|
static |
Do basic processing for a lua function body and compute its sha1 hash.
Definition at line 112 of file rlm_redis.c.
◆ mod_bootstrap()
◆ mod_instantiate()
◆ mod_load()
static int mod_load |
( |
void |
| ) |
|
|
static |
◆ redis_command()
Issue a command against redis and get a response.
This is a convenience function for dealing with commands which made need to execute against an ldap replica. It temporarily places the connection in readonly mode to allow commands to be run against ldap replicas, then reverts back to readwrite mode.
- Parameters
-
[out] | status_out | Where to write the status from the command. |
[out] | reply_out | Where to write the reply associated with the highest priority status. |
[in] | request | The current request. |
[in] | conn | to issue commands with. |
[in] | read_only | wrap command in READONLY/READWRITE. |
[in] | argc | Redis command argument count. |
[in] | argv | Redis command arguments. |
[in] | arg_len | Optional array of redis command argument length. |
- Returns
- 0 success.
- -1 normal failure.
- -2 failure that may leave the connection in a READONLY state.
Definition at line 165 of file rlm_redis.c.
◆ redis_lua_func_instantiate()
Copies the function configuration into xlat function instance data.
Definition at line 566 of file rlm_redis.c.
◆ redis_lua_func_xlat()
Call a lua function on the redis server.
Lua functions either get uploaded when the module is instantiated or the first time they get executed.
Definition at line 379 of file rlm_redis.c.
◆ module_config
Initial value:= {
}
#define CONF_PARSER_TERMINATOR
#define FR_CONF_OFFSET_SUBSECTION(_name, _flags, _struct, _field, _subcs)
conf_parser_t which populates a sub-struct using a CONF_SECTION
#define REDIS_COMMON_CONFIG
static conf_parser_t module_lua[]
rlm_redis module instance
Definition at line 103 of file rlm_redis.c.
◆ module_lua
Initial value:= {
}
#define FR_CONF_SUBSECTION_ALLOC(_name, _type, _flags, _struct, _field, _subcs)
A conf_parser_t multi-subsection.
@ CONF_FLAG_MULTI
CONF_PAIR can have multiple copies.
@ CONF_FLAG_OK_MISSING
OK if it's missing.
@ CONF_FLAG_SUBSECTION
Instead of putting the information into a configuration structure, the configuration file routines MA...
static conf_parser_t module_lua_func[]
Definition at line 96 of file rlm_redis.c.
◆ module_lua_func
Initial value:= {
}
#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
static int lua_func_body_parse(TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, conf_parser_t const *rule)
Do basic processing for a lua function body and compute its sha1 hash.
A lua function or stored procedure we make available as an xlat.
Definition at line 90 of file rlm_redis.c.
◆ redis_args
Initial value:= {
}
@ FR_TYPE_STRING
String of printable characters.
@ XLAT_ARG_VARIADIC_EMPTY_KEEP
Empty argument groups are left alone, and either passed through as empty groups or null boxes.
#define XLAT_ARG_PARSER_TERMINATOR
Definition at line 575 of file rlm_redis.c.
◆ redis_lua_func_args
Initial value:= {
}
@ FR_TYPE_UINT64
64 Bit unsigned integer.
Definition at line 368 of file rlm_redis.c.
◆ redis_node_xlat_args
Initial value:= {
}
@ FR_TYPE_UINT32
32 Bit unsigned integer.
Definition at line 311 of file rlm_redis.c.
◆ redis_remap_xlat_args
◆ rlm_redis
Initial value:= {
.common = {
.name = "redis",
}
}
#define MODULE_MAGIC_INIT
Stop people using different module/library/server versions together.
static const conf_parser_t config[]
static int mod_load(void)
static int mod_bootstrap(module_inst_ctx_t const *mctx)
static int mod_instantiate(module_inst_ctx_t const *mctx)
static conf_parser_t module_config[]
static int instantiate(module_inst_ctx_t const *mctx)
Definition at line 899 of file rlm_redis.c.