The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Data Structures | Typedefs | Functions
module_rlm.h File Reference

Defines functions for rlm module (re-)initialisation. More...

#include <freeradius-devel/server/module.h>
#include <freeradius-devel/server/virtual_servers.h>
+ Include dependency graph for module_rlm.h:

Go to the source code of this file.

Data Structures

struct  module_method_call_t
 The output of module_rlm_by_name_and_method. More...
 
struct  module_rlm_instance_s
 
struct  module_rlm_s
 
struct  module_rlm_xlat_t
 An xlat function registered to a module. More...
 

Typedefs

typedef struct module_rlm_instance_s module_rlm_instance_t
 
typedef struct module_rlm_s module_rlm_t
 

Functions

static module_rlm_tmodule_rlm_from_module (module_t *module)
 

Debug functions

void module_rlm_list_debug (void)
 Print information on all loaded modules. More...
 

Convenience wrappers around other internal APIs to make them easier to instantiate with modules

fr_pool_tmodule_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_tmodule_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...
 
xlat_tmodule_rlm_xlat_register (TALLOC_CTX *ctx, module_inst_ctx_t const *mctx, char const *name, xlat_func_t func, fr_type_t return_type))
 

Helper functions

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...
 

Module and module thread lookup

fr_slen_t module_rlm_by_name_and_method (TALLOC_CTX *ctx, module_method_call_t *mmc_out, virtual_server_t const *vs, section_name_t const *section, fr_sbuff_t *name, tmpl_rules_t const *t_rules))
 Find an existing module instance and verify it implements the specified method. More...
 
module_instance_tmodule_rlm_dynamic_by_name (module_instance_t const *parent, char const *name)
 
module_instance_tmodule_rlm_static_by_name (module_instance_t const *parent, char const *name)
 
CONF_SECTIONmodule_rlm_virtual_by_name (char const *name)
 

Support functions

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 and module thread initialisation and instantiation

int modules_rlm_bootstrap (CONF_SECTION *root)
 Bootstrap modules and virtual modules. 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...
 

Global initialisation and free functions

int modules_rlm_free (void)
 Cleanup all global structures. More...
 
int modules_rlm_init (void)
 Initialise the module list structure. More...
 

Detailed Description

Defines functions for rlm module (re-)initialisation.

Id
c0d00984ebc7cc1959e036ae89c057e104683e80

Definition in file module_rlm.h.


Data Structure Documentation

◆ module_method_call_t

struct module_method_call_t

The output of module_rlm_by_name_and_method.

Everything needed to call a module method.

Definition at line 62 of file module_rlm.h.

+ Collaboration diagram for module_method_call_t:
Data Fields
section_name_t asked The actual <name1>.

<name2> used for the module call. This was either the override the user specified, or the name of the section.

tmpl_t * key Dynamic key, only set for dynamic modules.
module_instance_t * mi The process modules also push module calls onto the stack for execution.

So we need to use the common type here.

module_method_binding_t mmb Method we're calling.
module_rlm_t const * rlm Cached module_rlm_t.

◆ module_rlm_instance_s

struct module_rlm_instance_s

Definition at line 43 of file module_rlm.h.

+ Collaboration diagram for module_rlm_instance_s:
Data Fields
fr_dlist_head_t xlats xlats registered to this module instance.

This is used by the redundant/loadbalance xlats to register versions of the xlats exported by the module instances.

◆ module_rlm_s

struct module_rlm_s

Definition at line 38 of file module_rlm.h.

+ Collaboration diagram for module_rlm_s:
Data Fields
module_t common Common fields presented by all modules.
module_method_group_t method_group named methods

◆ module_rlm_xlat_t

struct module_rlm_xlat_t

An xlat function registered to a module.

Definition at line 52 of file module_rlm.h.

+ Collaboration diagram for module_rlm_xlat_t:
Data Fields
fr_dlist_t entry Entry in a linked list of registered xlats.
module_instance_t * mi The module instance that registered the xlat.
xlat_t const * xlat The xlat function.

Typedef Documentation

◆ module_rlm_instance_t

Definition at line 1 of file module_rlm.h.

◆ module_rlm_t

typedef struct module_rlm_s module_rlm_t

Definition at line 1 of file module_rlm.h.

Function Documentation

◆ module_rlm_by_name_and_method()

fr_slen_t module_rlm_by_name_and_method ( TALLOC_CTX *  ctx,
module_method_call_t mmc_out,
virtual_server_t const *  vs,
section_name_t const *  section,
fr_sbuff_t name,
tmpl_rules_t const *  t_rules 
)

Find an existing module instance and verify it implements the specified method.

Extracts the method from the module name where the format is

<module>[.<method1>[.<method2>]] 

and ensures the module implements the specified method.

Parameters
[in]ctxto allocate the dynamic module key tmpl from.
[out]mmc_outthe result from resolving the module method, plus the key tmpl for dynamic modules. This is not allocated from the ctx to save the runtime dereference.
[in]vsVirtual server to search for alternative module names in.
[in]sectionSection name containing the module call.
[in]nameThe module method call i.e. module[<key>][.<method>]
[in]t_rulesfor resolving the dynamic module key.
Returns
  • The module instance on success.
  • NULL on not found

If the module exists but the method doesn't exist, then method is set to NULL.

Definition at line 569 of file module_rlm.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ module_rlm_connection_pool_init()

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.

See also
fr_pool_init
Parameters
[in]modulesection.
[in]opaquedata pointer to pass to callbacks.
[in]cCallback to create new connections.
[in]aCallback to check the status of connections.
[in]log_prefixoverride, if NULL will be set automatically from the module CONF_SECTION.
[in]trigger_prefixif NULL will be set automatically from the module CONF_SECTION.
[in]trigger_argsto make available in any triggers executed by the connection pool.
Returns
  • New connection pool.
  • NULL on error.

Definition at line 308 of file module_rlm.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ module_rlm_dynamic_by_name()

module_instance_t* module_rlm_dynamic_by_name ( module_instance_t const *  parent,
char const *  name 
)

Definition at line 823 of file module_rlm.c.

+ Here is the call graph for this function:

◆ module_rlm_exfile_init()

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.

See also
exfile_init
Parameters
[in]ctxto bind the lifetime of the exfile handle to.
[in]modulesection.
[in]max_entriesMax file descriptors to cache, and manage locks for.
[in]max_idleMaximum time a file descriptor can be idle before it's closed.
[in]lockingWhether or not to lock the files.
[in]trigger_prefixif NULL will be set automatically from the module CONF_SECTION.
[in]trigger_argsto make available in any triggers executed by the connection pool.
Returns
  • New connection pool.
  • NULL on error.

Definition at line 116 of file module_rlm.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ module_rlm_from_module()

static module_rlm_t* module_rlm_from_module ( module_t module)
inlinestatic

Definition at line 74 of file module_rlm.h.

+ Here is the caller graph for this function:

◆ module_rlm_list_debug()

void module_rlm_list_debug ( void  )

Print information on all loaded modules.

Definition at line 96 of file module_rlm.c.

+ Here is the call graph for this function:

◆ module_rlm_section_type_set()

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.

Parameters
[in]requestThe current request.
[in]type_dato use. Usually attr_auth_type.
[in]enumvEnumeration value of the specified type_da.

Definition at line 427 of file module_rlm.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ module_rlm_static_by_name()

module_instance_t* module_rlm_static_by_name ( module_instance_t const *  parent,
char const *  name 
)

Definition at line 828 of file module_rlm.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ module_rlm_submodule_parse()

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 950 of file module_rlm.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ module_rlm_virtual_by_name()

CONF_SECTION* module_rlm_virtual_by_name ( char const *  name)

Definition at line 810 of file module_rlm.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ module_rlm_xlat_register()

xlat_t* module_rlm_xlat_register ( TALLOC_CTX *  ctx,
module_inst_ctx_t const *  mctx,
char const *  name,
xlat_func_t  func,
fr_type_t  return_type 
)

Definition at line 257 of file module_rlm.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ modules_rlm_bootstrap()

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.

Parameters
[in]rootof the server configuration.
Returns
  • 0 if all modules were bootstrapped successfully.
  • -1 if a module/virtual module failed to bootstrap.

Definition at line 1214 of file module_rlm.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ modules_rlm_free()

int modules_rlm_free ( void  )

Cleanup all global structures.

Automatically called on exit.

Definition at line 1352 of file module_rlm.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ modules_rlm_init()

int modules_rlm_init ( void  )

Initialise the module list structure.

Definition at line 1370 of file module_rlm.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ modules_rlm_instantiate()

int modules_rlm_instantiate ( void  )

Performs the instantiation phase for all backend modules.

Returns
  • 0 if all modules were instantiated successfully.
  • -1 if a module failed instantiation.

Definition at line 987 of file module_rlm.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ modules_rlm_thread_detach()

void modules_rlm_thread_detach ( void  )

Frees thread-specific data for all registered backend modules.

Definition at line 963 of file module_rlm.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ modules_rlm_thread_instantiate()

int modules_rlm_thread_instantiate ( TALLOC_CTX *  ctx,
fr_event_list_t el 
)

Allocates thread-specific data for all registered backend modules.

Parameters
[in]ctxTo allocate any thread-specific data in.
[in]elto register events.
Returns
  • 0 if all modules were instantiated successfully.
  • -1 if a module failed instantiation.

Definition at line 976 of file module_rlm.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function: