All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Functions
Turbulence Module: API used to load modules and invoke handlers provided by them.

Functions

void turbulence_module_cleanup (TurbulenceCtx *ctx)
 
axl_bool turbulence_module_exists (TurbulenceModule *module)
 
void turbulence_module_free (TurbulenceModule *module)
 
ModCloseFunc turbulence_module_get_close (TurbulenceModule *module)
 
ModInitFunc turbulence_module_get_init (TurbulenceModule *module)
 
const char * turbulence_module_name (TurbulenceModule *module)
 
axl_bool turbulence_module_notify (TurbulenceCtx *ctx, TurbulenceModHandler handler, axlPointer data, axlPointer data2, axlPointer data3)
 
void turbulence_module_notify_close (TurbulenceCtx *ctx)
 
void turbulence_module_notify_reload_conf (TurbulenceCtx *ctx)
 
TurbulenceModuleturbulence_module_open (TurbulenceCtx *ctx, const char *module)
 
TurbulenceModuleturbulence_module_open_and_register (TurbulenceCtx *ctx, const char *location)
 
axl_bool turbulence_module_register (TurbulenceModule *module)
 
void turbulence_module_skip_unmap (TurbulenceCtx *ctx, const char *mod_name)
 
void turbulence_module_unload (TurbulenceCtx *ctx, const char *module)
 
void turbulence_module_unregister (TurbulenceModule *module)
 

Detailed Description

Function Documentation

void turbulence_module_cleanup ( TurbulenceCtx ctx)

Cleans the module, releasing all resources and unloading all modules.

References msg.

Referenced by turbulence_ctx_free().

axl_bool turbulence_module_exists ( TurbulenceModule module)

Allows to check if there is another module already registered with the same name.

Referenced by turbulence_module_open_and_register().

void turbulence_module_free ( TurbulenceModule module)

Closes and free the module reference.

Parameters
moduleThe module reference to free and close.

References msg.

Referenced by turbulence_module_open(), and turbulence_module_open_and_register().

ModCloseFunc turbulence_module_get_close ( TurbulenceModule module)

Allows to get the close function for the module reference provided.

Parameters
moduleThe module that is being requested to return the close function.
Returns
A refernce to the close function or NULL if the function doesn't have a close function defined (which is possible and allowed).
ModInitFunc turbulence_module_get_init ( TurbulenceModule module)

Allows to get the init function for the module reference provided.

Parameters
moduleThe module that is being requested to return the init function.
Returns
A reference to the init function or NULL if the function doesn't have a init function defined (which is possible and allowed).

Referenced by turbulence_module_open_and_register().

const char* turbulence_module_name ( TurbulenceModule module)

Allows to get the module name.

Parameters
moduleThe module to get the name from.
Returns
module name or NULL if it fails.

Referenced by turbulence_module_open_and_register().

axl_bool turbulence_module_notify ( TurbulenceCtx ctx,
TurbulenceModHandler  handler,
axlPointer  data,
axlPointer  data2,
axlPointer  data3 
)

Allows to do a handler notification on all registered modules.

Parameters
ctxThe context where the notification will take place.
handlerThe handler to be called.
dataOptional data to be passed to the handler. This pointer is handler especific.
data2Second optional data to be passed to the handler. This pointer is handler especific.
data3Third optional data to be passed to the handler. This pointer is handler especific.
Returns
Returns axl_true if all handlers executed also returned axl_true. Those handler that have no return value will cause the function to always return axl_true.

References msg, TBC_CLOSE_HANDLER, TBC_INIT_HANDLER, TBC_PPATH_SELECTED_HANDLER, TBC_RELOAD_HANDLER, and wrn.

Referenced by turbulence_module_notify_close(), and turbulence_module_notify_reload_conf().

void turbulence_module_notify_close ( TurbulenceCtx ctx)

Send a module close notification to all modules registered without unloading module code.

References TBC_CLOSE_HANDLER, and turbulence_module_notify().

Referenced by turbulence_exit().

void turbulence_module_notify_reload_conf ( TurbulenceCtx ctx)

Allows to notify all modules loaded, that implements the ModReconfFunc, to reload its configuration data.

References TBC_RELOAD_HANDLER, and turbulence_module_notify().

Referenced by turbulence_reload_config().

TurbulenceModule* turbulence_module_open ( TurbulenceCtx ctx,
const char *  module 
)

Loads a turbulence module, from the provided path.

Parameters
ctxThe context where the module will be opened.
moduleThe module path to load.
Returns
A reference to the module loaded or NULL if it fails.

References error, msg, and turbulence_module_free().

Referenced by turbulence_module_open_and_register().

TurbulenceModule* turbulence_module_open_and_register ( TurbulenceCtx ctx,
const char *  location 
)

High level function that opens the module located at the provided location, checking if the module was registered, calling to init it, and then registering it if the init did not fail.

Parameters
ctxThe context where the load operation will take place.
locationThe location where the module is found.
Returns
A reference to the module loaded (TurbulenceModule) or NULL if it fails.

References msg, turbulence_mediator_push_event(), turbulence_module_exists(), turbulence_module_free(), turbulence_module_get_init(), turbulence_module_name(), turbulence_module_open(), turbulence_module_register(), and wrn.

Referenced by turbulence_run_load_modules_from_path().

axl_bool turbulence_module_register ( TurbulenceModule module)

Allows to register the module loaded to allow future access to it.

Parameters
moduleThe module being registered.
Returns
axl_false in the case module was not registered, otherwise axl_true when the module is registered.

References msg, and wrn.

Referenced by turbulence_module_open_and_register().

void turbulence_module_skip_unmap ( TurbulenceCtx ctx,
const char *  mod_name 
)

Allows to mark a module to not be unmapped when module is closed.

Parameters
ctxThe context that will be configured.
mod_nameThe module name to skip unmapping.
void turbulence_module_unload ( TurbulenceCtx ctx,
const char *  module 
)

Allows to close the provided module, unloading from memory and removing all registration references.

The function do not perform any module space notification. The function makes use of the unload function implemented by modules (if defined).

Parameters
ctxThe context where the module must be removed.
moduleThe module name to be unloaded.
void turbulence_module_unregister ( TurbulenceModule module)

Unregister the module provided from the list of modules loaded.

The function do not close the module (turbulence_module_free). This is required to be done by the caller.

Parameters
moduleThe module to unregister.