The FreeRADIUS server
$Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
Defines functions for rlm module (re-)initialisation. More...
#include <freeradius-devel/server/cf_file.h>
#include <freeradius-devel/server/global_lib.h>
#include <freeradius-devel/server/modpriv.h>
#include <freeradius-devel/server/module_rlm.h>
#include <freeradius-devel/server/pair.h>
#include <freeradius-devel/server/virtual_servers.h>
#include <freeradius-devel/util/atexit.h>
#include <freeradius-devel/unlang/xlat_func.h>
#include <freeradius-devel/unlang/xlat_redundant.h>
Go to the source code of this file.
Data Structures | |
struct | module_rlm_virtual_t |
Macros | |
#define | FIND_SIBLING_CF_KEY "find_sibling" |
#define | parent_name(_x) cf_section_name(cf_item_to_section(cf_parent(_x))) |
Functions | |
static int | _modules_rlm_free_atexit (UNUSED void *uctx) |
static int | module_rlm_bootstrap_virtual (CONF_SECTION *cs) |
Create a virtual module. More... | |
module_instance_t * | module_rlm_by_name (module_instance_t const *parent, char const *asked_name) |
module_instance_t * | module_rlm_by_name_and_method (module_method_t *method, call_env_method_t const **method_env, char const **name1, char const **name2, char const *name) |
Find an existing module instance and verify it implements the specified method. More... | |
CONF_SECTION * | module_rlm_by_name_virtual (char const *asked_name) |
fr_pool_t * | module_rlm_connection_pool_init (CONF_SECTION *module, void *opaque, fr_pool_connection_create_t c, fr_pool_connection_alive_t a, char const *log_prefix, char const *trigger_prefix, fr_pair_list_t *trigger_args) |
Initialise a module specific connection pool. More... | |
exfile_t * | module_rlm_exfile_init (TALLOC_CTX *ctx, CONF_SECTION *module, uint32_t max_entries, fr_time_delta_t max_idle, bool locking, char const *trigger_prefix, fr_pair_list_t *trigger_args) |
Initialise a module specific exfile handle. More... | |
bool | module_rlm_section_type_set (request_t *request, fr_dict_attr_t const *type_da, fr_dict_enum_value_t const *enumv) |
Set the next section type if it's not already set. More... | |
int | module_rlm_sibling_section_find (CONF_SECTION **out, CONF_SECTION *module, char const *name) |
Resolve polymorphic item's from a module's CONF_SECTION to a subsection in another module. More... | |
char const * | module_rlm_state_method_to_str (module_state_func_table_t const *table, module_method_t method, char const *def) |
module_method_t | module_rlm_state_str_to_method (module_state_func_table_t const *table, char const *name, module_method_t def) |
int | module_rlm_submodule_parse (TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, conf_parser_t const *rule) |
Generic conf_parser_t func for loading drivers. More... | |
module_thread_instance_t * | module_rlm_thread_by_data (void const *data) |
static int8_t | module_rlm_virtual_name_cmp (void const *one, void const *two) |
Compare virtual modules by name. More... | |
int | modules_rlm_bootstrap (CONF_SECTION *root) |
Bootstrap modules and virtual modules. More... | |
int | modules_rlm_free (void) |
Cleanup all global structures. More... | |
int | modules_rlm_init (void) |
Initialise the module list structure. More... | |
int | modules_rlm_instantiate (void) |
Performs the instantiation phase for all backend modules. More... | |
void | modules_rlm_thread_detach (void) |
Frees thread-specific data for all registered backend modules. More... | |
int | modules_rlm_thread_instantiate (TALLOC_CTX *ctx, fr_event_list_t *el) |
Allocates thread-specific data for all registered backend modules. More... | |
Variables | |
static fr_rb_tree_t * | module_rlm_virtual_name_tree |
Lookup virtual module by name. More... | |
static module_list_t * | rlm_modules |
Global module list for all backend modules. More... | |
char const * | section_type_value [MOD_COUNT] |
Defines functions for rlm module (re-)initialisation.
Definition in file module_rlm.c.
struct module_rlm_virtual_t |
Definition at line 45 of file module_rlm.c.
Data Fields | ||
---|---|---|
bool | all_same | |
CONF_SECTION * | cs | CONF_SECTION where it is defined. |
char const * | name | module name |
fr_rb_node_t | name_node | Entry in the name tree. |
#define FIND_SIBLING_CF_KEY "find_sibling" |
#define parent_name | ( | _x | ) | cf_section_name(cf_item_to_section(cf_parent(_x))) |
|
static |
Definition at line 1148 of file module_rlm.c.
|
static |
Create a virtual module.
[in] | cs | that defines the virtual module. |
Definition at line 797 of file module_rlm.c.
module_instance_t* module_rlm_by_name | ( | module_instance_t const * | parent, |
char const * | asked_name | ||
) |
Definition at line 785 of file module_rlm.c.
module_instance_t* module_rlm_by_name_and_method | ( | module_method_t * | method, |
call_env_method_t const ** | method_env, | ||
char const ** | name1, | ||
char const ** | name2, | ||
char const * | name | ||
) |
Find an existing module instance and verify it implements the specified method.
Extracts the method from the module name where the format is
<module>.<method>
and ensures the module implements the specified method.
[out] | method | the method function we will call |
[out] | method_env | the module_call_env to evaluate when compiling the method. |
[out] | name1 | name1 of the method being called |
[out] | name2 | name2 of the method being called |
[in] | name | The name of the module we're attempting to find, possibly concatenated with the method |
If the module exists but the method doesn't exist, then method
is set to NULL.
Definition at line 433 of file module_rlm.c.
CONF_SECTION* module_rlm_by_name_virtual | ( | char const * | asked_name | ) |
Definition at line 767 of file module_rlm.c.
fr_pool_t* module_rlm_connection_pool_init | ( | CONF_SECTION * | module, |
void * | opaque, | ||
fr_pool_connection_create_t | c, | ||
fr_pool_connection_alive_t | a, | ||
char const * | log_prefix, | ||
char const * | trigger_prefix, | ||
fr_pair_list_t * | trigger_args | ||
) |
Initialise a module specific connection pool.
[in] | module | section. |
[in] | opaque | data pointer to pass to callbacks. |
[in] | c | Callback to create new connections. |
[in] | a | Callback to check the status of connections. |
[in] | log_prefix | override, if NULL will be set automatically from the module CONF_SECTION. |
[in] | trigger_prefix | if NULL will be set automatically from the module CONF_SECTION. |
[in] | trigger_args | to make available in any triggers executed by the connection pool. |
Definition at line 248 of file module_rlm.c.
exfile_t* module_rlm_exfile_init | ( | TALLOC_CTX * | ctx, |
CONF_SECTION * | module, | ||
uint32_t | max_entries, | ||
fr_time_delta_t | max_idle, | ||
bool | locking, | ||
char const * | trigger_prefix, | ||
fr_pair_list_t * | trigger_args | ||
) |
Initialise a module specific exfile handle.
[in] | ctx | to bind the lifetime of the exfile handle to. |
[in] | module | section. |
[in] | max_entries | Max file descriptors to cache, and manage locks for. |
[in] | max_idle | Maximum time a file descriptor can be idle before it's closed. |
[in] | locking | Whether or not to lock the files. |
[in] | trigger_prefix | if NULL will be set automatically from the module CONF_SECTION. |
[in] | trigger_args | to make available in any triggers executed by the connection pool. |
Definition at line 92 of file module_rlm.c.
bool module_rlm_section_type_set | ( | request_t * | request, |
fr_dict_attr_t const * | type_da, | ||
fr_dict_enum_value_t const * | enumv | ||
) |
Set the next section type if it's not already set.
[in] | request | The current request. |
[in] | type_da | to use. Usually attr_auth_type. |
[in] | enumv | Enumeration value of the specified type_da. |
Definition at line 397 of file module_rlm.c.
int module_rlm_sibling_section_find | ( | CONF_SECTION ** | out, |
CONF_SECTION * | module, | ||
char const * | name | ||
) |
Resolve polymorphic item's from a module's CONF_SECTION to a subsection in another module.
This allows certain module sections to reference module sections in other instances of the same module and share CONF_DATA associated with them.
example { data { ... } } example inst { data = example } *
[out] | out | where to write the pointer to a module's config section. May be NULL on success, indicating the config item was not found within the module CONF_SECTION or the chain of module references was followed and the module at the end of the chain did not a subsection. |
[in] | module | CONF_SECTION. |
[in] | name | of the polymorphic sub-section. |
Definition at line 144 of file module_rlm.c.
char const* module_rlm_state_method_to_str | ( | module_state_func_table_t const * | table, |
module_method_t | method, | ||
char const * | def | ||
) |
Definition at line 381 of file module_rlm.c.
module_method_t module_rlm_state_str_to_method | ( | module_state_func_table_t const * | table, |
char const * | name, | ||
module_method_t | def | ||
) |
int module_rlm_submodule_parse | ( | TALLOC_CTX * | ctx, |
void * | out, | ||
void * | parent, | ||
CONF_ITEM * | ci, | ||
conf_parser_t const * | rule | ||
) |
Generic conf_parser_t func for loading drivers.
Definition at line 913 of file module_rlm.c.
module_thread_instance_t* module_rlm_thread_by_data | ( | void const * | data | ) |
Definition at line 780 of file module_rlm.c.
|
static |
Compare virtual modules by name.
Definition at line 54 of file module_rlm.c.
int modules_rlm_bootstrap | ( | CONF_SECTION * | root | ) |
Bootstrap modules and virtual modules.
Parse the module config sections, and load and call each module's init() function.
[in] | root | of the server configuration. |
Definition at line 964 of file module_rlm.c.
int modules_rlm_free | ( | void | ) |
Cleanup all global structures.
Automatically called on exit.
Definition at line 1138 of file module_rlm.c.
int modules_rlm_init | ( | void | ) |
Initialise the module list structure.
Definition at line 1156 of file module_rlm.c.
int modules_rlm_instantiate | ( | void | ) |
Performs the instantiation phase for all backend modules.
Definition at line 950 of file module_rlm.c.
void modules_rlm_thread_detach | ( | void | ) |
Frees thread-specific data for all registered backend modules.
Definition at line 926 of file module_rlm.c.
int modules_rlm_thread_instantiate | ( | TALLOC_CTX * | ctx, |
fr_event_list_t * | el | ||
) |
Allocates thread-specific data for all registered backend modules.
[in] | ctx | To allocate any thread-specific data in. |
[in] | el | to register events. |
Definition at line 939 of file module_rlm.c.
|
static |
Lookup virtual module by name.
Definition at line 43 of file module_rlm.c.
|
static |
Global module list for all backend modules.
Definition at line 75 of file module_rlm.c.
char const* section_type_value[MOD_COUNT] |
Definition at line 64 of file module_rlm.c.