The FreeRADIUS server
$Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/dl_module.h>
#include <freeradius-devel/server/map.h>
#include <freeradius-devel/protocol/freeradius/freeradius.internal.h>
Go to the source code of this file.
Data Structures | |
struct | rlm_cache_config_t |
Configuration for the rlm_cache module. More... | |
struct | rlm_cache_driver_s |
struct | rlm_cache_entry_t |
struct | rlm_cache_t |
Macros | |
#define | MAX_ATTRMAP 128 |
Typedefs | |
typedef int(* | cache_acquire_t) (void **handle, rlm_cache_config_t const *config, void *instance, request_t *request) |
Acquire a handle to access the cache. More... | |
typedef rlm_cache_entry_t *(* | cache_entry_alloc_t) (rlm_cache_config_t const *config, void *instance, request_t *request) |
Allocate a new cache entry. More... | |
typedef uint64_t(* | cache_entry_count_t) (rlm_cache_config_t const *config, void *instance, request_t *request, void *handle) |
Get the number of entries in the cache. More... | |
typedef cache_status_t(* | cache_entry_expire_t) (rlm_cache_config_t const *config, void *instance, request_t *request, void *handle, fr_value_box_t const *key) |
Remove an entry from the cache. More... | |
typedef cache_status_t(* | cache_entry_find_t) (rlm_cache_entry_t **out, rlm_cache_config_t const *config, void *instance, request_t *request, void *handle, fr_value_box_t const *key) |
Retrieve an entry from the cache. More... | |
typedef void(* | cache_entry_free_t) (rlm_cache_entry_t *c) |
Free a cache entry. More... | |
typedef cache_status_t(* | cache_entry_insert_t) (rlm_cache_config_t const *config, void *instance, request_t *request, void *handle, rlm_cache_entry_t const *c) |
Insert an entry into the cache. More... | |
typedef cache_status_t(* | cache_entry_set_ttl_t) (rlm_cache_config_t const *config, void *instance, request_t *request, void *handle, rlm_cache_entry_t *c) |
Update the ttl of an entry in the cache. More... | |
typedef int(* | cache_reconnect_t) (rlm_cache_handle_t **handle, rlm_cache_config_t const *config, void *instance, request_t *request) |
Reconnect a previously acquired handle. More... | |
typedef void(* | cache_release_t) (rlm_cache_config_t const *config, void *instance, request_t *request, rlm_cache_handle_t *handle) |
Release a previously acquired handle. More... | |
typedef struct rlm_cache_driver_s | rlm_cache_driver_t |
typedef void | rlm_cache_handle_t |
Enumerations | |
enum | cache_status_t { CACHE_RECONNECT = -2 , CACHE_ERROR = -1 , CACHE_OK = 0 , CACHE_MISS = 1 } |
struct rlm_cache_config_t |
Configuration for the rlm_cache module.
This is separate from the rlm_cache_t struct, to limit driver's visibility of rlm_cache instance data.
Definition at line 51 of file rlm_cache.h.
Data Fields | ||
---|---|---|
int32_t | epoch | Time after which entries are considered valid. |
uint32_t | max_entries | Maximum entries allowed. |
bool | stats | Generate statistics. |
fr_time_delta_t | ttl | How long an entry is valid for. |
struct rlm_cache_driver_s |
Definition at line 257 of file rlm_cache.h.
Data Fields | ||
---|---|---|
cache_acquire_t | acquire | (optional) Acquire exclusive access to a resource used to retrieve the cache entry. |
cache_entry_alloc_t | alloc | (optional) Allocate a new entry. |
module_t | common | Common fields for all loadable modules. |
cache_entry_count_t | count | (Optional) Number of entries currently in the cache. |
cache_entry_expire_t | expire | Remove an old entry. |
cache_entry_find_t | find | Retrieve an existing cache entry. |
cache_entry_free_t | free | (optional) Free memory used by an entry. |
cache_entry_insert_t | insert | Add a new entry. |
call_env_parse_pair_t | key_parse |
(optional) custom key parser. Allows the driver to have complete control over how the key is parsed. If not provided, the default key parser will be used. data will be set to the submodule's instance data, NOT the rlm_cache_t. |
cache_reconnect_t | reconnect | (optional) Re-initialise resource. |
cache_release_t | release | (optional) Release access to resource acquired with acquire callback. |
cache_entry_set_ttl_t | set_ttl | (Optional) Update the TTL of an entry. |
struct rlm_cache_entry_t |
Definition at line 72 of file rlm_cache.h.
Data Fields | ||
---|---|---|
fr_unix_time_t | created | When the entry was created. |
fr_unix_time_t | expires | When the entry expires. |
long long int | hits | How many times the entry has been retrieved. |
fr_value_box_t | key | Key used to identify entry. |
map_list_t | maps | Head of the maps list. |
struct rlm_cache_t |
Definition at line 65 of file rlm_cache.h.
Data Fields | ||
---|---|---|
rlm_cache_config_t | config | Must come first because of icky hacks. |
rlm_cache_driver_t const * | driver | Driver's exported interface. |
module_instance_t * | driver_submodule | Driver's instance data. |
#define MAX_ATTRMAP 128 |
Definition at line 37 of file rlm_cache.h.
typedef int(* cache_acquire_t) (void **handle, rlm_cache_config_t const *config, void *instance, request_t *request) |
Acquire a handle to access the cache.
[out] | handle | Where to write pointer to handle to access the cache with. |
[in] | config | for this instance of the rlm_cache module. |
[in] | instance | Driver specific instance data. |
[in] | request | The current request. |
Definition at line 226 of file rlm_cache.h.
typedef rlm_cache_entry_t*(* cache_entry_alloc_t) (rlm_cache_config_t const *config, void *instance, request_t *request) |
Allocate a new cache entry.
Definition at line 84 of file rlm_cache.h.
typedef uint64_t(* cache_entry_count_t) (rlm_cache_config_t const *config, void *instance, request_t *request, void *handle) |
Get the number of entries in the cache.
[in] | config | for this instance of the rlm_cache module. |
[in] | instance | Driver specific instance data. |
[in] | request | The current request. |
handle | the driver gave us when we called cache_acquire_t, or NULL if no cache_acquire_t callback was provided. |
Definition at line 210 of file rlm_cache.h.
typedef cache_status_t(* cache_entry_expire_t) (rlm_cache_config_t const *config, void *instance, request_t *request, void *handle, fr_value_box_t const *key) |
Remove an entry from the cache.
[in] | config | for this instance of the rlm_cache module. |
[in] | instance | Driver specific instance data. |
[in] | request | The current request. |
[in] | handle | the driver gave us when we called cache_acquire_t, or NULL if no cache_acquire_t callback was provided. |
[in] | key | of entry to expire. |
Definition at line 172 of file rlm_cache.h.
typedef cache_status_t(* cache_entry_find_t) (rlm_cache_entry_t **out, rlm_cache_config_t const *config, void *instance, request_t *request, void *handle, fr_value_box_t const *key) |
Retrieve an entry from the cache.
If a cache entry is found, but the cache entry needs to be deserialized, the driver is expected to allocate an appropriately sized rlm_cache_entry_t, perform the deserialisation, and write a pointer to the new entry to out, returning CACHE_OK.
If the rlm_cache_handle_t is inviable, the driver should return CACHE_RECONNECT, to have it reinitialised/reconnected.
[out] | out | Where to write a pointer to the retrieved entry (if there was one). |
[in] | config | for this instance of the rlm_cache module. |
[in] | instance | Driver specific instance data. |
[in] | request | The current request. |
[in] | handle | the driver gave us when we called cache_acquire_t, or NULL if no cache_acquire_t callback was provided. |
[in] | key | to use to lookup cache entry |
Definition at line 121 of file rlm_cache.h.
typedef void(* cache_entry_free_t) (rlm_cache_entry_t *c) |
Free a cache entry.
If the driver does not need to keep a local copy of the cache entry, it should provide a callback to free the memory previously allocated for the cache entry by cache_entry_find_t or by rlm_cache.
c | entry to free. |
Definition at line 97 of file rlm_cache.h.
typedef cache_status_t(* cache_entry_insert_t) (rlm_cache_config_t const *config, void *instance, request_t *request, void *handle, rlm_cache_entry_t const *c) |
Insert an entry into the cache.
Serialize (if necessary) the entry passed to us, and write it to the cache with the key c->key.
The cache entry should not be freed by the driver, irrespective of success or failure. If the entry needs to be freed after insertion because a local copy should not be kept, the driver should provide a cache_entry_free_t callback.
If the rlm_cache_handle_t is inviable, the driver should return CACHE_RECONNECT, to have it reinitialised/reconnected.
config | for this instance of the rlm_cache module. |
instance | Driver specific instance data. |
request | The current request. |
handle | the driver gave us when we called cache_acquire_t, or NULL if no cache_acquire_t callback was provided. |
c | to insert. |
Definition at line 152 of file rlm_cache.h.
typedef cache_status_t(* cache_entry_set_ttl_t) (rlm_cache_config_t const *config, void *instance, request_t *request, void *handle, rlm_cache_entry_t *c) |
Update the ttl of an entry in the cache.
If the rlm_cache_handle_t is inviable, the driver should return CACHE_RECONNECT, to have it reinitialised/reconnected.
[in] | config | for this instance of the rlm_cache module. |
[in] | instance | Driver specific instance data. |
[in] | request | The current request. |
[in] | handle | the driver gave us when we called cache_acquire_t, or NULL if no cache_acquire_t callback was provided. |
[in] | c | to update the TTL of. c->ttl will have been set to the new value. |
Definition at line 195 of file rlm_cache.h.
typedef int(* cache_reconnect_t) (rlm_cache_handle_t **handle, rlm_cache_config_t const *config, void *instance, request_t *request) |
Reconnect a previously acquired handle.
[in,out] | handle | to reinitialise/reconnect. |
[in] | config | for this instance of the rlm_cache module. |
[in] | instance | Driver specific instance data. |
[in] | request | The current request. |
Definition at line 254 of file rlm_cache.h.
typedef void(* cache_release_t) (rlm_cache_config_t const *config, void *instance, request_t *request, rlm_cache_handle_t *handle) |
Release a previously acquired handle.
[in] | config | for this instance of the rlm_cache module. |
[in] | instance | Driver specific instance data. |
[in] | request | The current request. |
[in] | handle | to release. |
Definition at line 238 of file rlm_cache.h.
typedef struct rlm_cache_driver_s rlm_cache_driver_t |
Definition at line 1 of file rlm_cache.h.
typedef void rlm_cache_handle_t |
Definition at line 35 of file rlm_cache.h.
enum cache_status_t |
Enumerator | |
---|---|
CACHE_RECONNECT | Handle needs to be reconnected. |
CACHE_ERROR | Fatal error. |
CACHE_OK | Cache entry found/updated. |
CACHE_MISS | Cache entry notfound. |
Definition at line 39 of file rlm_cache.h.