aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_dht_service.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-04-09 11:10:25 +0000
committerChristian Grothoff <christian@grothoff.org>2010-04-09 11:10:25 +0000
commit54eccc36f12430505b3b946f88ac61087cc82793 (patch)
tree722953a28bdbac53d006cb0fcb622473ed6dcc50 /src/include/gnunet_dht_service.h
parent513a6ef355fcbabeb1953055185608ed4dacbe69 (diff)
downloadgnunet-54eccc36f12430505b3b946f88ac61087cc82793.tar.gz
gnunet-54eccc36f12430505b3b946f88ac61087cc82793.zip
breaking DHT code
Diffstat (limited to 'src/include/gnunet_dht_service.h')
-rw-r--r--src/include/gnunet_dht_service.h68
1 files changed, 45 insertions, 23 deletions
diff --git a/src/include/gnunet_dht_service.h b/src/include/gnunet_dht_service.h
index f4c68bab6..d14606d70 100644
--- a/src/include/gnunet_dht_service.h
+++ b/src/include/gnunet_dht_service.h
@@ -28,6 +28,7 @@
28#define GNUNET_DHT_SERVICE_H 28#define GNUNET_DHT_SERVICE_H
29 29
30#include "gnunet_util_lib.h" 30#include "gnunet_util_lib.h"
31#include "gnunet_hello_lib.h"
31 32
32#ifdef __cplusplus 33#ifdef __cplusplus
33extern "C" 34extern "C"
@@ -145,15 +146,16 @@ typedef void (*GNUNET_DHT_GetIterator)(void *cls,
145 * 146 *
146 * @param handle handle to the DHT service 147 * @param handle handle to the DHT service
147 * @param timeout timeout for this request to be sent to the 148 * @param timeout timeout for this request to be sent to the
148 * service 149 * service (this is NOT a timeout for receiving responses)
149 * @param type expected type of the response object 150 * @param type expected type of the response object (GNUNET_DATASTORE_BLOCKTYPE_*)
150 * @param key the key to look up 151 * @param key the key to look up
151 * @param iter function to call on each result 152 * @param iter function to call on each result
152 * @param iter_cls closure for iter 153 * @param iter_cls closure for iter
153 * @param cont continuation to call once message sent 154 * @param cont continuation to call once message sent (and it is now
155 * safe to do another operation on the DHT)
154 * @param cont_cls closure for continuation 156 * @param cont_cls closure for continuation
155 * 157 * @return handle to stop the async get, NULL on error (two
156 * @return handle to stop the async get, NULL on error 158 * concurrent operations scheduled)
157 */ 159 */
158struct GNUNET_DHT_GetHandle * 160struct GNUNET_DHT_GetHandle *
159GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle, 161GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle,
@@ -165,13 +167,18 @@ GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle,
165 GNUNET_SCHEDULER_Task cont, 167 GNUNET_SCHEDULER_Task cont,
166 void *cont_cls); 168 void *cont_cls);
167 169
170
168/** 171/**
169 * Stop async DHT-get. Frees associated resources. 172 * Stop async DHT-get. Frees associated resources.
170 * 173 *
171 * @param get_handle GET operation to stop. 174 * @param get_handle GET operation to stop.
175 * @param cont continuation to call once this message is sent to the service
176 * @param cont_cls closure for the continuation
172 */ 177 */
173void 178void
174GNUNET_DHT_get_stop (struct GNUNET_DHT_GetHandle *get_handle, GNUNET_SCHEDULER_Task cont, void *cont_cls); 179GNUNET_DHT_get_stop (struct GNUNET_DHT_GetHandle *get_handle,
180 GNUNET_SCHEDULER_Task cont,
181 void *cont_cls);
175 182
176 183
177/** 184/**
@@ -197,11 +204,10 @@ enum GNUNET_DHT_RouteOption
197 * operation 204 * operation
198 * 205 *
199 * @param cls closure 206 * @param cls closure
200 * @param reply response 207 * @param peer hello of a target (peer near key)
201 */ 208 */
202typedef void (*GNUNET_DHT_FindPeerProcessor)(void *cls, 209typedef void (*GNUNET_DHT_FindPeerProcessor)(void *cls,
203 const struct GNUNET_PeerIdentity *peer, 210 const struct GNUNET_HELLO_Message *peer);
204 const struct GNUNET_MessageHeader *reply);
205 211
206 212
207/** 213/**
@@ -211,43 +217,50 @@ typedef void (*GNUNET_DHT_FindPeerProcessor)(void *cls,
211 * @param timeout timeout for this request to be sent to the 217 * @param timeout timeout for this request to be sent to the
212 * service 218 * service
213 * @param options routing options for this message 219 * @param options routing options for this message
214 * @param message a message to inject at found peers (may be null)
215 * @param key the key to look up 220 * @param key the key to look up
216 * @param proc function to call on each result 221 * @param proc function to call on each result
217 * @param proc_cls closure for proc 222 * @param proc_cls closure for proc
218 * @param cont continuation to call once message sent 223 * @param cont continuation to call once message sent
219 * @param cont_cls closure for continuation 224 * @param cont_cls closure for continuation
220 *
221 * @return handle to stop the async get, NULL on error 225 * @return handle to stop the async get, NULL on error
222 */ 226 */
223struct GNUNET_DHT_FindPeerHandle * 227struct GNUNET_DHT_FindPeerHandle *
224GNUNET_DHT_find_peer_start (struct GNUNET_DHT_Handle *handle, 228GNUNET_DHT_find_peer_start (struct GNUNET_DHT_Handle *handle,
225 struct GNUNET_TIME_Relative timeout, 229 struct GNUNET_TIME_Relative timeout,
226 enum GNUNET_DHT_RouteOption options, 230 enum GNUNET_DHT_RouteOption options,
227 struct GNUNET_MessageHeader *message, 231 const GNUNET_HashCode * key,
228 const GNUNET_HashCode * key, 232 GNUNET_DHT_FindPeerProcessor proc,
229 GNUNET_DHT_FindPeerProcessor proc, 233 void *proc_cls,
230 void *proc_cls, 234 GNUNET_SCHEDULER_Task cont,
231 GNUNET_SCHEDULER_Task cont, 235 void *cont_cls);
232 void *cont_cls); 236
233 237
234/** 238/**
235 * Stop async find peer. Frees associated resources. 239 * Stop async find peer. Frees associated resources.
236 * 240 *
237 * @param find_peer_handle GET operation to stop. 241 * @param find_peer_handle GET operation to stop.
242 * @param cont continuation to call once this message is sent to the service
243 * @param cont_cls closure for the continuation
238 */ 244 */
239void 245void
240GNUNET_DHT_find_peer_stop (struct GNUNET_DHT_FindPeerHandle *find_peer_handle, GNUNET_SCHEDULER_Task cont, void *cont_cls); 246GNUNET_DHT_find_peer_stop (struct GNUNET_DHT_FindPeerHandle *find_peer_handle,
247 GNUNET_SCHEDULER_Task cont,
248 void *cont_cls);
249
241 250
242/** 251/**
243 * Iterator called on each result obtained from a generic route 252 * Iterator called on each result obtained from a generic route
244 * operation 253 * operation
254 *
255 * @param cls closure
256 * @param reply response
245 */ 257 */
246typedef void (*GNUNET_DHT_ReplyProcessor)(void *cls, 258typedef void (*GNUNET_DHT_ReplyProcessor)(void *cls,
247 const struct GNUNET_MessageHeader *reply); 259 const struct GNUNET_MessageHeader *reply);
248 260
261
249/** 262/**
250 * Perform an asynchronous FIND_PEER operation on the DHT. 263 * Perform an asynchronous ROUTE_START operation on the DHT.
251 * 264 *
252 * @param handle handle to the DHT service 265 * @param handle handle to the DHT service
253 * @param key the key to look up 266 * @param key the key to look up
@@ -261,7 +274,6 @@ typedef void (*GNUNET_DHT_ReplyProcessor)(void *cls,
261 * to wait for transmission to the service 274 * to wait for transmission to the service
262 * @param iter function to call on each result, NULL if no replies are expected 275 * @param iter function to call on each result, NULL if no replies are expected
263 * @param iter_cls closure for iter 276 * @param iter_cls closure for iter
264
265 * @param cont continuation to call when done, GNUNET_SYSERR if failed 277 * @param cont continuation to call when done, GNUNET_SYSERR if failed
266 * GNUNET_OK otherwise 278 * GNUNET_OK otherwise
267 * @param cont_cls closure for cont 279 * @param cont_cls closure for cont
@@ -279,8 +291,18 @@ GNUNET_DHT_route_start (struct GNUNET_DHT_Handle *handle,
279 GNUNET_SCHEDULER_Task cont, 291 GNUNET_SCHEDULER_Task cont,
280 void *cont_cls); 292 void *cont_cls);
281 293
294
295/**
296 * Stop async route stop. Frees associated resources.
297 *
298 * @param route_handle operation to stop.
299 * @param cont continuation to call once this message is sent to the service
300 * @param cont_cls closure for the continuation
301 */
282void 302void
283GNUNET_DHT_route_stop (struct GNUNET_DHT_RouteHandle *route_handle, GNUNET_SCHEDULER_Task cont, void *cont_cls); 303GNUNET_DHT_route_stop (struct GNUNET_DHT_RouteHandle *route_handle,
304 GNUNET_SCHEDULER_Task cont,
305 void *cont_cls);
284 306
285 307
286#if 0 /* keep Emacsens' auto-indent happy */ 308#if 0 /* keep Emacsens' auto-indent happy */