diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-01-09 12:22:04 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-01-09 12:22:04 +0100 |
commit | ec19c1e316efdd29a7af0524fc2ff33cc4b19d09 (patch) | |
tree | 184a59ff1c8408c462254e53f7e2004be829e237 /src/include | |
parent | c3ecadd45b11f82e22ba81b42864c7826d0f97c6 (diff) | |
download | gnunet-ec19c1e316efdd29a7af0524fc2ff33cc4b19d09.tar.gz gnunet-ec19c1e316efdd29a7af0524fc2ff33cc4b19d09.zip |
DHT: modify API and protocol messages to add path signatures, except for now the actual signatures are just placeholders (signing and signature verification are missing)
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gnunet_datacache_lib.h | 23 | ||||
-rw-r--r-- | src/include/gnunet_datacache_plugin.h | 2 | ||||
-rw-r--r-- | src/include/gnunet_dht_service.h | 34 | ||||
-rw-r--r-- | src/include/gnunet_strings_lib.h | 12 |
4 files changed, 40 insertions, 31 deletions
diff --git a/src/include/gnunet_datacache_lib.h b/src/include/gnunet_datacache_lib.h index 519c36bb4..11076e3e7 100644 --- a/src/include/gnunet_datacache_lib.h +++ b/src/include/gnunet_datacache_lib.h | |||
@@ -39,6 +39,7 @@ | |||
39 | 39 | ||
40 | #include "gnunet_util_lib.h" | 40 | #include "gnunet_util_lib.h" |
41 | #include "gnunet_block_lib.h" | 41 | #include "gnunet_block_lib.h" |
42 | #include "gnunet_dht_service.h" | ||
42 | 43 | ||
43 | #ifdef __cplusplus | 44 | #ifdef __cplusplus |
44 | extern "C" | 45 | extern "C" |
@@ -89,15 +90,15 @@ GNUNET_DATACACHE_destroy (struct GNUNET_DATACACHE_Handle *h); | |||
89 | * @param path_info a path through the network | 90 | * @param path_info a path through the network |
90 | * @return #GNUNET_OK to continue iterating, #GNUNET_SYSERR to abort | 91 | * @return #GNUNET_OK to continue iterating, #GNUNET_SYSERR to abort |
91 | */ | 92 | */ |
92 | typedef int | 93 | typedef enum GNUNET_GenericReturnValue |
93 | (*GNUNET_DATACACHE_Iterator) (void *cls, | 94 | (*GNUNET_DATACACHE_Iterator)(void *cls, |
94 | const struct GNUNET_HashCode *key, | 95 | const struct GNUNET_HashCode *key, |
95 | size_t data_size, | 96 | size_t data_size, |
96 | const char *data, | 97 | const char *data, |
97 | enum GNUNET_BLOCK_Type type, | 98 | enum GNUNET_BLOCK_Type type, |
98 | struct GNUNET_TIME_Absolute exp, | 99 | struct GNUNET_TIME_Absolute exp, |
99 | unsigned int path_info_len, | 100 | unsigned int path_info_len, |
100 | const struct GNUNET_PeerIdentity *path_info); | 101 | const struct GNUNET_DHT_PathElement *path_info); |
101 | 102 | ||
102 | 103 | ||
103 | /** | 104 | /** |
@@ -114,7 +115,7 @@ typedef int | |||
114 | * @param path_info a path through the network | 115 | * @param path_info a path through the network |
115 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error, #GNUNET_NO if duplicate | 116 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error, #GNUNET_NO if duplicate |
116 | */ | 117 | */ |
117 | int | 118 | enum GNUNET_GenericReturnValue |
118 | GNUNET_DATACACHE_put (struct GNUNET_DATACACHE_Handle *h, | 119 | GNUNET_DATACACHE_put (struct GNUNET_DATACACHE_Handle *h, |
119 | const struct GNUNET_HashCode *key, | 120 | const struct GNUNET_HashCode *key, |
120 | uint32_t xor_distance, | 121 | uint32_t xor_distance, |
@@ -123,7 +124,7 @@ GNUNET_DATACACHE_put (struct GNUNET_DATACACHE_Handle *h, | |||
123 | enum GNUNET_BLOCK_Type type, | 124 | enum GNUNET_BLOCK_Type type, |
124 | struct GNUNET_TIME_Absolute discard_time, | 125 | struct GNUNET_TIME_Absolute discard_time, |
125 | unsigned int path_info_len, | 126 | unsigned int path_info_len, |
126 | const struct GNUNET_PeerIdentity *path_info); | 127 | const struct GNUNET_DHT_PathElement *path_info); |
127 | 128 | ||
128 | 129 | ||
129 | /** | 130 | /** |
diff --git a/src/include/gnunet_datacache_plugin.h b/src/include/gnunet_datacache_plugin.h index 5d5cac12c..24570be72 100644 --- a/src/include/gnunet_datacache_plugin.h +++ b/src/include/gnunet_datacache_plugin.h | |||
@@ -124,7 +124,7 @@ struct GNUNET_DATACACHE_PluginFunctions | |||
124 | enum GNUNET_BLOCK_Type type, | 124 | enum GNUNET_BLOCK_Type type, |
125 | struct GNUNET_TIME_Absolute discard_time, | 125 | struct GNUNET_TIME_Absolute discard_time, |
126 | unsigned int path_info_len, | 126 | unsigned int path_info_len, |
127 | const struct GNUNET_PeerIdentity *path_info); | 127 | const struct GNUNET_DHT_PathElement *path_info); |
128 | 128 | ||
129 | 129 | ||
130 | /** | 130 | /** |
diff --git a/src/include/gnunet_dht_service.h b/src/include/gnunet_dht_service.h index 15da9ecdd..d33ef2f0d 100644 --- a/src/include/gnunet_dht_service.h +++ b/src/include/gnunet_dht_service.h | |||
@@ -257,7 +257,9 @@ GNUNET_DHT_put_cancel (struct GNUNET_DHT_PutHandle *ph); | |||
257 | * @param get_path_length number of entries in @a get_path | 257 | * @param get_path_length number of entries in @a get_path |
258 | * @param put_path peers on the PUT path (or NULL if not recorded) | 258 | * @param put_path peers on the PUT path (or NULL if not recorded) |
259 | * [0] = origin, [length - 1] = datastore | 259 | * [0] = origin, [length - 1] = datastore |
260 | * @param put_path_length number of entries in @a put_path | 260 | * @param put_path_length number of entries in @a put_path, |
261 | * note that the last signature will be all zeros as | ||
262 | * we did not forward and thus did not sign! | ||
261 | * @param type type of the result | 263 | * @param type type of the result |
262 | * @param size number of bytes in @a data | 264 | * @param size number of bytes in @a data |
263 | * @param data pointer to the result data | 265 | * @param data pointer to the result data |
@@ -266,9 +268,9 @@ typedef void | |||
266 | (*GNUNET_DHT_GetIterator) (void *cls, | 268 | (*GNUNET_DHT_GetIterator) (void *cls, |
267 | struct GNUNET_TIME_Absolute exp, | 269 | struct GNUNET_TIME_Absolute exp, |
268 | const struct GNUNET_HashCode *key, | 270 | const struct GNUNET_HashCode *key, |
269 | const struct GNUNET_PeerIdentity *get_path, | 271 | const struct GNUNET_DHT_PathElement *get_path, |
270 | unsigned int get_path_length, | 272 | unsigned int get_path_length, |
271 | const struct GNUNET_PeerIdentity *put_path, | 273 | const struct GNUNET_DHT_PathElement *put_path, |
272 | unsigned int put_path_length, | 274 | unsigned int put_path_length, |
273 | enum GNUNET_BLOCK_Type type, | 275 | enum GNUNET_BLOCK_Type type, |
274 | size_t size, | 276 | size_t size, |
@@ -343,6 +345,8 @@ struct GNUNET_DHT_MonitorHandle; | |||
343 | * @param hop_count Hop count so far. | 345 | * @param hop_count Hop count so far. |
344 | * @param path_length number of entries in @a path (or 0 if not recorded). | 346 | * @param path_length number of entries in @a path (or 0 if not recorded). |
345 | * @param path peers on the GET path (or NULL if not recorded). | 347 | * @param path peers on the GET path (or NULL if not recorded). |
348 | * note that the last signature will be all zeros as | ||
349 | * we did not forward and thus did not sign! | ||
346 | * @param desired_replication_level Desired replication level. | 350 | * @param desired_replication_level Desired replication level. |
347 | * @param key Key of the requested data. | 351 | * @param key Key of the requested data. |
348 | */ | 352 | */ |
@@ -353,7 +357,7 @@ typedef void | |||
353 | uint32_t hop_count, | 357 | uint32_t hop_count, |
354 | uint32_t desired_replication_level, | 358 | uint32_t desired_replication_level, |
355 | unsigned int path_length, | 359 | unsigned int path_length, |
356 | const struct GNUNET_PeerIdentity *path, | 360 | const struct GNUNET_DHT_PathElement *path, |
357 | const struct GNUNET_HashCode *key); | 361 | const struct GNUNET_HashCode *key); |
358 | 362 | ||
359 | 363 | ||
@@ -363,6 +367,8 @@ typedef void | |||
363 | * @param cls Closure. | 367 | * @param cls Closure. |
364 | * @param type The type of data in the result. | 368 | * @param type The type of data in the result. |
365 | * @param get_path Peers on GET path (or NULL if not recorded). | 369 | * @param get_path Peers on GET path (or NULL if not recorded). |
370 | * note that the last signature will be all zeros as | ||
371 | * we did not forward and thus did not sign! | ||
366 | * @param get_path_length number of entries in @a get_path. | 372 | * @param get_path_length number of entries in @a get_path. |
367 | * @param put_path peers on the PUT path (or NULL if not recorded). | 373 | * @param put_path peers on the PUT path (or NULL if not recorded). |
368 | * @param put_path_length number of entries in @a get_path. | 374 | * @param put_path_length number of entries in @a get_path. |
@@ -374,9 +380,9 @@ typedef void | |||
374 | typedef void | 380 | typedef void |
375 | (*GNUNET_DHT_MonitorGetRespCB) (void *cls, | 381 | (*GNUNET_DHT_MonitorGetRespCB) (void *cls, |
376 | enum GNUNET_BLOCK_Type type, | 382 | enum GNUNET_BLOCK_Type type, |
377 | const struct GNUNET_PeerIdentity *get_path, | 383 | const struct GNUNET_DHT_PathElement *get_path, |
378 | unsigned int get_path_length, | 384 | unsigned int get_path_length, |
379 | const struct GNUNET_PeerIdentity *put_path, | 385 | const struct GNUNET_DHT_PathElement *put_path, |
380 | unsigned int put_path_length, | 386 | unsigned int put_path_length, |
381 | struct GNUNET_TIME_Absolute exp, | 387 | struct GNUNET_TIME_Absolute exp, |
382 | const struct GNUNET_HashCode *key, | 388 | const struct GNUNET_HashCode *key, |
@@ -393,6 +399,8 @@ typedef void | |||
393 | * @param hop_count Hop count so far. | 399 | * @param hop_count Hop count so far. |
394 | * @param path_length number of entries in @a path (or 0 if not recorded). | 400 | * @param path_length number of entries in @a path (or 0 if not recorded). |
395 | * @param path peers on the PUT path (or NULL if not recorded). | 401 | * @param path peers on the PUT path (or NULL if not recorded). |
402 | * note that the last signature will be all zeros as | ||
403 | * we did not forward and thus did not sign! | ||
396 | * @param desired_replication_level Desired replication level. | 404 | * @param desired_replication_level Desired replication level. |
397 | * @param exp Expiration time of the data. | 405 | * @param exp Expiration time of the data. |
398 | * @param key Key under which data is to be stored. | 406 | * @param key Key under which data is to be stored. |
@@ -406,7 +414,7 @@ typedef void | |||
406 | uint32_t hop_count, | 414 | uint32_t hop_count, |
407 | uint32_t desired_replication_level, | 415 | uint32_t desired_replication_level, |
408 | unsigned int path_length, | 416 | unsigned int path_length, |
409 | const struct GNUNET_PeerIdentity *path, | 417 | const struct GNUNET_DHT_PathElement *path, |
410 | struct GNUNET_TIME_Absolute exp, | 418 | struct GNUNET_TIME_Absolute exp, |
411 | const struct GNUNET_HashCode *key, | 419 | const struct GNUNET_HashCode *key, |
412 | const void *data, | 420 | const void *data, |
@@ -446,6 +454,18 @@ void | |||
446 | GNUNET_DHT_monitor_stop (struct GNUNET_DHT_MonitorHandle *handle); | 454 | GNUNET_DHT_monitor_stop (struct GNUNET_DHT_MonitorHandle *handle); |
447 | 455 | ||
448 | 456 | ||
457 | /** | ||
458 | * Convert a peer path to a human-readable string. | ||
459 | * | ||
460 | * @param path array of path elements to convert to a string | ||
461 | * @param num_pids length of the @a pids array | ||
462 | * @return string representing the array of @a pids | ||
463 | */ | ||
464 | char * | ||
465 | GNUNET_DHT_pp2s (const struct GNUNET_DHT_PathElement *path, | ||
466 | unsigned int path_len); | ||
467 | |||
468 | |||
449 | #if 0 /* keep Emacsens' auto-indent happy */ | 469 | #if 0 /* keep Emacsens' auto-indent happy */ |
450 | { | 470 | { |
451 | #endif | 471 | #endif |
diff --git a/src/include/gnunet_strings_lib.h b/src/include/gnunet_strings_lib.h index 2e0c720ee..ef9d5ac58 100644 --- a/src/include/gnunet_strings_lib.h +++ b/src/include/gnunet_strings_lib.h | |||
@@ -457,18 +457,6 @@ GNUNET_STRINGS_urldecode (const char *data, | |||
457 | 457 | ||
458 | 458 | ||
459 | /** | 459 | /** |
460 | * Convert a peer path to a human-readable string. | ||
461 | * | ||
462 | * @param pids array of PIDs to convert to a string | ||
463 | * @param num_pids length of the @a pids array | ||
464 | * @return string representing the array of @a pids | ||
465 | */ | ||
466 | char * | ||
467 | GNUNET_STRINGS_pp2s (const struct GNUNET_PeerIdentity *pids, | ||
468 | unsigned int num_pids); | ||
469 | |||
470 | |||
471 | /** | ||
472 | * Parse a path that might be an URI. | 460 | * Parse a path that might be an URI. |
473 | * | 461 | * |
474 | * @param path path to parse. Must be NULL-terminated. | 462 | * @param path path to parse. Must be NULL-terminated. |