2 * collectd - src/configfile.h
3 * Copyright (C) 2005 Florian octo Forster
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 * Florian octo Forster <octo at verplant.org>
28 * Remove a registered plugin from the internal data structures.
31 * `type' Name of the plugin (must be the same as passed to
34 void cf_unregister (char *type);
38 * `cf_register' is called by plugins that wish to receive config keys. The
39 * plugin will then receive all keys it registered for if they're found in a
40 * `<Moudle $type>' section.
43 * `type' Name of the plugin (must be the same as passed to
45 * `callback' Pointer to the callback function. The callback must return zero
46 * upon success, a value smaller than zero if it doesn't know how
47 * to handle the `key' passed to it (the first argument) or a
48 * value greater than zero if it knows how to handle the key but
50 * `keys' Array of key values this plugin wished to receive. The last
51 * element must be a NULL-pointer.
52 * `keys_num' Number of elements in the array (not counting the last NULL-
56 * `cf_unregister' will be called for `type' to make sure only one record
57 * exists for each `type' at any time. This means that `cf_register' may be
58 * called multiple times, but only the last call will have an effect.
60 void cf_register (char *type,
61 int (*callback) (char *, char *),
62 char **keys, int keys_num);
66 * `cf_read' reads the config file `filename' and dispatches the read
67 * information to functions/variables. Most important: Is calls `plugin_load'
68 * to load specific plugins, depending on the current mode of operation.
71 * Returns zero upon success and non-zero otherwise. A error-message will have
72 * been printed in this case.
74 int cf_read (char *filename);
76 #endif /* defined(CONFIGFILE_H) */