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 * Inserts the specified query into the dhttests.queries table
77 * @param sqlqueruid inserted query uid
78 * @param queryid dht query id
79 * @param type type of the query
80 * @param hops number of hops query traveled
81 * @param succeeded whether or not query was successful
82 * @param node the node the query hit
83 * @param key the key of the query
85 * @return GNUNET_OK on success, GNUNET_SYSERR on failure.
87 int (*insert_query) (unsigned long long *sqlqueryuid,
88 unsigned long long queryid, DHTLOG_MESSAGE_TYPES type,
91 const struct GNUNET_PeerIdentity * node,
92 const GNUNET_HashCode * key);
95 * Inserts the specified trial into the dhttests.trials table
97 * @param trialuid return the trialuid of the newly inserted trial
98 * @param num_nodes how many nodes are in the trial
99 * @param topology integer representing topology for this trial
100 * @param blacklist_topology integer representing blacklist topology for this trial
101 * @param connect_topology integer representing connect topology for this trial
102 * @param connect_topology_option integer representing connect topology option
103 * @param connect_topology_option_modifier float to modify connect option
104 * @param topology_percentage percentage modifier for certain topologies
105 * @param topology_probability probability modifier for certain topologies
106 * @param puts number of puts to perform
107 * @param gets number of gets to perform
108 * @param concurrent number of concurrent requests
109 * @param settle_time time to wait between creating topology and starting testing
110 * @param num_rounds number of times to repeat the trial
111 * @param malicious_getters number of malicious GET peers in the trial
112 * @param malicious_putters number of malicious PUT peers in the trial
113 * @param malicious_droppers number of malicious DROP peers in the trial
114 * @param message string to put into DB for this trial
116 * @return GNUNET_OK on success, GNUNET_SYSERR on failure
118 int (*insert_trial) (unsigned long long *trialuid, int num_nodes, int topology,
119 int blacklist_topology, int connect_topology,
120 int connect_topology_option, float connect_topology_option_modifier,
121 float topology_percentage, float topology_probability,
122 int puts, int gets, int concurrent, int settle_time,
123 int num_rounds, int malicious_getters, int malicious_putters,
124 int malicious_droppers,
128 * Update dhttests.trials table with current server time as end time
130 * @param trialuid trial to update
131 * @param totalMessagesDropped stats value for messages dropped
132 * @param totalBytesDropped stats value for total bytes dropped
133 * @param unknownPeers stats value for unknown peers
135 * @return GNUNET_OK on success, GNUNET_SYSERR on failure.
137 int (*update_trial) (unsigned long long trialuid,
138 unsigned long long totalMessagesDropped,
139 unsigned long long totalBytesDropped,
140 unsigned long long unknownPeers);
143 * Records the current topology (number of connections, time, trial)
145 * @param num_connections how many connections are in the topology
147 * @return GNUNET_OK on success, GNUNET_SYSERR on failure
149 int (*insert_topology) (int num_connections);
152 * Records a connection between two peers in the current topology
154 * @param first one side of the connection
155 * @param second other side of the connection
157 * @return GNUNET_OK on success, GNUNET_SYSERR on failure
159 int (*insert_extended_topology) (struct GNUNET_PeerIdentity *first, struct GNUNET_PeerIdentity *second);
162 * Update dhttests.trials table with total connections information
164 * @param trialuid the trialuid to update
165 * @param totalConnections the number of connections
167 * @return GNUNET_OK on success, GNUNET_SYSERR on failure.
169 int (*update_connections) (unsigned long long trialuid,
170 unsigned int totalConnections);
173 * Update dhttests.trials table with total connections information
175 * @param connections the number of connections
177 * @return GNUNET_OK on success, GNUNET_SYSERR on failure.
179 int (*update_topology) (unsigned int connections);
182 * Inserts the specified route information into the dhttests.routes table
184 * @param sqlqueruid inserted query uid
185 * @param queryid dht query id
186 * @param type type of the query
187 * @param hops number of hops query traveled
188 * @param succeeded whether or not query was successful
189 * @param node the node the query hit
190 * @param key the key of the query
191 * @param from_node the node that sent the message to node
192 * @param to_node next node to forward message to
194 * @return GNUNET_OK on success, GNUNET_SYSERR on failure.
196 int (*insert_route) (unsigned long long *sqlqueryuid,
197 unsigned long long queryid,
201 const struct GNUNET_PeerIdentity * node,
202 const GNUNET_HashCode * key,
203 const struct GNUNET_PeerIdentity * from_node,
204 const struct GNUNET_PeerIdentity * to_node);
207 * Inserts the specified node into the dhttests.nodes table
209 * @param nodeuid the inserted node uid
210 * @param node the node to insert
212 * @return GNUNET_OK on success, GNUNET_SYSERR on failure
214 int (*insert_node) (unsigned long long *nodeuid,
215 struct GNUNET_PeerIdentity * node);
218 * Inserts the specified dhtkey into the dhttests.dhtkeys table,
219 * stores return value of dhttests.dhtkeys.dhtkeyuid into dhtkeyuid
221 * @param dhtkeyuid return value
222 * @param dhtkey hashcode of key to insert
224 * @return GNUNET_OK on success, GNUNET_SYSERR on failure
226 int (*insert_dhtkey) (unsigned long long *dhtkeyuid,
227 const GNUNET_HashCode * dhtkey);
231 struct GNUNET_DHTLOG_Plugin
233 const struct GNUNET_CONFIGURATION_Handle *cfg;
235 struct GNUNET_DHTLOG_Handle *dhtlog_api;
239 * Connect to mysql server using the DHT log plugin.
241 * @param c a configuration to use
243 struct GNUNET_DHTLOG_Handle *
244 GNUNET_DHTLOG_connect (const struct GNUNET_CONFIGURATION_Handle *c);
247 * Shutdown the module.
250 GNUNET_DHTLOG_disconnect (struct GNUNET_DHTLOG_Handle *api);
253 #if 0 /* keep Emacsens' auto-indent happy */
260 /* end of dhtlog.h */