2 This file is part of GNUnet
3 (C) 2006 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.h
24 * @brief dhtlog is a service that implements logging of dht operations
26 * @author Nathan Evans
29 #ifndef GNUNET_DHTLOG_SERVICE_H
30 #define GNUNET_DHTLOG_SERVICE_H
32 #include "gnunet_util_lib.h"
37 #if 0 /* keep Emacsens' auto-indent happy */
45 * Type for a DHT GET message
50 * Type for a DHT PUT message
55 * Type for a DHT FIND PEER message
60 * Type for a DHT RESULT message
65 * Generic DHT ROUTE message
69 } DHTLOG_MESSAGE_TYPES;
71 struct GNUNET_DHTLOG_Handle
75 * Insert the result of a query into the database
77 * @param sqlqueryuid return value for the sql uid for this query
78 * @param queryid gnunet internal query id (doesn't exist)
79 * @param type the type of query (DHTLOG_GET, DHTLOG_PUT, DHTLOG_RESULT)
80 * @param hops the hops the query has traveled
81 * @param succeeded is successful or not (GNUNET_YES or GNUNET_NO)
82 * @param GNUNET_PeerIdentity of the node the query is at now
83 * @param key the GNUNET_HashCode of this query
86 int (*insert_query) (unsigned long long *sqlqueryuid,
87 unsigned long long queryid, DHTLOG_MESSAGE_TYPES type,
90 const struct GNUNET_PeerIdentity * node,
91 const GNUNET_HashCode * key);
94 * Inserts the trial information into the database
96 int (*insert_trial) (unsigned long long *trialuid, int num_nodes, int topology,
97 int blacklist_topology, int connect_topology,
98 int connect_topology_option, float connect_topology_option_modifier,
99 float topology_percentage, float topology_probability,
100 int puts, int gets, int concurrent, int settle_time,
101 int num_rounds, int malicious_getters, int malicious_putters,
102 int malicious_droppers,
106 * Update the trial information with the ending time and dropped message stats
108 int (*update_trial) (unsigned long long trialuid,
109 unsigned long long totalMessagesDropped,
110 unsigned long long totalBytesDropped,
111 unsigned long long unknownPeers);
114 * Update the trial information with the total connections
116 int (*update_connections) (unsigned long long trialuid,
117 unsigned int totalConnections);
120 * Insert the query information from a single hop into the database
122 * @param sqlqueryuid return value for the sql uid for this query
123 * @param queryid gnunet internal query id (doesn't exist)
124 * @param type the type of query (DHTLOG_GET, DHTLOG_PUT, DHTLOG_RESULT)
125 * @param hops the hops the query has traveled
126 * @param succeeded query is successful or not (GNUNET_YES or GNUNET_NO)
127 * @param node GNUNET_PeerIdentity of the node the query is at now
128 * @param key the GNUNET_HashCode of this query
129 * @param from_node GNUNET_PeerIdentity of the node the query was
130 * received from (NULL if origin)
131 * @param to_node GNUNET_PeerIdentity of the node this node will forward
135 int (*insert_route) (unsigned long long *sqlqueryuid,
136 unsigned long long queryid,
140 const struct GNUNET_PeerIdentity * node,
141 const GNUNET_HashCode * key,
142 const struct GNUNET_PeerIdentity * from_node,
143 const struct GNUNET_PeerIdentity * to_node);
146 * Inserts the specified node into the dhttests.nodes table
148 int (*insert_node) (unsigned long long *nodeuid,
149 struct GNUNET_PeerIdentity * node);
152 * Inserts a dhtkey into the database
154 int (*insert_dhtkey) (unsigned long long *dhtkeyuid,
155 const GNUNET_HashCode * dhtkey);
159 struct GNUNET_DHTLOG_Plugin
161 const struct GNUNET_CONFIGURATION_Handle *cfg;
163 struct GNUNET_DHTLOG_Handle *dhtlog_api;
167 * Connect to mysql server using the DHT log plugin.
169 * @param c a configuration to use
171 struct GNUNET_DHTLOG_Handle *
172 GNUNET_DHTLOG_connect (const struct GNUNET_CONFIGURATION_Handle *c);
175 * Shutdown the module.
178 GNUNET_DHTLOG_disconnect (struct GNUNET_DHTLOG_Handle *api);
181 #if 0 /* keep Emacsens' auto-indent happy */
188 /* end of dhtlog.h */