aboutsummaryrefslogtreecommitdiff
path: root/src/dht
diff options
context:
space:
mode:
authorNathan S. Evans <evans@in.tum.de>2010-07-20 11:43:33 +0000
committerNathan S. Evans <evans@in.tum.de>2010-07-20 11:43:33 +0000
commit1d59be7fbc8c675d65829606cb500d57830107e1 (patch)
tree2f425bbb9b41206917e6fbcd2b28dbb17718c658 /src/dht
parenta91e6f362b263d08dd20bec03012ad01d257cd37 (diff)
downloadgnunet-1d59be7fbc8c675d65829606cb500d57830107e1.tar.gz
gnunet-1d59be7fbc8c675d65829606cb500d57830107e1.zip
missing file
Diffstat (limited to 'src/dht')
-rw-r--r--src/dht/dhtlog.h195
1 files changed, 195 insertions, 0 deletions
diff --git a/src/dht/dhtlog.h b/src/dht/dhtlog.h
new file mode 100644
index 000000000..c10e7c153
--- /dev/null
+++ b/src/dht/dhtlog.h
@@ -0,0 +1,195 @@
1/*
2 This file is part of GNUnet
3 (C) 2006 Christian Grothoff (and other contributing authors)
4
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.
9
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.
14
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.
19*/
20
21/**
22 * @file src/dht/dhtlog.h
23 *
24 * @brief dhtlog is a service that implements logging of dht operations
25 * for testing
26 * @author Nathan Evans
27 */
28
29#ifndef GNUNET_DHTLOG_SERVICE_H
30#define GNUNET_DHTLOG_SERVICE_H
31
32#include "gnunet_util_lib.h"
33#include <mysql/mysql.h>
34
35#ifdef __cplusplus
36extern "C"
37{
38#if 0 /* keep Emacsens' auto-indent happy */
39}
40#endif
41#endif
42
43typedef enum
44{
45 /**
46 * Type for a DHT GET message
47 */
48 DHTLOG_GET = 1,
49
50 /**
51 * Type for a DHT PUT message
52 */
53 DHTLOG_PUT = 2,
54
55 /**
56 * Type for a DHT FIND PEER message
57 */
58 DHTLOG_FIND_PEER = 3,
59
60 /**
61 * Type for a DHT RESULT message
62 */
63 DHTLOG_RESULT = 4,
64
65 /**
66 * Generic DHT ROUTE message
67 */
68 DHTLOG_ROUTE = 5,
69
70} DHTLOG_MESSAGE_TYPES;
71
72struct GNUNET_DHTLOG_Handle
73{
74
75 /*
76 * Insert the result of a query into the database
77 *
78 * @param sqlqueryuid return value for the sql uid for this query
79 * @param queryid gnunet internal query id (doesn't exist)
80 * @param type the type of query (DHTLOG_GET, DHTLOG_PUT, DHTLOG_RESULT)
81 * @param hops the hops the query has traveled
82 * @param succeeded is successful or not (GNUNET_YES or GNUNET_NO)
83 * @param GNUNET_PeerIdentity of the node the query is at now
84 * @param key the GNUNET_HashCode of this query
85 *
86 */
87 int (*insert_query) (unsigned long long *sqlqueryuid,
88 unsigned long long queryid, DHTLOG_MESSAGE_TYPES type,
89 unsigned int hops,
90 int succeeded,
91 const struct GNUNET_PeerIdentity * node,
92 const GNUNET_HashCode * key);
93
94 /*
95 * Inserts the trial information into the database
96 */
97 int (*insert_trial) (unsigned long long *trialuid, int num_nodes, int topology,
98 int blacklist_topology, int connect_topology,
99 int connect_topology_option, float connect_topology_option_modifier,
100 float topology_percentage, float topology_probability,
101 int puts, int gets, int concurrent, int settle_time,
102 int num_rounds, int malicious_getters, int malicious_putters,
103 int malicious_droppers,
104 char *message);
105
106 /*
107 * Update the trial information with the ending time and dropped message stats
108 */
109 int (*update_trial) (unsigned long long trialuid,
110 unsigned long long totalMessagesDropped,
111 unsigned long long totalBytesDropped,
112 unsigned long long unknownPeers);
113
114 /*
115 * Update the trial information with the total connections
116 */
117 int (*update_connections) (unsigned long long trialuid,
118 unsigned int totalConnections);
119
120 /*
121 * Insert the query information from a single hop into the database
122 *
123 * @param sqlqueryuid return value for the sql uid for this query
124 * @param queryid gnunet internal query id (doesn't exist)
125 * @param type the type of query (DHTLOG_GET, DHTLOG_PUT, DHTLOG_RESULT)
126 * @param hops the hops the query has traveled
127 * @param succeeded query is successful or not (GNUNET_YES or GNUNET_NO)
128 * @param node GNUNET_PeerIdentity of the node the query is at now
129 * @param key the GNUNET_HashCode of this query
130 * @param from_node GNUNET_PeerIdentity of the node the query was
131 * received from (NULL if origin)
132 * @param to_node GNUNET_PeerIdentity of the node this node will forward
133 * to (NULL if none)
134 *
135 */
136 int (*insert_route) (unsigned long long *sqlqueryuid,
137 unsigned long long queryid,
138 unsigned int type,
139 unsigned int hops,
140 int succeeded,
141 const struct GNUNET_PeerIdentity * node,
142 const GNUNET_HashCode * key,
143 const struct GNUNET_PeerIdentity * from_node,
144 const struct GNUNET_PeerIdentity * to_node);
145
146 /*
147 * Inserts the specified node into the dhttests.nodes table
148 */
149 int (*insert_node) (unsigned long long *nodeuid,
150 struct GNUNET_PeerIdentity * node);
151
152 /*
153 * Inserts a dhtkey into the database
154 */
155 int (*insert_dhtkey) (unsigned long long *dhtkeyuid,
156 const GNUNET_HashCode * dhtkey);
157
158};
159
160/**
161 * Connect to mysql server using the DHT log plugin.
162 *
163 * @param c a configuration to use
164 */
165struct GNUNET_DHTLOG_Handle *
166GNUNET_DHTLOG_connect (const struct GNUNET_CONFIGURATION_Handle *c);
167
168/**
169 * Shutdown the module.
170 */
171void
172GNUNET_DHTLOG_disconnect (struct GNUNET_DHTLOG_Handle *api);
173
174/**
175 * Type of a callback that will be called for each
176 * data set returned from MySQL.
177 *
178 * @param cls user-defined argument
179 * @param num_values number of elements in values
180 * @param values values returned by MySQL
181 * @return GNUNET_OK to continue iterating, GNUNET_SYSERR to abort
182 */
183typedef int (*GNUNET_MysqlDataProcessor) (void *cls,
184 unsigned int num_values,
185 MYSQL_BIND * values);
186
187#if 0 /* keep Emacsens' auto-indent happy */
188{
189#endif
190#ifdef __cplusplus
191}
192#endif
193
194/* end of dhtlog.h */
195#endif