The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Data Structures | Functions | Variables
global_lib.c File Reference
#include <freeradius-devel/server/global_lib.h>
#include <freeradius-devel/server/main_config.h>
#include <freeradius-devel/util/atexit.h>
+ Include dependency graph for global_lib.c:

Go to the source code of this file.

Data Structures

struct  global_lib_inst_t
 Structure to track use of libraries. More...
 
struct  global_lib_list_t
 

Functions

static int8_t _lib_cmp (void const *one, void const *two)
 Compare two fr_lib_t. More...
 
static int _lib_list_free_atexit (UNUSED void *uctx)
 Free global list of libraries. More...
 
int global_lib_auto_instantiate (UNUSED dl_t const *module, void *symbol, UNUSED void *user_ctx)
 Callback for creation of "lib" symbols. More...
 
void global_lib_autofree (UNUSED dl_t const *module, void *symbol, UNUSED void *user_ctx)
 Callback for freeing of "lib" symbols. More...
 
int global_lib_init (void)
 Initialise the global list of external libraries. More...
 
int global_lib_instantiate (void)
 Walk the tree of libraries and instantiate any which are pending. More...
 
static int lib_auto_instantiate (global_lib_autoinst_t *const *to_init)
 Instantiate a list of libraries. More...
 
static void lib_autofree (global_lib_autoinst_t *const *to_free)
 Run free callbacks for external libraries no-longer in use. More...
 
static int lib_init_call (global_lib_inst_t *lib)
 Parse the global config section for a library and call its init function. More...
 

Variables

global_lib_autoinst_t const global_lib_terminator = { .name = NULL }
 
static global_lib_list_tlib_list
 

Data Structure Documentation

◆ global_lib_inst_t

struct global_lib_inst_t

Structure to track use of libraries.

Definition at line 46 of file global_lib.c.

+ Collaboration diagram for global_lib_inst_t:
Data Fields
global_lib_autoinst_t const * autoinit Autoinit structure used to manage this library.
fr_rb_node_t entry Entry in tree of libraries.
bool initialised Has the init callback been run for this library.
uint32_t instance_count Number of current uses of this library.

◆ global_lib_list_t

struct global_lib_list_t

Definition at line 37 of file global_lib.c.

+ Collaboration diagram for global_lib_list_t:
Data Fields
fr_rb_tree_t libs

Function Documentation

◆ _lib_cmp()

static int8_t _lib_cmp ( void const *  one,
void const *  two 
)
static

Compare two fr_lib_t.

Definition at line 182 of file global_lib.c.

+ Here is the caller graph for this function:

◆ _lib_list_free_atexit()

static int _lib_list_free_atexit ( UNUSED void *  uctx)
static

Free global list of libraries.

Called as an atexit function

Definition at line 194 of file global_lib.c.

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

◆ global_lib_auto_instantiate()

int global_lib_auto_instantiate ( UNUSED dl_t const *  module,
void *  symbol,
UNUSED void *  user_ctx 
)

Callback for creation of "lib" symbols.

Definition at line 137 of file global_lib.c.

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

◆ global_lib_autofree()

void global_lib_autofree ( UNUSED dl_t const *  module,
void *  symbol,
UNUSED void *  user_ctx 
)

Callback for freeing of "lib" symbols.

Definition at line 174 of file global_lib.c.

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

◆ global_lib_init()

int global_lib_init ( void  )

Initialise the global list of external libraries.

Definition at line 204 of file global_lib.c.

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

◆ global_lib_instantiate()

int global_lib_instantiate ( void  )

Walk the tree of libraries and instantiate any which are pending.

Definition at line 218 of file global_lib.c.

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

◆ lib_auto_instantiate()

static int lib_auto_instantiate ( global_lib_autoinst_t *const *  to_init)
static

Instantiate a list of libraries.

Parameters
to_initArray of autoinit structures detailing libraries to initialise
Returns
  • 0 on success
  • -1 on failure

Definition at line 98 of file global_lib.c.

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

◆ lib_autofree()

static void lib_autofree ( global_lib_autoinst_t *const *  to_free)
static

Run free callbacks for external libraries no-longer in use.

Parameters
[in]to_freeArray of autoinit structures detailing libraries to free

Definition at line 148 of file global_lib.c.

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

◆ lib_init_call()

static int lib_init_call ( global_lib_inst_t lib)
static

Parse the global config section for a library and call its init function.

Parameters
[in]libto configure and initialise
Returns
  • 0 on success
  • -1 on failure

Definition at line 60 of file global_lib.c.

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

Variable Documentation

◆ global_lib_terminator

global_lib_autoinst_t const global_lib_terminator = { .name = NULL }

Definition at line 32 of file global_lib.c.

◆ lib_list

global_lib_list_t* lib_list
static

Definition at line 41 of file global_lib.c.