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 other_identifier identifier for the trial from another source
100 * @param num_nodes how many nodes are in the trial
101 * @param topology integer representing topology for this trial
102 * @param blacklist_topology integer representing blacklist topology for this trial
103 * @param connect_topology integer representing connect topology for this trial
104 * @param connect_topology_option integer representing connect topology option
105 * @param connect_topology_option_modifier float to modify connect option
106 * @param topology_percentage percentage modifier for certain topologies
107 * @param topology_probability probability modifier for certain topologies
108 * @param puts number of puts to perform
109 * @param gets number of gets to perform
110 * @param concurrent number of concurrent requests
111 * @param settle_time time to wait between creating topology and starting testing
112 * @param num_rounds number of times to repeat the trial
113 * @param malicious_getters number of malicious GET peers in the trial
114 * @param malicious_putters number of malicious PUT peers in the trial
115 * @param malicious_droppers number of malicious DROP peers in the trial
116 * @param malicious_get_frequency how often malicious gets are sent
117 * @param malicious_put_frequency how often malicious puts are sent
118 * @param stop_closest stop forwarding PUTs if closest node found
119 * @param stop_found stop forwarding GETs if data found
120 * @param strict_kademlia test used kademlia routing algorithm
121 * @param gets_succeeded how many gets did the test driver report success on
122 * @param message string to put into DB for this trial
124 * @return GNUNET_OK on success, GNUNET_SYSERR on failure
126 int (*insert_trial) (unsigned long long *trialuid, unsigned int other_identifier, unsigned int num_nodes, unsigned int topology,
127 unsigned int blacklist_topology, unsigned int connect_topology,
128 unsigned int connect_topology_option, float connect_topology_option_modifier,
129 float topology_percentage, float topology_probability,
130 unsigned int puts, unsigned int gets, unsigned int concurrent, unsigned int settle_time,
131 unsigned int num_rounds, unsigned int malicious_getters, unsigned int malicious_putters,
132 unsigned int malicious_droppers, unsigned int malicious_get_frequency,
133 unsigned int malicious_put_frequency, unsigned int stop_closest, unsigned int stop_found,
134 unsigned int strict_kademlia, unsigned int gets_succeeded,
138 * Inserts the specified stats into the dhttests.node_statistics table
140 * @param peer the peer inserting the statistic
141 * @param route_requests route requests seen
142 * @param route_forwards route requests forwarded
143 * @param result_requests route result requests seen
144 * @param client_requests client requests initiated
145 * @param result_forwards route results forwarded
146 * @param gets get requests handled
147 * @param puts put requests handle
148 * @param data_inserts data inserted at this node
149 * @param find_peer_requests find peer requests seen
150 * @param find_peers_started find peer requests initiated at this node
151 * @param gets_started get requests initiated at this node
152 * @param puts_started put requests initiated at this node
153 * @param find_peer_responses_received find peer responses received locally
154 * @param get_responses_received get responses received locally
155 * @param find_peer_responses_sent find peer responses sent from this node
156 * @param get_responses_sent get responses sent from this node
158 * @return GNUNET_OK on success, GNUNET_SYSERR on failure
161 (const struct GNUNET_PeerIdentity *peer, unsigned int route_requests,
162 unsigned int route_forwards, unsigned int result_requests,
163 unsigned int client_requests, unsigned int result_forwards,
164 unsigned int gets, unsigned int puts,
165 unsigned int data_inserts, unsigned int find_peer_requests,
166 unsigned int find_peers_started, unsigned int gets_started,
167 unsigned int puts_started, unsigned int find_peer_responses_received,
168 unsigned int get_responses_received, unsigned int find_peer_responses_sent,
169 unsigned int get_responses_sent);
172 * Update dhttests.trials table with current server time as end time
174 * @param trialuid trial to update
175 * @param gets_succeeded how many gets did the trial report successful
177 * @return GNUNET_OK on success, GNUNET_SYSERR on failure.
179 int (*update_trial) (unsigned long long trialuid,
180 unsigned int gets_succeeded);
183 * Update dhttests.nodes table setting the identified
184 * node as a malicious dropper.
186 * @param peer the peer that was set to be malicious
188 * @return GNUNET_OK on success, GNUNET_SYSERR on failure.
190 int (*set_malicious) (struct GNUNET_PeerIdentity *peer);
193 * Records the current topology (number of connections, time, trial)
195 * @param num_connections how many connections are in the topology
197 * @return GNUNET_OK on success, GNUNET_SYSERR on failure
199 int (*insert_topology) (int num_connections);
202 * Records a connection between two peers in the current topology
204 * @param first one side of the connection
205 * @param second other side of the connection
207 * @return GNUNET_OK on success, GNUNET_SYSERR on failure
209 int (*insert_extended_topology) (const struct GNUNET_PeerIdentity *first, const struct GNUNET_PeerIdentity *second);
212 * Inserts the specified stats into the dhttests.generic_stats table
214 * @param peer the peer inserting the statistic
215 * @param name the name of the statistic
216 * @param section the section of the statistic
217 * @param value the value of the statistic
219 * @return GNUNET_OK on success, GNUNET_SYSERR on failure
222 (*add_generic_stat) (const struct GNUNET_PeerIdentity *peer,
224 const char *section, uint64_t value);
227 * Update dhttests.trials table with total connections information
229 * @param trialuid the trialuid to update
230 * @param totalConnections the number of connections
232 * @return GNUNET_OK on success, GNUNET_SYSERR on failure.
234 int (*update_connections) (unsigned long long trialuid,
235 unsigned int totalConnections);
238 * Update dhttests.trials table with total connections information
240 * @param connections the number of connections
242 * @return GNUNET_OK on success, GNUNET_SYSERR on failure.
244 int (*update_topology) (unsigned int connections);
247 * Inserts the specified route information into the dhttests.routes table
249 * @param sqlqueruid inserted query uid
250 * @param queryid dht query id
251 * @param type type of the query
252 * @param hops number of hops query traveled
253 * @param succeeded whether or not query was successful
254 * @param node the node the query hit
255 * @param key the key of the query
256 * @param from_node the node that sent the message to node
257 * @param to_node next node to forward message to
259 * @return GNUNET_OK on success, GNUNET_SYSERR on failure.
261 int (*insert_route) (unsigned long long *sqlqueryuid,
262 unsigned long long queryid,
266 const struct GNUNET_PeerIdentity * node,
267 const GNUNET_HashCode * key,
268 const struct GNUNET_PeerIdentity * from_node,
269 const struct GNUNET_PeerIdentity * to_node);
272 * Inserts the specified node into the dhttests.nodes table
274 * @param nodeuid the inserted node uid
275 * @param node the node to insert
277 * @return GNUNET_OK on success, GNUNET_SYSERR on failure
279 int (*insert_node) (unsigned long long *nodeuid,
280 struct GNUNET_PeerIdentity * node);
283 * Inserts the specified dhtkey into the dhttests.dhtkeys table,
284 * stores return value of dhttests.dhtkeys.dhtkeyuid into dhtkeyuid
286 * @param dhtkeyuid return value
287 * @param dhtkey hashcode of key to insert
289 * @return GNUNET_OK on success, GNUNET_SYSERR on failure
291 int (*insert_dhtkey) (unsigned long long *dhtkeyuid,
292 const GNUNET_HashCode * dhtkey);
296 struct GNUNET_DHTLOG_Plugin
298 const struct GNUNET_CONFIGURATION_Handle *cfg;
300 struct GNUNET_DHTLOG_Handle *dhtlog_api;
304 * Connect to mysql server using the DHT log plugin.
306 * @param c a configuration to use
308 struct GNUNET_DHTLOG_Handle *
309 GNUNET_DHTLOG_connect (const struct GNUNET_CONFIGURATION_Handle *c);
312 * Shutdown the module.
315 GNUNET_DHTLOG_disconnect (struct GNUNET_DHTLOG_Handle *api);
318 #if 0 /* keep Emacsens' auto-indent happy */
325 /* end of dhtlog.h */