X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fplugin.h;h=e1303c76f2a5a86ccec668902a57db03e65fb597;hb=1f8b06df4f907658bea49c47dd4e8329fdbc8099;hp=e14376e599eca2d1609a89f324068853615513b3;hpb=3454b5396956be55d89e2dfe5f3a7627233aff4f;p=collectd.git diff --git a/src/plugin.h b/src/plugin.h index e14376e5..e1303c76 100644 --- a/src/plugin.h +++ b/src/plugin.h @@ -1,6 +1,6 @@ /** * collectd - src/plugin.h - * Copyright (C) 2005 Florian octo Forster + * Copyright (C) 2005,2006 Florian octo Forster * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -23,18 +23,98 @@ #ifndef PLUGIN_H #define PLUGIN_H +/* + * NAME + * plugin_set_dir + * + * DESCRIPTION + * Sets the current `plugindir' + * + * ARGUMENTS + * `dir' Path to the plugin directory + * + * NOTES + * If `dir' is NULL the compiled in default `PLUGINDIR' is used. + */ +void plugin_set_dir (const char *dir); + +/* + * NAME + * plugin_count + * + * DESCRIPTION + * trivial + * + * RETURN VALUE + * The number of currently loaded plugins + */ +int plugin_count (void); + +/* + * NAME + * plugin_exists + * + * DESCRIPTION + * trivial + * + * ARGUMENTS + * `type' Name of the plugin. + * + * RETURN VALUE + * Returns non-zero if a plugin with the name $type is found and zero + * otherwise. + */ +int plugin_exists (char *type); + +/* + * NAME + * plugin_load + * + * DESCRIPTION + * Searches the current `plugindir' (see `plugin_set_dir') for the plugin + * named $type and loads it. Afterwards the plugin's `module_register' + * function is called, which then calls `plugin_register' to register callback + * functions. + * + * ARGUMENTS + * `type' Name of the plugin to load. + * + * RETURN VALUE + * Returns zero upon success, a value greater than zero if no plugin was found + * and a value below zero if an error occurs. + * + * NOTES + * No attempt is made to re-load an already loaded module. + */ +int plugin_load (const char *type); + int plugin_load_all (char *dir); void plugin_init_all (void); void plugin_read_all (void); -bool plugin_exists (char *type); void plugin_register (char *type, void (*init) (void), void (*read) (void), void (*write) (char *, char *, char *)); -#ifdef HAVE_LIBRRD + +/* + * NAME + * plugin_write + * + * DESCRIPTION + * Searches the plugin for `type' in the plugin-list. If found, and a `write' + * function is registered, it's called. If either the plugin is not found or + * the plugin doesn't provide a `write' function this function will return + * without further notice. + * + * ARGUMENTS + * `host' Host(name) from which the data originates. + * `type' Name of the plugin. + * `inst' Instance (passed to the plugin's `write' function. + * `val' Values for the RRD files. Also passed to the plugin. + */ void plugin_write (char *host, char *type, char *inst, char *val); -#endif /* HAVE_LIBRRD */ + void plugin_submit (char *type, char *inst, char *val); #endif /* PLUGIN_H */