aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_dht_service.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_dht_service.h')
-rw-r--r--src/include/gnunet_dht_service.h81
1 files changed, 66 insertions, 15 deletions
diff --git a/src/include/gnunet_dht_service.h b/src/include/gnunet_dht_service.h
index 768b19fb1..22b659d66 100644
--- a/src/include/gnunet_dht_service.h
+++ b/src/include/gnunet_dht_service.h
@@ -101,14 +101,14 @@ enum GNUNET_DHT_RouteOption
101 GNUNET_DHT_RO_RECORD_ROUTE = 2, 101 GNUNET_DHT_RO_RECORD_ROUTE = 2,
102 102
103 /** 103 /**
104 * This is a 'FIND-PEER' request, so approximate results are fine. 104 * Approximate results are fine.
105 */ 105 */
106 GNUNET_DHT_RO_FIND_PEER = 4, 106 GNUNET_DHT_RO_FIND_APPROXIMATE = 4,
107 107
108 /** 108 /**
109 * Flag given to monitors if this was the last hop for a GET/PUT. 109 * Flag given to monitors if this was the last hop for a GET/PUT.
110 * This is only used for internal processing. 110 * This is only used for internal processing.
111 */ 111 */
112 GNUNET_DHT_RO_LAST_HOP = 65535 112 GNUNET_DHT_RO_LAST_HOP = 65535
113}; 113};
114 114
@@ -131,11 +131,6 @@ struct GNUNET_DHT_HopSignature
131 struct GNUNET_TIME_AbsoluteNBO expiration_time; 131 struct GNUNET_TIME_AbsoluteNBO expiration_time;
132 132
133 /** 133 /**
134 * Key of the block.
135 */
136 struct GNUNET_HashCode key;
137
138 /**
139 * Hash over the payload of the block. 134 * Hash over the payload of the block.
140 */ 135 */
141 struct GNUNET_HashCode h_data; 136 struct GNUNET_HashCode h_data;
@@ -181,6 +176,7 @@ struct GNUNET_DHT_PathElement
181 176
182}; 177};
183 178
179
184GNUNET_NETWORK_STRUCT_END 180GNUNET_NETWORK_STRUCT_END
185 181
186/** 182/**
@@ -266,7 +262,7 @@ GNUNET_DHT_put_cancel (struct GNUNET_DHT_PutHandle *ph);
266 * 262 *
267 * @param cls closure 263 * @param cls closure
268 * @param exp when will this value expire 264 * @param exp when will this value expire
269 * @param key key of the result 265 * @param query_hash key of the query
270 * @param get_path peers on reply path (or NULL if not recorded) 266 * @param get_path peers on reply path (or NULL if not recorded)
271 * [0] = datastore's first neighbor, [length - 1] = local peer 267 * [0] = datastore's first neighbor, [length - 1] = local peer
272 * @param get_path_length number of entries in @a get_path 268 * @param get_path_length number of entries in @a get_path
@@ -282,7 +278,7 @@ GNUNET_DHT_put_cancel (struct GNUNET_DHT_PutHandle *ph);
282typedef void 278typedef void
283(*GNUNET_DHT_GetIterator) (void *cls, 279(*GNUNET_DHT_GetIterator) (void *cls,
284 struct GNUNET_TIME_Absolute exp, 280 struct GNUNET_TIME_Absolute exp,
285 const struct GNUNET_HashCode *key, 281 const struct GNUNET_HashCode *query_hash,
286 const struct GNUNET_DHT_PathElement *get_path, 282 const struct GNUNET_DHT_PathElement *get_path,
287 unsigned int get_path_length, 283 unsigned int get_path_length,
288 const struct GNUNET_DHT_PathElement *put_path, 284 const struct GNUNET_DHT_PathElement *put_path,
@@ -487,7 +483,6 @@ GNUNET_DHT_pp2s (const struct GNUNET_DHT_PathElement *path,
487 * the last signature on the path is never verified as that is the slot where 483 * the last signature on the path is never verified as that is the slot where
488 * our peer (@a me) would need to sign. 484 * our peer (@a me) would need to sign.
489 * 485 *
490 * @param key key of the data (not necessarily the query hash)
491 * @param data payload (the block) 486 * @param data payload (the block)
492 * @param data_size number of bytes in @a data 487 * @param data_size number of bytes in @a data
493 * @param exp_time expiration time of @a data 488 * @param exp_time expiration time of @a data
@@ -501,8 +496,7 @@ GNUNET_DHT_pp2s (const struct GNUNET_DHT_PathElement *path,
501 * @a get_path_len + @a put_path_len - 1 if no signature was valid 496 * @a get_path_len + @a put_path_len - 1 if no signature was valid
502 */ 497 */
503unsigned int 498unsigned int
504GNUNET_DHT_verify_path (const struct GNUNET_HashCode *key, 499GNUNET_DHT_verify_path (const void *data,
505 const void *data,
506 size_t data_size, 500 size_t data_size,
507 struct GNUNET_TIME_Absolute exp_time, 501 struct GNUNET_TIME_Absolute exp_time,
508 const struct GNUNET_DHT_PathElement *put_path, 502 const struct GNUNET_DHT_PathElement *put_path,
@@ -512,6 +506,63 @@ GNUNET_DHT_verify_path (const struct GNUNET_HashCode *key,
512 const struct GNUNET_PeerIdentity *me); 506 const struct GNUNET_PeerIdentity *me);
513 507
514 508
509/**
510 * Handle to get a HELLO URL from the DHT for manual bootstrapping.
511 */
512struct GNUNET_DHT_HelloGetHandle;
513
514
515/**
516 * Signature called with the result of a HELLO GET operation.
517 *
518 * @param cls closure
519 * @param hello_url the resulting HELLO URL, NULL on error
520 */
521typedef void
522(*GNUNET_DHT_HelloGetCallback)(void *cls,
523 const char *hello_url);
524
525
526/**
527 * Obtain HELLO URL of the DHT identified by @a dht_handle.
528 *
529 * @param dht_handle DHT to query
530 * @param cb function to call with the result
531 * @param cb_cls closure for @a cb
532 * @return NULL on failure
533 */
534struct GNUNET_DHT_HelloGetHandle *
535GNUNET_DHT_hello_get (struct GNUNET_DHT_Handle *dht_handle,
536 GNUNET_DHT_HelloGetCallback cb,
537 void *cb_cls);
538
539
540/**
541 * Cancel hello get operation.
542 *
543 * @param[in] hgh operation to cancel.
544 */
545void
546GNUNET_DHT_hello_get_cancel (struct GNUNET_DHT_HelloGetHandle *hgh);
547
548
549/**
550 * Offer HELLO URL of the DHT identified by @a dht_handle.
551 * Callback may be invoked once, only way to cancel is to
552 * disconnect @a dht_handle.
553 *
554 * @param dht_handle DHT to query
555 * @param url URL with a HELLO to offer to the DHT
556 * @param cb function called when done
557 * @param cb_cls closure for @a cb
558 */
559void
560GNUNET_DHT_hello_offer (struct GNUNET_DHT_Handle *dht_handle,
561 const char *url,
562 GNUNET_SCHEDULER_TaskCallback cb,
563 void *cb_cls);
564
565
515#if 0 /* keep Emacsens' auto-indent happy */ 566#if 0 /* keep Emacsens' auto-indent happy */
516{ 567{
517#endif 568#endif