diff options
Diffstat (limited to 'src/include/gnunet_dht_service.h')
-rw-r--r-- | src/include/gnunet_dht_service.h | 138 |
1 files changed, 58 insertions, 80 deletions
diff --git a/src/include/gnunet_dht_service.h b/src/include/gnunet_dht_service.h index 46929c366..55038d99a 100644 --- a/src/include/gnunet_dht_service.h +++ b/src/include/gnunet_dht_service.h | |||
@@ -123,9 +123,9 @@ enum GNUNET_DHT_RouteOption | |||
123 | * processing multiple GET/FIND requests in parallel | 123 | * processing multiple GET/FIND requests in parallel |
124 | * @return NULL on error | 124 | * @return NULL on error |
125 | */ | 125 | */ |
126 | struct GNUNET_DHT_Handle *GNUNET_DHT_connect (const struct | 126 | struct GNUNET_DHT_Handle * |
127 | GNUNET_CONFIGURATION_Handle *cfg, | 127 | GNUNET_DHT_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, |
128 | unsigned int ht_len); | 128 | unsigned int ht_len); |
129 | 129 | ||
130 | 130 | ||
131 | /** | 131 | /** |
@@ -133,7 +133,8 @@ struct GNUNET_DHT_Handle *GNUNET_DHT_connect (const struct | |||
133 | * | 133 | * |
134 | * @param handle connection to shut down | 134 | * @param handle connection to shut down |
135 | */ | 135 | */ |
136 | void GNUNET_DHT_disconnect (struct GNUNET_DHT_Handle *handle); | 136 | void |
137 | GNUNET_DHT_disconnect (struct GNUNET_DHT_Handle *handle); | ||
137 | 138 | ||
138 | 139 | ||
139 | /* *************** Standard API: get and put ******************* */ | 140 | /* *************** Standard API: get and put ******************* */ |
@@ -154,14 +155,14 @@ void GNUNET_DHT_disconnect (struct GNUNET_DHT_Handle *handle); | |||
154 | * @param cont continuation to call when done (transmitting request to service) | 155 | * @param cont continuation to call when done (transmitting request to service) |
155 | * @param cont_cls closure for cont | 156 | * @param cont_cls closure for cont |
156 | */ | 157 | */ |
157 | void GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle, | 158 | void |
158 | const GNUNET_HashCode * key, | 159 | GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle, const GNUNET_HashCode * key, |
159 | uint32_t desired_replication_level, | 160 | uint32_t desired_replication_level, |
160 | enum GNUNET_DHT_RouteOption options, | 161 | enum GNUNET_DHT_RouteOption options, |
161 | enum GNUNET_BLOCK_Type type, size_t size, const char *data, | 162 | enum GNUNET_BLOCK_Type type, size_t size, const char *data, |
162 | struct GNUNET_TIME_Absolute exp, | 163 | struct GNUNET_TIME_Absolute exp, |
163 | struct GNUNET_TIME_Relative timeout, | 164 | struct GNUNET_TIME_Relative timeout, GNUNET_SCHEDULER_Task cont, |
164 | GNUNET_SCHEDULER_Task cont, void *cont_cls); | 165 | void *cont_cls); |
165 | 166 | ||
166 | 167 | ||
167 | /** | 168 | /** |
@@ -211,23 +212,16 @@ typedef void (*GNUNET_DHT_GetIterator) (void *cls, | |||
211 | * | 212 | * |
212 | * @return handle to stop the async get | 213 | * @return handle to stop the async get |
213 | */ | 214 | */ |
214 | struct GNUNET_DHT_GetHandle *GNUNET_DHT_get_start (struct GNUNET_DHT_Handle | 215 | struct GNUNET_DHT_GetHandle * |
215 | *handle, | 216 | GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle, |
216 | struct GNUNET_TIME_Relative | 217 | struct GNUNET_TIME_Relative timeout, |
217 | timeout, | 218 | enum GNUNET_BLOCK_Type type, const GNUNET_HashCode * key, |
218 | enum GNUNET_BLOCK_Type type, | 219 | uint32_t desired_replication_level, |
219 | const GNUNET_HashCode * key, | 220 | enum GNUNET_DHT_RouteOption options, |
220 | uint32_t | 221 | const struct GNUNET_CONTAINER_BloomFilter *bf, |
221 | desired_replication_level, | 222 | int32_t bf_mutator, const void *xquery, |
222 | enum GNUNET_DHT_RouteOption | 223 | size_t xquery_size, GNUNET_DHT_GetIterator iter, |
223 | options, | 224 | void *iter_cls); |
224 | const struct | ||
225 | GNUNET_CONTAINER_BloomFilter | ||
226 | *bf, int32_t bf_mutator, | ||
227 | const void *xquery, | ||
228 | size_t xquery_size, | ||
229 | GNUNET_DHT_GetIterator iter, | ||
230 | void *iter_cls); | ||
231 | 225 | ||
232 | 226 | ||
233 | /** | 227 | /** |
@@ -238,7 +232,8 @@ struct GNUNET_DHT_GetHandle *GNUNET_DHT_get_start (struct GNUNET_DHT_Handle | |||
238 | * On return get_handle will no longer be valid, caller | 232 | * On return get_handle will no longer be valid, caller |
239 | * must not use again!!! | 233 | * must not use again!!! |
240 | */ | 234 | */ |
241 | void GNUNET_DHT_get_stop (struct GNUNET_DHT_GetHandle *get_handle); | 235 | void |
236 | GNUNET_DHT_get_stop (struct GNUNET_DHT_GetHandle *get_handle); | ||
242 | 237 | ||
243 | 238 | ||
244 | /* ******** Special high-level API for finding peers *********** */ | 239 | /* ******** Special high-level API for finding peers *********** */ |
@@ -267,21 +262,12 @@ typedef void (*GNUNET_DHT_FindPeerProcessor) (void *cls, | |||
267 | * @param proc_cls closure for proc | 262 | * @param proc_cls closure for proc |
268 | * @return handle to stop the async get, NULL on error | 263 | * @return handle to stop the async get, NULL on error |
269 | */ | 264 | */ |
270 | struct GNUNET_DHT_FindPeerHandle *GNUNET_DHT_find_peer_start (struct | 265 | struct GNUNET_DHT_FindPeerHandle * |
271 | GNUNET_DHT_Handle | 266 | GNUNET_DHT_find_peer_start (struct GNUNET_DHT_Handle *handle, |
272 | *handle, | 267 | struct GNUNET_TIME_Relative timeout, |
273 | struct | 268 | const GNUNET_HashCode * key, |
274 | GNUNET_TIME_Relative | 269 | enum GNUNET_DHT_RouteOption options, |
275 | timeout, | 270 | GNUNET_DHT_FindPeerProcessor proc, void *proc_cls); |
276 | const | ||
277 | GNUNET_HashCode * | ||
278 | key, | ||
279 | enum | ||
280 | GNUNET_DHT_RouteOption | ||
281 | options, | ||
282 | GNUNET_DHT_FindPeerProcessor | ||
283 | proc, | ||
284 | void *proc_cls); | ||
285 | 271 | ||
286 | 272 | ||
287 | /** | 273 | /** |
@@ -289,8 +275,8 @@ struct GNUNET_DHT_FindPeerHandle *GNUNET_DHT_find_peer_start (struct | |||
289 | * | 275 | * |
290 | * @param find_peer_handle GET operation to stop. | 276 | * @param find_peer_handle GET operation to stop. |
291 | */ | 277 | */ |
292 | void GNUNET_DHT_find_peer_stop (struct GNUNET_DHT_FindPeerHandle | 278 | void |
293 | *find_peer_handle); | 279 | GNUNET_DHT_find_peer_stop (struct GNUNET_DHT_FindPeerHandle *find_peer_handle); |
294 | 280 | ||
295 | 281 | ||
296 | 282 | ||
@@ -337,25 +323,15 @@ typedef void (*GNUNET_DHT_ReplyProcessor) (void *cls, | |||
337 | * @param cont_cls closure for cont | 323 | * @param cont_cls closure for cont |
338 | * @return handle to stop the request, NULL if the request is "fire and forget" | 324 | * @return handle to stop the request, NULL if the request is "fire and forget" |
339 | */ | 325 | */ |
340 | struct GNUNET_DHT_RouteHandle *GNUNET_DHT_route_start (struct GNUNET_DHT_Handle | 326 | struct GNUNET_DHT_RouteHandle * |
341 | *handle, | 327 | GNUNET_DHT_route_start (struct GNUNET_DHT_Handle *handle, |
342 | const GNUNET_HashCode * | 328 | const GNUNET_HashCode * key, |
343 | key, | 329 | uint32_t desired_replication_level, |
344 | uint32_t | 330 | enum GNUNET_DHT_RouteOption options, |
345 | desired_replication_level, | 331 | const struct GNUNET_MessageHeader *enc, |
346 | enum | 332 | struct GNUNET_TIME_Relative timeout, |
347 | GNUNET_DHT_RouteOption | 333 | GNUNET_DHT_ReplyProcessor iter, void *iter_cls, |
348 | options, | 334 | GNUNET_SCHEDULER_Task cont, void *cont_cls); |
349 | const struct | ||
350 | GNUNET_MessageHeader | ||
351 | *enc, | ||
352 | struct | ||
353 | GNUNET_TIME_Relative | ||
354 | timeout, | ||
355 | GNUNET_DHT_ReplyProcessor | ||
356 | iter, void *iter_cls, | ||
357 | GNUNET_SCHEDULER_Task | ||
358 | cont, void *cont_cls); | ||
359 | 335 | ||
360 | 336 | ||
361 | 337 | ||
@@ -364,7 +340,8 @@ struct GNUNET_DHT_RouteHandle *GNUNET_DHT_route_start (struct GNUNET_DHT_Handle | |||
364 | * | 340 | * |
365 | * @param route_handle operation to stop. | 341 | * @param route_handle operation to stop. |
366 | */ | 342 | */ |
367 | void GNUNET_DHT_route_stop (struct GNUNET_DHT_RouteHandle *route_handle); | 343 | void |
344 | GNUNET_DHT_route_stop (struct GNUNET_DHT_RouteHandle *route_handle); | ||
368 | 345 | ||
369 | 346 | ||
370 | /* ***** Special API for controlling DHT routing maintenance ******* */ | 347 | /* ***** Special API for controlling DHT routing maintenance ******* */ |
@@ -381,8 +358,9 @@ void GNUNET_DHT_route_stop (struct GNUNET_DHT_RouteHandle *route_handle); | |||
381 | * @param cont_cls closure for cont | 358 | * @param cont_cls closure for cont |
382 | * @param handle handle to the DHT service | 359 | * @param handle handle to the DHT service |
383 | */ | 360 | */ |
384 | void GNUNET_DHT_find_peers (struct GNUNET_DHT_Handle *handle, | 361 | void |
385 | GNUNET_SCHEDULER_Task cont, void *cont_cls); | 362 | GNUNET_DHT_find_peers (struct GNUNET_DHT_Handle *handle, |
363 | GNUNET_SCHEDULER_Task cont, void *cont_cls); | ||
386 | 364 | ||
387 | /* ***** Special API for testing robustness with malicious peers ******* */ | 365 | /* ***** Special API for testing robustness with malicious peers ******* */ |
388 | 366 | ||
@@ -402,9 +380,9 @@ void GNUNET_DHT_find_peers (struct GNUNET_DHT_Handle *handle, | |||
402 | * @param cont_cls closure for cont | 380 | * @param cont_cls closure for cont |
403 | * | 381 | * |
404 | */ | 382 | */ |
405 | void GNUNET_DHT_set_malicious_dropper (struct GNUNET_DHT_Handle *handle, | 383 | void |
406 | GNUNET_SCHEDULER_Task cont, | 384 | GNUNET_DHT_set_malicious_dropper (struct GNUNET_DHT_Handle *handle, |
407 | void *cont_cls); | 385 | GNUNET_SCHEDULER_Task cont, void *cont_cls); |
408 | 386 | ||
409 | 387 | ||
410 | /** | 388 | /** |
@@ -416,10 +394,10 @@ void GNUNET_DHT_set_malicious_dropper (struct GNUNET_DHT_Handle *handle, | |||
416 | * @param cont continuation to call when done (transmitting request to service) | 394 | * @param cont continuation to call when done (transmitting request to service) |
417 | * @param cont_cls closure for cont | 395 | * @param cont_cls closure for cont |
418 | */ | 396 | */ |
419 | void GNUNET_DHT_set_malicious_putter (struct GNUNET_DHT_Handle *handle, | 397 | void |
420 | struct GNUNET_TIME_Relative frequency, | 398 | GNUNET_DHT_set_malicious_putter (struct GNUNET_DHT_Handle *handle, |
421 | GNUNET_SCHEDULER_Task cont, | 399 | struct GNUNET_TIME_Relative frequency, |
422 | void *cont_cls); | 400 | GNUNET_SCHEDULER_Task cont, void *cont_cls); |
423 | 401 | ||
424 | 402 | ||
425 | /** | 403 | /** |
@@ -431,10 +409,10 @@ void GNUNET_DHT_set_malicious_putter (struct GNUNET_DHT_Handle *handle, | |||
431 | * @param cont continuation to call when done (transmitting request to service) | 409 | * @param cont continuation to call when done (transmitting request to service) |
432 | * @param cont_cls closure for cont | 410 | * @param cont_cls closure for cont |
433 | */ | 411 | */ |
434 | void GNUNET_DHT_set_malicious_getter (struct GNUNET_DHT_Handle *handle, | 412 | void |
435 | struct GNUNET_TIME_Relative frequency, | 413 | GNUNET_DHT_set_malicious_getter (struct GNUNET_DHT_Handle *handle, |
436 | GNUNET_SCHEDULER_Task cont, | 414 | struct GNUNET_TIME_Relative frequency, |
437 | void *cont_cls); | 415 | GNUNET_SCHEDULER_Task cont, void *cont_cls); |
438 | 416 | ||
439 | 417 | ||
440 | #endif | 418 | #endif |