diff options
Diffstat (limited to 'src/include/gnunet_dht_service.h')
-rw-r--r-- | src/include/gnunet_dht_service.h | 50 |
1 files changed, 33 insertions, 17 deletions
diff --git a/src/include/gnunet_dht_service.h b/src/include/gnunet_dht_service.h index 22b659d66..a1ea31c25 100644 --- a/src/include/gnunet_dht_service.h +++ b/src/include/gnunet_dht_service.h | |||
@@ -19,6 +19,11 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @addtogroup Backbone | ||
23 | * @{ | ||
24 | * @addtogroup dht_libs DHT and support libraries | ||
25 | * @{ | ||
26 | * | ||
22 | * @author Christian Grothoff | 27 | * @author Christian Grothoff |
23 | * | 28 | * |
24 | * @file | 29 | * @file |
@@ -35,9 +40,9 @@ | |||
35 | #ifndef GNUNET_DHT_SERVICE_H | 40 | #ifndef GNUNET_DHT_SERVICE_H |
36 | #define GNUNET_DHT_SERVICE_H | 41 | #define GNUNET_DHT_SERVICE_H |
37 | 42 | ||
43 | |||
38 | #include "gnunet_util_lib.h" | 44 | #include "gnunet_util_lib.h" |
39 | #include "gnunet_block_lib.h" | 45 | #include "gnunet_block_lib.h" |
40 | #include "gnunet_hello_lib.h" | ||
41 | 46 | ||
42 | #ifdef __cplusplus | 47 | #ifdef __cplusplus |
43 | extern "C" | 48 | extern "C" |
@@ -106,10 +111,15 @@ enum GNUNET_DHT_RouteOption | |||
106 | GNUNET_DHT_RO_FIND_APPROXIMATE = 4, | 111 | GNUNET_DHT_RO_FIND_APPROXIMATE = 4, |
107 | 112 | ||
108 | /** | 113 | /** |
114 | * Flag set if the path was truncated. | ||
115 | */ | ||
116 | GNUNET_DHT_RO_TRUNCATED = 8, | ||
117 | |||
118 | /** | ||
109 | * Flag given to monitors if this was the last hop for a GET/PUT. | 119 | * Flag given to monitors if this was the last hop for a GET/PUT. |
110 | * This is only used for internal processing. | 120 | * This is only used for internal processing. |
111 | */ | 121 | */ |
112 | GNUNET_DHT_RO_LAST_HOP = 65535 | 122 | GNUNET_DHT_RO_LAST_HOP = 32768 |
113 | }; | 123 | }; |
114 | 124 | ||
115 | 125 | ||
@@ -133,7 +143,7 @@ struct GNUNET_DHT_HopSignature | |||
133 | /** | 143 | /** |
134 | * Hash over the payload of the block. | 144 | * Hash over the payload of the block. |
135 | */ | 145 | */ |
136 | struct GNUNET_HashCode h_data; | 146 | struct GNUNET_HashCode h_data GNUNET_PACKED; |
137 | 147 | ||
138 | /** | 148 | /** |
139 | * Previous hop the message was received from. All zeros | 149 | * Previous hop the message was received from. All zeros |
@@ -155,6 +165,11 @@ struct GNUNET_DHT_HopSignature | |||
155 | */ | 165 | */ |
156 | struct GNUNET_DHT_PathElement | 166 | struct GNUNET_DHT_PathElement |
157 | { | 167 | { |
168 | /** | ||
169 | * Signature affirming the hop of type | ||
170 | * #GNUNET_SIGNATURE_PURPOSE_DHT_HOP. | ||
171 | */ | ||
172 | struct GNUNET_CRYPTO_EddsaSignature sig; | ||
158 | 173 | ||
159 | /** | 174 | /** |
160 | * Previous peer on the path (matches "pred" in the signed field). | 175 | * Previous peer on the path (matches "pred" in the signed field). |
@@ -168,12 +183,6 @@ struct GNUNET_DHT_PathElement | |||
168 | */ | 183 | */ |
169 | struct GNUNET_PeerIdentity pred; | 184 | struct GNUNET_PeerIdentity pred; |
170 | 185 | ||
171 | /** | ||
172 | * Signature affirming the hop of type | ||
173 | * #GNUNET_SIGNATURE_PURPOSE_DHT_HOP. | ||
174 | */ | ||
175 | struct GNUNET_CRYPTO_EddsaSignature sig; | ||
176 | |||
177 | }; | 186 | }; |
178 | 187 | ||
179 | 188 | ||
@@ -263,6 +272,7 @@ GNUNET_DHT_put_cancel (struct GNUNET_DHT_PutHandle *ph); | |||
263 | * @param cls closure | 272 | * @param cls closure |
264 | * @param exp when will this value expire | 273 | * @param exp when will this value expire |
265 | * @param query_hash key of the query | 274 | * @param query_hash key of the query |
275 | * @param trunc_peer peer where the path was truncated, or NULL if the path is complete | ||
266 | * @param get_path peers on reply path (or NULL if not recorded) | 276 | * @param get_path peers on reply path (or NULL if not recorded) |
267 | * [0] = datastore's first neighbor, [length - 1] = local peer | 277 | * [0] = datastore's first neighbor, [length - 1] = local peer |
268 | * @param get_path_length number of entries in @a get_path | 278 | * @param get_path_length number of entries in @a get_path |
@@ -279,6 +289,7 @@ typedef void | |||
279 | (*GNUNET_DHT_GetIterator) (void *cls, | 289 | (*GNUNET_DHT_GetIterator) (void *cls, |
280 | struct GNUNET_TIME_Absolute exp, | 290 | struct GNUNET_TIME_Absolute exp, |
281 | const struct GNUNET_HashCode *query_hash, | 291 | const struct GNUNET_HashCode *query_hash, |
292 | const struct GNUNET_PeerIdentity *trunc_peer, | ||
282 | const struct GNUNET_DHT_PathElement *get_path, | 293 | const struct GNUNET_DHT_PathElement *get_path, |
283 | unsigned int get_path_length, | 294 | unsigned int get_path_length, |
284 | const struct GNUNET_DHT_PathElement *put_path, | 295 | const struct GNUNET_DHT_PathElement *put_path, |
@@ -354,10 +365,6 @@ struct GNUNET_DHT_MonitorHandle; | |||
354 | * @param options Options, for instance RecordRoute, DemultiplexEverywhere. | 365 | * @param options Options, for instance RecordRoute, DemultiplexEverywhere. |
355 | * @param type The type of data in the request. | 366 | * @param type The type of data in the request. |
356 | * @param hop_count Hop count so far. | 367 | * @param hop_count Hop count so far. |
357 | * @param path_length number of entries in @a path (or 0 if not recorded). | ||
358 | * @param path peers on the GET path (or NULL if not recorded). | ||
359 | * note that the last signature will be all zeros as | ||
360 | * we did not forward and thus did not sign! | ||
361 | * @param desired_replication_level Desired replication level. | 368 | * @param desired_replication_level Desired replication level. |
362 | * @param key Key of the requested data. | 369 | * @param key Key of the requested data. |
363 | */ | 370 | */ |
@@ -367,8 +374,6 @@ typedef void | |||
367 | enum GNUNET_BLOCK_Type type, | 374 | enum GNUNET_BLOCK_Type type, |
368 | uint32_t hop_count, | 375 | uint32_t hop_count, |
369 | uint32_t desired_replication_level, | 376 | uint32_t desired_replication_level, |
370 | unsigned int path_length, | ||
371 | const struct GNUNET_DHT_PathElement *path, | ||
372 | const struct GNUNET_HashCode *key); | 377 | const struct GNUNET_HashCode *key); |
373 | 378 | ||
374 | 379 | ||
@@ -377,6 +382,7 @@ typedef void | |||
377 | * | 382 | * |
378 | * @param cls Closure. | 383 | * @param cls Closure. |
379 | * @param type The type of data in the result. | 384 | * @param type The type of data in the result. |
385 | * @param trunc_peer peer where the path was truncated, or NULL if the path is complete | ||
380 | * @param get_path Peers on GET path (or NULL if not recorded). | 386 | * @param get_path Peers on GET path (or NULL if not recorded). |
381 | * note that the last signature will be all zeros as | 387 | * note that the last signature will be all zeros as |
382 | * we did not forward and thus did not sign! | 388 | * we did not forward and thus did not sign! |
@@ -391,6 +397,7 @@ typedef void | |||
391 | typedef void | 397 | typedef void |
392 | (*GNUNET_DHT_MonitorGetRespCB) (void *cls, | 398 | (*GNUNET_DHT_MonitorGetRespCB) (void *cls, |
393 | enum GNUNET_BLOCK_Type type, | 399 | enum GNUNET_BLOCK_Type type, |
400 | const struct GNUNET_PeerIdentity *trunc_peer, | ||
394 | const struct GNUNET_DHT_PathElement *get_path, | 401 | const struct GNUNET_DHT_PathElement *get_path, |
395 | unsigned int get_path_length, | 402 | unsigned int get_path_length, |
396 | const struct GNUNET_DHT_PathElement *put_path, | 403 | const struct GNUNET_DHT_PathElement *put_path, |
@@ -408,11 +415,12 @@ typedef void | |||
408 | * @param options Options, for instance RecordRoute, DemultiplexEverywhere. | 415 | * @param options Options, for instance RecordRoute, DemultiplexEverywhere. |
409 | * @param type The type of data in the request. | 416 | * @param type The type of data in the request. |
410 | * @param hop_count Hop count so far. | 417 | * @param hop_count Hop count so far. |
418 | * @param desired_replication_level Desired replication level. | ||
419 | * @param trunc_peer peer where the path was truncated, or NULL if the path is complete | ||
411 | * @param path_length number of entries in @a path (or 0 if not recorded). | 420 | * @param path_length number of entries in @a path (or 0 if not recorded). |
412 | * @param path peers on the PUT path (or NULL if not recorded). | 421 | * @param path peers on the PUT path (or NULL if not recorded). |
413 | * note that the last signature will be all zeros as | 422 | * note that the last signature will be all zeros as |
414 | * we did not forward and thus did not sign! | 423 | * we did not forward and thus did not sign! |
415 | * @param desired_replication_level Desired replication level. | ||
416 | * @param exp Expiration time of the data. | 424 | * @param exp Expiration time of the data. |
417 | * @param key Key under which data is to be stored. | 425 | * @param key Key under which data is to be stored. |
418 | * @param data Pointer to the data carried. | 426 | * @param data Pointer to the data carried. |
@@ -424,6 +432,7 @@ typedef void | |||
424 | enum GNUNET_BLOCK_Type type, | 432 | enum GNUNET_BLOCK_Type type, |
425 | uint32_t hop_count, | 433 | uint32_t hop_count, |
426 | uint32_t desired_replication_level, | 434 | uint32_t desired_replication_level, |
435 | const struct GNUNET_PeerIdentity *trunc_peer, | ||
427 | unsigned int path_length, | 436 | unsigned int path_length, |
428 | const struct GNUNET_DHT_PathElement *path, | 437 | const struct GNUNET_DHT_PathElement *path, |
429 | struct GNUNET_TIME_Absolute exp, | 438 | struct GNUNET_TIME_Absolute exp, |
@@ -486,6 +495,8 @@ GNUNET_DHT_pp2s (const struct GNUNET_DHT_PathElement *path, | |||
486 | * @param data payload (the block) | 495 | * @param data payload (the block) |
487 | * @param data_size number of bytes in @a data | 496 | * @param data_size number of bytes in @a data |
488 | * @param exp_time expiration time of @a data | 497 | * @param exp_time expiration time of @a data |
498 | * @param trunc_peer peer which signature was broken or where the path was truncated, | ||
499 | * NULL if path is not truncated | ||
489 | * @param get_path array of path elements to verify | 500 | * @param get_path array of path elements to verify |
490 | * @param get_path_len length of the @a get_path array | 501 | * @param get_path_len length of the @a get_path array |
491 | * @param put_path array of path elements to verify | 502 | * @param put_path array of path elements to verify |
@@ -493,12 +504,13 @@ GNUNET_DHT_pp2s (const struct GNUNET_DHT_PathElement *path, | |||
493 | * @param me our own peer identity (needed to verify the last element) | 504 | * @param me our own peer identity (needed to verify the last element) |
494 | * @return 0 on success, otherwise the index of | 505 | * @return 0 on success, otherwise the index of |
495 | * the last path element that succeeded with verification; | 506 | * the last path element that succeeded with verification; |
496 | * @a get_path_len + @a put_path_len - 1 if no signature was valid | 507 | * @a get_path_len + @a put_path_len if no signature was valid |
497 | */ | 508 | */ |
498 | unsigned int | 509 | unsigned int |
499 | GNUNET_DHT_verify_path (const void *data, | 510 | GNUNET_DHT_verify_path (const void *data, |
500 | size_t data_size, | 511 | size_t data_size, |
501 | struct GNUNET_TIME_Absolute exp_time, | 512 | struct GNUNET_TIME_Absolute exp_time, |
513 | const struct GNUNET_PeerIdentity *trunc_peer, | ||
502 | const struct GNUNET_DHT_PathElement *put_path, | 514 | const struct GNUNET_DHT_PathElement *put_path, |
503 | unsigned int put_path_len, | 515 | unsigned int put_path_len, |
504 | const struct GNUNET_DHT_PathElement *get_path, | 516 | const struct GNUNET_DHT_PathElement *get_path, |
@@ -573,3 +585,7 @@ GNUNET_DHT_hello_offer (struct GNUNET_DHT_Handle *dht_handle, | |||
573 | #endif | 585 | #endif |
574 | 586 | ||
575 | /** @} */ /* end of group dht */ | 587 | /** @} */ /* end of group dht */ |
588 | |||
589 | /** @} */ /* end of group addition */ | ||
590 | |||
591 | /** @} */ /* end of group addition */ | ||