The FreeRADIUS server
$Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
Cache values and merge them back into future requests. More...
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/module_rlm.h>
#include <freeradius-devel/server/modpriv.h>
#include <freeradius-devel/server/dl_module.h>
#include <freeradius-devel/server/rcode.h>
#include <freeradius-devel/server/tmpl.h>
#include <freeradius-devel/util/debug.h>
#include <freeradius-devel/util/types.h>
#include <freeradius-devel/util/value.h>
#include <freeradius-devel/unlang/xlat_func.h>
#include <freeradius-devel/unlang/call_env.h>
#include "rlm_cache.h"
Go to the source code of this file.
Data Structures | |
struct | cache_call_env_t |
struct | cache_htrie_t |
Macros | |
#define | LOG_PREFIX mctx->mi->name |
Functions | |
static int | cache_acquire (rlm_cache_handle_t **out, rlm_cache_t const *inst, request_t *request) |
Get exclusive use of a handle to access the cache. More... | |
static rlm_cache_entry_t * | cache_alloc (rlm_cache_t const *inst, request_t *request) |
Allocate a cache entry. More... | |
static unlang_action_t | cache_expire (rlm_rcode_t *p_result, rlm_cache_t const *inst, request_t *request, rlm_cache_handle_t **handle, fr_value_box_t const *key) |
Expire a cache entry (removing it from the datastore) More... | |
static unlang_action_t | cache_find (rlm_rcode_t *p_result, rlm_cache_entry_t **out, rlm_cache_t const *inst, request_t *request, rlm_cache_handle_t **handle, fr_value_box_t const *key) |
Find a cached entry. More... | |
static void | cache_free (rlm_cache_t const *inst, rlm_cache_entry_t **c) |
Free memory associated with a cache entry. More... | |
static unlang_action_t | cache_insert (rlm_rcode_t *p_result, rlm_cache_t const *inst, request_t *request, rlm_cache_handle_t **handle, fr_value_box_t const *key, map_list_t const *maps, fr_time_delta_t ttl) |
Create and insert a cache entry. More... | |
static int | cache_key_parse (TALLOC_CTX *ctx, void *out, tmpl_rules_t const *t_rules, CONF_ITEM *ci, call_env_ctx_t const *cec, call_env_parser_t const *rule) |
static rlm_rcode_t | cache_merge (rlm_cache_t const *inst, request_t *request, rlm_cache_entry_t *c) |
Merge a cached entry into a request_t. More... | |
static int | cache_reconnect (rlm_cache_handle_t **handle, rlm_cache_t const *inst, request_t *request) |
Reconnect an suspected inviable handle. More... | |
static void | cache_release (rlm_cache_t const *inst, request_t *request, rlm_cache_handle_t **handle) |
Release a handle we previously acquired. More... | |
static unlang_action_t | cache_set_ttl (rlm_rcode_t *p_result, rlm_cache_t const *inst, request_t *request, rlm_cache_handle_t **handle, rlm_cache_entry_t *c) |
Update the TTL of an entry. More... | |
static xlat_action_t | cache_ttl_get_xlat (TALLOC_CTX *ctx, fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, UNUSED fr_value_box_list_t *in) |
static void | cache_unref (request_t *request, rlm_cache_t const *inst, rlm_cache_entry_t *entry, rlm_cache_handle_t *handle) |
Release the allocated resources and cleanup the avps. More... | |
static int | cache_update_section_parse (TALLOC_CTX *ctx, call_env_parsed_head_t *out, tmpl_rules_t const *t_rules, CONF_ITEM *ci, call_env_ctx_t const *cec, call_env_parser_t const *rule) |
static int | cache_update_section_parse (TALLOC_CTX *ctx, call_env_parsed_head_t *out, tmpl_rules_t const *t_rules, CONF_ITEM *ci, UNUSED call_env_ctx_t const *cec, UNUSED call_env_parser_t const *rule) |
static int | cache_verify (map_t *map, void *uctx) |
Verify that a map in the cache section makes sense. More... | |
static xlat_action_t | cache_xlat (TALLOC_CTX *ctx, fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *in) |
Allow single attribute values to be retrieved from the cache. More... | |
static int | mod_bootstrap (module_inst_ctx_t const *mctx) |
Register module xlats. More... | |
static unlang_action_t | mod_cache_it (rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request) |
Do caching checks. More... | |
static int | mod_detach (module_detach_ctx_t const *mctx) |
Free any memory allocated under the instance. More... | |
static int | mod_instantiate (module_inst_ctx_t const *mctx) |
Create a new rlm_cache_instance. More... | |
static unlang_action_t | mod_method_clear (rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request) |
Delete the entries by ${key}. More... | |
static unlang_action_t | mod_method_load (rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request) |
Load the avps by ${key}. More... | |
static unlang_action_t | mod_method_status (rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request) |
Get the status by ${key} (without load) More... | |
static unlang_action_t | mod_method_store (rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request) |
Create, or update a cache entry. More... | |
static unlang_action_t | mod_method_ttl (rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request) |
Change the TTL on an existing entry. More... | |
static unlang_action_t | mod_method_update (rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request) |
Create, or update a cache entry. More... | |
int | submodule_parse (TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, conf_parser_t const *rule) |
Variables | |
static fr_dict_attr_t const * | attr_cache_allow_insert |
static fr_dict_attr_t const * | attr_cache_allow_merge |
static fr_dict_attr_t const * | attr_cache_entry_hits |
static fr_dict_attr_t const * | attr_cache_merge_new |
static fr_dict_attr_t const * | attr_cache_status_only |
static fr_dict_attr_t const * | attr_cache_ttl |
static const call_env_method_t | cache_method_env |
static xlat_arg_parser_t const | cache_xlat_args [] |
static fr_dict_t const * | dict_freeradius |
static const conf_parser_t | module_config [] |
module_rlm_t | rlm_cache |
fr_dict_autoload_t | rlm_cache_dict [] |
fr_dict_attr_autoload_t | rlm_cache_dict_attr [] |
Cache values and merge them back into future requests.
Definition in file rlm_cache.c.
struct cache_call_env_t |
Definition at line 61 of file rlm_cache.c.
Data Fields | ||
---|---|---|
fr_value_box_t * | key | To lookup the cache entry with. |
map_list_t * | maps | Attribute map applied to cache entries. |
struct cache_htrie_t |
Definition at line 66 of file rlm_cache.c.
Data Fields | ||
---|---|---|
fr_type_t | ktype | Key type. |
Definition at line 27 of file rlm_cache.c.
|
static |
Get exclusive use of a handle to access the cache.
Definition at line 167 of file rlm_cache.c.
|
static |
Allocate a cache entry.
This is used so that drivers may use their own allocation functions to allocate structures larger than the normal rlm_cache_entry_t.
If the driver doesn't specify a custom allocation function, the cache entry is talloced in the NULL ctx.
Definition at line 207 of file rlm_cache.c.
|
static |
Expire a cache entry (removing it from the datastore)
Definition at line 359 of file rlm_cache.c.
|
static |
Find a cached entry.
Definition at line 289 of file rlm_cache.c.
|
static |
Free memory associated with a cache entry.
This does not necessarily remove the entry from the cache, cache_expire should be used for that.
This function should be called when an entry that is known to have been retrieved or inserted into a data store successfully, is no longer needed.
Some drivers (like rlm_cache_rbtree) don't register a free function. This means that the cache entry never needs to be explicitly freed.
[in] | inst | Module instance. |
[in,out] | c | Cache entry to free. |
Definition at line 228 of file rlm_cache.c.
|
static |
Create and insert a cache entry.
Definition at line 387 of file rlm_cache.c.
|
static |
|
static |
Merge a cached entry into a request_t.
Definition at line 243 of file rlm_cache.c.
|
static |
Reconnect an suspected inviable handle.
Definition at line 192 of file rlm_cache.c.
|
static |
Release a handle we previously acquired.
Definition at line 180 of file rlm_cache.c.
|
static |
Update the TTL of an entry.
Definition at line 564 of file rlm_cache.c.
|
static |
Definition at line 960 of file rlm_cache.c.
|
static |
Release the allocated resources and cleanup the avps.
Definition at line 1000 of file rlm_cache.c.
|
static |
|
static |
|
static |
Verify that a map in the cache section makes sense.
Definition at line 1407 of file rlm_cache.c.
|
static |
Register module xlats.
Definition at line 1482 of file rlm_cache.c.
|
static |
Do caching checks.
Since we can update ANY VP list, we do exactly the same thing for all sections (autz / auth / etc.)
If you want to cache something different in different sections, configure another cache module.
Definition at line 620 of file rlm_cache.c.
|
static |
Free any memory allocated under the instance.
Definition at line 1387 of file rlm_cache.c.
|
static |
Create a new rlm_cache_instance.
Definition at line 1453 of file rlm_cache.c.
|
static |
Delete the entries by ${key}.
Definition at line 1279 of file rlm_cache.c.
|
static |
Load the avps by ${key}.
Definition at line 1082 of file rlm_cache.c.
|
static |
Get the status by ${key} (without load)
Definition at line 1044 of file rlm_cache.c.
|
static |
Create, or update a cache entry.
Definition at line 1212 of file rlm_cache.c.
|
static |
Change the TTL on an existing entry.
Definition at line 1323 of file rlm_cache.c.
|
static |
Create, or update a cache entry.
Definition at line 1124 of file rlm_cache.c.
int submodule_parse | ( | TALLOC_CTX * | ctx, |
void * | out, | ||
void * | parent, | ||
CONF_ITEM * | ci, | ||
conf_parser_t const * | rule | ||
) |
|
static |
Definition at line 91 of file rlm_cache.c.
|
static |
Definition at line 90 of file rlm_cache.c.
|
static |
Definition at line 93 of file rlm_cache.c.
|
static |
Definition at line 88 of file rlm_cache.c.
|
static |
Definition at line 89 of file rlm_cache.c.
|
static |
Definition at line 92 of file rlm_cache.c.
|
static |
Definition at line 71 of file rlm_cache.c.
|
static |
Definition at line 878 of file rlm_cache.c.
|
static |
Definition at line 80 of file rlm_cache.c.
|
static |
Definition at line 49 of file rlm_cache.c.
module_rlm_t rlm_cache |
Definition at line 1508 of file rlm_cache.c.
fr_dict_autoload_t rlm_cache_dict |
Definition at line 83 of file rlm_cache.c.
fr_dict_attr_autoload_t rlm_cache_dict_attr |
Definition at line 96 of file rlm_cache.c.