+ memset (rf, '\0', sizeof (read_func_t));
+ rf->wait_time = interval_g;
+ rf->wait_left = 0;
+ rf->callback = callback;
+ rf->needs_read = DONE;
+
+ return (register_callback (&list_read, name, (void *) rf));
+} /* int plugin_register_read */
+
+int plugin_register_write (const char *name,
+ int (*callback) (const data_set_t *ds, const value_list_t *vl))
+{
+ return (register_callback (&list_write, name, (void *) callback));
+} /* int plugin_register_write */
+
+int plugin_register_flush (const char *name,
+ int (*callback) (const int timeout, const char *identifier))
+{
+ return (register_callback (&list_flush, name, (void *) callback));
+} /* int plugin_register_flush */
+
+int plugin_register_shutdown (char *name,
+ int (*callback) (void))
+{
+ return (register_callback (&list_shutdown, name, (void *) callback));
+} /* int plugin_register_shutdown */
+
+int plugin_register_data_set (const data_set_t *ds)
+{
+ data_set_t *ds_copy;
+ int i;
+
+ if ((data_sets != NULL)
+ && (c_avl_get (data_sets, ds->type, NULL) == 0))
+ {
+ NOTICE ("Replacing DS `%s' with another version.", ds->type);
+ plugin_unregister_data_set (ds->type);
+ }
+ else if (data_sets == NULL)
+ {
+ data_sets = c_avl_create ((int (*) (const void *, const void *)) strcmp);
+ if (data_sets == NULL)
+ return (-1);
+ }
+
+ ds_copy = (data_set_t *) malloc (sizeof (data_set_t));
+ if (ds_copy == NULL)
+ return (-1);
+ memcpy(ds_copy, ds, sizeof (data_set_t));
+
+ ds_copy->ds = (data_source_t *) malloc (sizeof (data_source_t)
+ * ds->ds_num);
+ if (ds_copy->ds == NULL)
+ {
+ free (ds_copy);
+ return (-1);
+ }
+
+ for (i = 0; i < ds->ds_num; i++)
+ memcpy (ds_copy->ds + i, ds->ds + i, sizeof (data_source_t));
+
+ return (c_avl_insert (data_sets, (void *) ds_copy->type, (void *) ds_copy));
+} /* int plugin_register_data_set */
+
+int plugin_register_log (char *name,
+ void (*callback) (int priority, const char *msg))
+{
+ return (register_callback (&list_log, name, (void *) callback));
+} /* int plugin_register_log */
+
+int plugin_register_notification (const char *name,
+ int (*callback) (const notification_t *notif))
+{
+ return (register_callback (&list_notification, name, (void *) callback));
+} /* int plugin_register_log */
+
+int plugin_unregister_config (const char *name)
+{
+ cf_unregister (name);
+ return (0);
+} /* int plugin_unregister_config */
+
+int plugin_unregister_complex_config (const char *name)
+{
+ cf_unregister_complex (name);
+ return (0);
+} /* int plugin_unregister_complex_config */
+
+int plugin_unregister_init (const char *name)
+{
+ return (plugin_unregister (list_init, name));
+}
+
+int plugin_unregister_read (const char *name)
+{
+ llentry_t *e;
+
+ e = llist_search (list_read, name);
+
+ if (e == NULL)
+ return (-1);
+
+ llist_remove (list_read, e);
+ free (e->value);
+ free (e->key);
+ llentry_destroy (e);
+
+ return (0);
+}
+
+int plugin_unregister_write (const char *name)
+{
+ return (plugin_unregister (list_write, name));
+}
+
+int plugin_unregister_flush (const char *name)
+{
+ return (plugin_unregister (list_flush, name));
+}
+
+int plugin_unregister_shutdown (const char *name)
+{
+ return (plugin_unregister (list_shutdown, name));
+}
+
+int plugin_unregister_data_set (const char *name)
+{
+ data_set_t *ds;
+
+ if (data_sets == NULL)
+ return (-1);
+
+ if (c_avl_remove (data_sets, name, NULL, (void *) &ds) != 0)
+ return (-1);
+
+ sfree (ds->ds);
+ sfree (ds);
+
+ return (0);
+} /* int plugin_unregister_data_set */
+
+int plugin_unregister_log (const char *name)
+{
+ return (plugin_unregister (list_log, name));
+}
+
+int plugin_unregister_notification (const char *name)
+{
+ return (plugin_unregister (list_notification, name));
+}
+
+void plugin_init_all (void)
+{
+ int (*callback) (void);
+ llentry_t *le;
+ int status;
+
+ /* Start read-threads */
+ if (list_read != NULL)