26 RCSIDH(dl_module_h,
"$Id: 619b6a5e9bb7e92b75c07caefef4428b865be05f $")
29 # error FreeRADIUS needs a working dlopen()
34 #include <freeradius-devel/server/cf_parse.h>
35 #include <freeradius-devel/util/dl.h>
36 #include <freeradius-devel/util/rb.h>
37 #include <freeradius-devel/util/version.h>
44 # error _CONST can only be defined in the local header
46 #ifndef _DL_MODULE_PRIVATE
53 # define DL_EXTENSION ".dylib"
55 # define DL_EXTENSION ".dll"
57 # define DL_EXTENSION ".so"
65 #define MODULE_MAGIC_INIT RADIUSD_MAGIC_NUMBER
78 #define DL_PRIORITY_DICT 30
79 #define DL_PRIORITY_DICT_ATTR 29
80 #define DL_PRIORITY_DICT_ENUM 28
81 #define DL_PRIORITY_LIB 20
82 #define DL_PRIORITY_BOOTSTRAP 10
119 #define DL_MODULE_COMMON \
124 char const *inst_type; \
125 conf_parser_t const *config; \
126 dl_module_onload_t onload; \
127 dl_module_unload_t unload; \
128 module_detach_t detach; \
A section grouping multiple CONF_PAIR.
static dl_module_loader_t * dl_module_loader
Wrapper struct around dl_loader_t.
char const * dl_module_search_path(void)
dl_t *_CONST dl
Dynamic loader handle.
char const * dl_module_inst_name_from_conf(CONF_SECTION *conf)
Avoid boilerplate when setting the module instance name.
dl_module_t const *_CONST parent
of this module.
dl_module_type_t _CONST type
of this module.
@ DL_MODULE_TYPE_PROTO
Protocol module.
@ DL_MODULE_TYPE_SUBMODULE
Driver (or method in the case of EAP)
@ DL_MODULE_TYPE_MODULE
Standard loadable module.
@ DL_MODULE_TYPE_PROCESS
protocol processor.
dl_module_t const *_CONST module
Module.
fr_table_num_sorted_t const dl_module_type_prefix[]
Name prefixes matching the types of loadable module.
bool _CONST detached
Whether the detach function has been called.
char const * dl_module_instance_name_by_data(void const *data)
Lookup instance name via instance data.
int dl_module_instance(TALLOC_CTX *ctx, dl_module_inst_t **out, dl_module_inst_t const *parent, dl_module_type_t type, char const *name, char const *inst_name)
Load a module and parse its CONF_SECTION in one operation.
int(* dl_module_onload_t)(void)
Callback to call when a module is first loaded.
char const *_CONST name
Instance name.
dl_module_inst_t const * dl_module_parent_instance(dl_module_inst_t const *child)
Lookup a module's parent.
void * dl_module_parent_data_by_child_data(void const *data)
A convenience function for returning a parent's private data.
void(* dl_module_unload_t)(void)
Callback when a module is destroyed.
void *_CONST data
Module instance's parsed configuration.
dl_module_inst_t const * dl_module_instance_by_data(void const *data)
Lookup a dl_module_inst_t via instance data.
dl_module_loader_t * dl_module_loader_init(char const *lib_dir)
Initialise structures needed by the dynamic linker.
void * dl_module_instance_symbol(dl_module_inst_t const *instance, char const *sym_name)
Retrieve a public symbol from a module using dlsym.
CONF_SECTION *_CONST conf
The module's global configuration (as opposed to the instance, configuration).
CONF_SECTION *_CONST conf
Module's instance configuration.
dl_module_common_t const *_CONST common
Symbol exported by the module, containing its public functions, name and behaviour control flags.
dl_loader_t * dl_loader_from_module_loader(dl_module_loader_t *dl_module_loader)
dl_module_t const * dl_module(dl_module_t const *parent, char const *name, dl_module_type_t type)
Load a module library using dlopen() or return a previously loaded module from the cache.
dl_module_inst_t const * inst
size_t dl_module_type_prefix_len
int(* module_detach_t)(module_detach_ctx_t const *inst)
Module detach callback.
dl_module_inst_t const * dl_module_instance_by_cs(CONF_SECTION const *cs)
Lookup a dl_module_inst_t via a config section.
int dl_module_conf_parse(dl_module_inst_t *dl_inst, CONF_SECTION *conf)
dl_module_inst_t const *_CONST parent
Parent module's instance (if any).
Fields common to all types of loadable modules.
eap_aka_sim_process_conf_t * inst
fr_aka_sim_id_type_t type
An element in a lexicographically sorted array of name to num mappings.
static size_t char ** out