3.8. Modules

Generic module.

Enums

module_type enum

Module type.

Values:

  • MODULE_UNKNOWN -

    Invalid module type.

  • MODULE_PACKET -

    Packet capture module.

  • MODULE_LOG -

    Logging module type.

  • MODULE_ALERT -

    Alert backend module type.

  • MODULE_REGEXP -

    Regular expression module type.

  • MODULE_EXTENSION -

    Abstract extension module type.

Functions

struct module * module_load(const char * module_name, struct parameters * args)

Load a module given its name. It is not needed to call module_addref() on the result as this is done before returning.

Return
The loaded module structure or NULL in case of an error.

void module_addref(struct module * module)

Keep the module. Must match with a call to module_release() otherwise the module will not be able to be removed correctly when unused.

void module_release(struct module * module)

Decrement the module ref count and unload the module if needed.

void module_set_path(const char * path, bool c)

Set the path used to load haka modules. This path must be in the form: path/to/modules/*;another/path/*

bool module_set_default_path()

Set the module path using the env variable HAKA_PATH.

void module_add_path(const char * path, bool c)

Add a path to the Lua module search path.

const char * module_get_path(bool c)

Get the modules search path.

class module

Module declaration object.

Public Members

enum module_type type

Module type

const char * name

Module name.

const char * description

Module description.

const char * author

Module author.

int api_version

API version (use HAKA_API_VERSION).

int(* init)(struct parameters *args)

Initialize the module. This function is called by the application.

Return
Non zero in case of an error. In this case the module will be unloaded but cleanup is not going to be called.

void(* cleanup)()

Cleanup the module. This function is called by the application when the module is unloaded.

Private Members

void * handle

atomic_t ref