plugin-common-prv

Name

plugin-common-prv -- 

Synopsis



plugin_generic_t* plugin_search_by_name     (const char *name);
int         plugin_load_from_dir            (const char *dirname,
                                             int argc,
                                             char **argv,
                                             int (*subscribe) (plugin_container_t *p),
                                             void (*unsubscribe) (plugin_container_t *pc));
int         plugin_add                      (plugin_container_t *pc,
                                             struct list_head *h,
                                             const char *infos);
void        plugin_del                      (plugin_container_t *pc);
void        plugin_print_stats              (plugin_container_t *pc);
void        plugins_print_stats             (void);
void        plugins_print_opts              (const char *dirname);
int         plugin_get_highest_id           (void);
#define     plugin_run                      (pc, type, member, arg...)
#define     plugin_run_with_return_value    (pc, type, member, ret, arg...)

Description

Details

plugin_search_by_name ()

plugin_generic_t* plugin_search_by_name     (const char *name);

Search the whole plugin list (subscribed and unsubscribed), for a plugin with name name.

name :

Name of the plugin to search.

Returns :

the plugin on success, or NULL if the plugin doesn't exist.


plugin_load_from_dir ()

int         plugin_load_from_dir            (const char *dirname,
                                             int argc,
                                             char **argv,
                                             int (*subscribe) (plugin_container_t *p),
                                             void (*unsubscribe) (plugin_container_t *pc));

Load all plugins in directory 'dirname'. Each plugin have a subscribe and unsubscribe callback associated with it.

The plugins are loaded, but not active, until someone call plugin_subscribe() on one of the plugin. Which'll call subscribe in order to register the it.

argc and argv are passed to the plugin at initialization time for option handling.

dirname :

The directory to load the plugin from.

argc :

Argument count for the plugin.

argv :

Argument vector for the plugin.

subscribe :

Pointer to a callback function for plugin subscribtion.

unsubscribe :

Pointer to a callback function for plugin un-subscribtion.

Returns :

The number of loaded plugins on success, -1 on error.


plugin_add ()

int         plugin_add                      (plugin_container_t *pc,
                                             struct list_head *h,
                                             const char *infos);

This function add the plugin associated with pc to the linked list specified by h. If this container is already used somewhere else, a copy is made, because container doesn't share information).

pc :

Pointer to a plugin container

h :

Pointer to a linked list

infos :

Specific informations to associate with the container.

Returns :

0 on success or -1 if an error occured.


plugin_del ()

void        plugin_del                      (plugin_container_t *pc);

Destroy pc.

pc :

Pointer to a plugin container.


plugin_print_stats ()

void        plugin_print_stats              (plugin_container_t *pc);

Print plugin stats for *this* plugin (associated with the container).

pc :

The plugin container to print stats from


plugins_print_stats ()

void        plugins_print_stats             (void);

Print available statistics for all plugins.


plugins_print_opts ()

void        plugins_print_opts              (const char *dirname);

dirname :


plugin_get_highest_id ()

int         plugin_get_highest_id           (void);

Returns :


plugin_run()

#define     plugin_run(pc, type, member, arg...)

pc :

type :

member :

arg... :


plugin_run_with_return_value()

#define     plugin_run_with_return_value(pc, type, member, ret, arg...)

pc :

type :

member :

ret :

arg... :