2 This file is part of GNUnet.
3 (C) 2006 - 2009 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 2, or (at your
8 option) any later version.
10 GNUnet 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
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 * @file src/dht/dhtlog.c
23 * @brief Plugin loaded to load logging
24 * to record DHT operations
25 * @author Nathan Evans
27 * Database: Loaded by plugin MySQL
31 #include "gnunet_util_lib.h"
37 * Provides the dhtlog api
39 * @param c the configuration to use to connect to a server
41 * @return the handle to the server, or NULL on error
43 struct GNUNET_DHTLOG_Handle *
44 GNUNET_DHTLOG_connect (const struct GNUNET_CONFIGURATION_Handle *c)
46 struct GNUNET_DHTLOG_Plugin *plugin;
47 struct GNUNET_DHTLOG_Handle *api;
50 plugin = GNUNET_malloc(sizeof(struct GNUNET_DHTLOG_Plugin));
53 GNUNET_CONFIGURATION_get_value_string (c,
54 "DHTLOG", "PLUGIN", &plugin_name))
56 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
57 _("Loading `%s' dhtlog plugin\n"), plugin_name);
58 GNUNET_asprintf (&libname, "libgnunet_plugin_dhtlog_%s", plugin_name);
59 GNUNET_PLUGIN_load (libname, plugin);
62 if (plugin->dhtlog_api == NULL)
64 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
65 _("Failed to load dhtlog plugin for `%s'\n"), plugin_name);
66 GNUNET_free (plugin_name);
71 api = plugin->dhtlog_api;
72 GNUNET_free (plugin_name);
78 * Shutdown the module.
81 GNUNET_DHTLOG_disconnect (struct GNUNET_DHTLOG_Handle *api)
84 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
85 "MySQL DHT Logger: database shutdown\n");
89 GNUNET_PLUGIN_unload(libname, api);
91 GNUNET_free_non_null(libname);