summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-01-09 12:22:04 +0100
committerChristian Grothoff <christian@grothoff.org>2022-01-09 12:22:04 +0100
commitec19c1e316efdd29a7af0524fc2ff33cc4b19d09 (patch)
tree184a59ff1c8408c462254e53f7e2004be829e237 /src
parentc3ecadd45b11f82e22ba81b42864c7826d0f97c6 (diff)
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')
-rw-r--r--src/cadet/gnunet-service-cadet_dht.c9
-rw-r--r--src/cadet/gnunet-service-cadet_paths.c8
-rw-r--r--src/cadet/gnunet-service-cadet_paths.h5
-rw-r--r--src/datacache/datacache.c2
-rw-r--r--src/datacache/perf_datacache.c16
-rw-r--r--src/datacache/plugin_datacache_heap.c11
-rw-r--r--src/datacache/plugin_datacache_postgres.c16
-rw-r--r--src/datacache/plugin_datacache_sqlite.c16
-rw-r--r--src/datacache/plugin_datacache_template.c2
-rw-r--r--src/datacache/test_datacache.c2
-rw-r--r--src/datacache/test_datacache_data_postgres.conf4
-rw-r--r--src/dht/dht_api.c177
-rw-r--r--src/dht/gnunet-dht-get.c78
-rw-r--r--src/dht/gnunet-dht-monitor.c8
-rw-r--r--src/dht/gnunet-dht-put.c75
-rw-r--r--src/dht/gnunet-service-dht.h6
-rw-r--r--src/dht/gnunet-service-dht_clients.c55
-rw-r--r--src/dht/gnunet-service-dht_datacache.c5
-rw-r--r--src/dht/gnunet-service-dht_datacache.h2
-rw-r--r--src/dht/gnunet-service-dht_neighbours.c200
-rw-r--r--src/dht/gnunet-service-dht_neighbours.h4
-rw-r--r--src/dht/gnunet-service-dht_routing.c6
-rw-r--r--src/dht/gnunet-service-dht_routing.h2
-rw-r--r--src/dht/gnunet_dht_profiler.c4
-rw-r--r--src/dht/test_dht_api.c4
-rw-r--r--src/dht/test_dht_monitor.c12
-rw-r--r--src/dht/test_dht_topo.c4
-rw-r--r--src/fs/gnunet-service-fs_pr.c4
-rw-r--r--src/gns/gnunet-service-gns_resolver.c4
-rw-r--r--src/include/gnunet_datacache_lib.h23
-rw-r--r--src/include/gnunet_datacache_plugin.h2
-rw-r--r--src/include/gnunet_dht_service.h34
-rw-r--r--src/include/gnunet_strings_lib.h12
-rw-r--r--src/pt/gnunet-daemon-pt.c4
-rw-r--r--src/regex/gnunet-regex-profiler.c83
-rw-r--r--src/regex/gnunet-service-regex.c22
-rw-r--r--src/regex/regex_internal.h15
-rw-r--r--src/regex/regex_internal_dht.c8
-rw-r--r--src/regex/regex_internal_lib.h4
-rw-r--r--src/util/strings.c23
40 files changed, 419 insertions, 552 deletions
diff --git a/src/cadet/gnunet-service-cadet_dht.c b/src/cadet/gnunet-service-cadet_dht.c
index 6caac474d..d44a50f50 100644
--- a/src/cadet/gnunet-service-cadet_dht.c
+++ b/src/cadet/gnunet-service-cadet_dht.c
@@ -112,16 +112,15 @@ static struct GNUNET_TIME_Relative announce_delay;
static void
dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute exp,
const struct GNUNET_HashCode *key,
- const struct GNUNET_PeerIdentity *get_path,
+ const struct GNUNET_DHT_PathElement *get_path,
unsigned int get_path_length,
- const struct GNUNET_PeerIdentity *put_path,
+ const struct GNUNET_DHT_PathElement *put_path,
unsigned int put_path_length,
enum GNUNET_BLOCK_Type type,
size_t size,
const void *data)
{
const struct GNUNET_HELLO_Message *hello = data;
- struct CadetPeer *peer;
GCPP_try_path_from_dht (get_path,
get_path_length,
@@ -131,7 +130,9 @@ dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute exp,
(ntohs (hello->header.size) == size) &&
(size == GNUNET_HELLO_size (hello)))
{
- peer = GCP_get (&put_path[0],
+ struct CadetPeer *peer;
+
+ peer = GCP_get (&put_path[0].pred,
GNUNET_YES);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Got HELLO for %s\n",
diff --git a/src/cadet/gnunet-service-cadet_paths.c b/src/cadet/gnunet-service-cadet_paths.c
index 2da4e2708..aa31aaa74 100644
--- a/src/cadet/gnunet-service-cadet_paths.c
+++ b/src/cadet/gnunet-service-cadet_paths.c
@@ -468,9 +468,9 @@ extend_path (struct CadetPeerPath *path,
* @return a path through the network
*/
void
-GCPP_try_path_from_dht (const struct GNUNET_PeerIdentity *get_path,
+GCPP_try_path_from_dht (const struct GNUNET_DHT_PathElement *get_path,
unsigned int get_path_length,
- const struct GNUNET_PeerIdentity *put_path,
+ const struct GNUNET_DHT_PathElement *put_path,
unsigned int put_path_length)
{
struct CadetPeer *cpath[get_path_length + put_path_length];
@@ -490,8 +490,8 @@ GCPP_try_path_from_dht (const struct GNUNET_PeerIdentity *get_path,
const struct GNUNET_PeerIdentity *pid;
pid = (off < get_path_length)
- ? &get_path[get_path_length - off - 1]
- : &put_path[get_path_length + put_path_length - off - 1];
+ ? &get_path[get_path_length - off - 1].pred
+ : &put_path[get_path_length + put_path_length - off - 1].pred;
/* Check that I am not in the path */
if (0 == GNUNET_memcmp (&my_full_id,
pid))
diff --git a/src/cadet/gnunet-service-cadet_paths.h b/src/cadet/gnunet-service-cadet_paths.h
index 3961dd721..afd193596 100644
--- a/src/cadet/gnunet-service-cadet_paths.h
+++ b/src/cadet/gnunet-service-cadet_paths.h
@@ -28,6 +28,7 @@
#define GNUNET_SERVICE_CADET_PATHS_H
#include "gnunet_util_lib.h"
+#include "gnunet_dht_service.h"
#include "gnunet-service-cadet.h"
/**
@@ -42,9 +43,9 @@
* @param put_path_length length of the @a put_path
*/
void
-GCPP_try_path_from_dht (const struct GNUNET_PeerIdentity *get_path,
+GCPP_try_path_from_dht (const struct GNUNET_DHT_PathElement *get_path,
unsigned int get_path_length,
- const struct GNUNET_PeerIdentity *put_path,
+ const struct GNUNET_DHT_PathElement *put_path,
unsigned int put_path_length);
diff --git a/src/datacache/datacache.c b/src/datacache/datacache.c
index 8b665e705..944a99aad 100644
--- a/src/datacache/datacache.c
+++ b/src/datacache/datacache.c
@@ -243,7 +243,7 @@ GNUNET_DATACACHE_put (struct GNUNET_DATACACHE_Handle *h,
enum GNUNET_BLOCK_Type type,
struct GNUNET_TIME_Absolute discard_time,
unsigned int path_info_len,
- const struct GNUNET_PeerIdentity *path_info)
+ const struct GNUNET_DHT_PathElement *path_info)
{
ssize_t used;
diff --git a/src/datacache/perf_datacache.c b/src/datacache/perf_datacache.c
index ce3b4c25d..84bc4a852 100644
--- a/src/datacache/perf_datacache.c
+++ b/src/datacache/perf_datacache.c
@@ -47,21 +47,27 @@ static const char *plugin_name;
static int
checkIt (void *cls,
- const struct GNUNET_HashCode *key, size_t size, const char *data,
+ const struct GNUNET_HashCode *key,
+ size_t size,
+ const char *data,
enum GNUNET_BLOCK_Type type,
struct GNUNET_TIME_Absolute exp,
unsigned int path_len,
- const struct GNUNET_PeerIdentity *path)
+ const struct GNUNET_DHT_PathElement *path)
{
- if ((size == sizeof(struct GNUNET_HashCode)) && (0 == memcmp (data, cls,
- size)))
+ if ( (size == sizeof(struct GNUNET_HashCode)) &&
+ (0 == memcmp (data,
+ cls,
+ size)) )
found++;
return GNUNET_OK;
}
static void
-run (void *cls, char *const *args, const char *cfgfile,
+run (void *cls,
+ char *const *args,
+ const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct GNUNET_DATACACHE_Handle *h;
diff --git a/src/datacache/plugin_datacache_heap.c b/src/datacache/plugin_datacache_heap.c
index 20d18458d..fbd3aea9a 100644
--- a/src/datacache/plugin_datacache_heap.c
+++ b/src/datacache/plugin_datacache_heap.c
@@ -80,7 +80,7 @@ struct Value
/**
* Path information.
*/
- struct GNUNET_PeerIdentity *path_info;
+ struct GNUNET_DHT_PathElement *path_info;
/**
* Payload (actual payload follows this struct)
@@ -125,7 +125,7 @@ struct PutContext
/**
* Path information.
*/
- const struct GNUNET_PeerIdentity *path_info;
+ const struct GNUNET_DHT_PathElement *path_info;
/**
* Number of bytes in @e data.
@@ -181,7 +181,8 @@ put_cb (void *cls,
put_ctx->path_info_len);
GNUNET_memcpy (val->path_info,
put_ctx->path_info,
- put_ctx->path_info_len * sizeof(struct GNUNET_PeerIdentity));
+ put_ctx->path_info_len * sizeof(struct
+ GNUNET_DHT_PathElement));
GNUNET_CONTAINER_heap_update_cost (val->hn,
val->discard_time.abs_value_us);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -219,7 +220,7 @@ heap_plugin_put (void *cls,
enum GNUNET_BLOCK_Type type,
struct GNUNET_TIME_Absolute discard_time,
unsigned int path_info_len,
- const struct GNUNET_PeerIdentity *path_info)
+ const struct GNUNET_DHT_PathElement *path_info)
{
struct Plugin *plugin = cls;
struct Value *val;
@@ -255,7 +256,7 @@ heap_plugin_put (void *cls,
path_info_len);
GNUNET_memcpy (val->path_info,
path_info,
- path_info_len * sizeof(struct GNUNET_PeerIdentity));
+ path_info_len * sizeof(struct GNUNET_DHT_PathElement));
(void) GNUNET_CONTAINER_multihashmap_put (plugin->map,
&val->key,
val,
diff --git a/src/datacache/plugin_datacache_postgres.c b/src/datacache/plugin_datacache_postgres.c
index 070619137..6a44c44a5 100644
--- a/src/datacache/plugin_datacache_postgres.c
+++ b/src/datacache/plugin_datacache_postgres.c
@@ -156,7 +156,7 @@ postgres_plugin_put (void *cls,
enum GNUNET_BLOCK_Type type,
struct GNUNET_TIME_Absolute discard_time,
unsigned int path_info_len,
- const struct GNUNET_PeerIdentity *path_info)
+ const struct GNUNET_DHT_PathElement *path_info)
{
struct Plugin *plugin = cls;
uint32_t type32 = (uint32_t) type;
@@ -168,7 +168,7 @@ postgres_plugin_put (void *cls,
GNUNET_PQ_query_param_fixed_size (data, data_size),
GNUNET_PQ_query_param_fixed_size (path_info,
path_info_len * sizeof(struct
- GNUNET_PeerIdentity)),
+ GNUNET_DHT_PathElement)),
GNUNET_PQ_query_param_end
};
enum GNUNET_DB_QueryStatus ret;
@@ -227,7 +227,7 @@ handle_results (void *cls,
uint32_t type;
void *data;
size_t data_size;
- struct GNUNET_PeerIdentity *path;
+ struct GNUNET_DHT_PathElement *path;
size_t path_len;
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_absolute_time ("discard_time",
@@ -251,12 +251,12 @@ handle_results (void *cls,
GNUNET_break (0);
return;
}
- if (0 != (path_len % sizeof(struct GNUNET_PeerIdentity)))
+ if (0 != (path_len % sizeof(struct GNUNET_DHT_PathElement)))
{
GNUNET_break (0);
path_len = 0;
}
- path_len %= sizeof(struct GNUNET_PeerIdentity);
+ path_len %= sizeof(struct GNUNET_DHT_PathElement);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Found result of size %u bytes and type %u in database\n",
(unsigned int) data_size,
@@ -446,7 +446,7 @@ extract_result_cb (void *cls,
uint32_t type;
void *data;
size_t data_size;
- struct GNUNET_PeerIdentity *path;
+ struct GNUNET_DHT_PathElement *path;
size_t path_len;
struct GNUNET_HashCode key;
struct GNUNET_PQ_ResultSpec rs[] = {
@@ -473,12 +473,12 @@ extract_result_cb (void *cls,
GNUNET_break (0);
return;
}
- if (0 != (path_len % sizeof(struct GNUNET_PeerIdentity)))
+ if (0 != (path_len % sizeof(struct GNUNET_DHT_PathElement)))
{
GNUNET_break (0);
path_len = 0;
}
- path_len %= sizeof(struct GNUNET_PeerIdentity);
+ path_len %= sizeof(struct GNUNET_DHT_PathElement);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Found result of size %u bytes and type %u in database\n",
(unsigned int) data_size,
diff --git a/src/datacache/plugin_datacache_sqlite.c b/src/datacache/plugin_datacache_sqlite.c
index 0c894556b..d08b32caf 100644
--- a/src/datacache/plugin_datacache_sqlite.c
+++ b/src/datacache/plugin_datacache_sqlite.c
@@ -192,7 +192,7 @@ sqlite_plugin_put (void *cls,
enum GNUNET_BLOCK_Type type,
struct GNUNET_TIME_Absolute discard_time,
unsigned int path_info_len,
- const struct GNUNET_PeerIdentity *path_info)
+ const struct GNUNET_DHT_PathElement *path_info)
{
struct Plugin *plugin = cls;
uint32_t type32 = type;
@@ -204,7 +204,7 @@ sqlite_plugin_put (void *cls,
GNUNET_SQ_query_param_fixed_size (data, size),
GNUNET_SQ_query_param_fixed_size (path_info,
path_info_len
- * sizeof(struct GNUNET_PeerIdentity)),
+ * sizeof(struct GNUNET_DHT_PathElement)),
GNUNET_SQ_query_param_end };
LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -265,7 +265,7 @@ sqlite_plugin_get (void *cls,
uint32_t off;
unsigned int total;
size_t psize;
- struct GNUNET_PeerIdentity *path;
+ struct GNUNET_DHT_PathElement *path;
struct GNUNET_SQ_QueryParam params_count[] =
{ GNUNET_SQ_query_param_auto_from_type (key),
GNUNET_SQ_query_param_uint32 (&type32),
@@ -339,13 +339,13 @@ sqlite_plugin_get (void *cls,
GNUNET_SQ_reset (plugin->dbh, plugin->get_stmt);
break;
}
- if (0 != psize % sizeof(struct GNUNET_PeerIdentity))
+ if (0 != psize % sizeof(struct GNUNET_DHT_PathElement))
{
GNUNET_break (0);
psize = 0;
path = NULL;
}
- psize /= sizeof(struct GNUNET_PeerIdentity);
+ psize /= sizeof(struct GNUNET_DHT_PathElement);
cnt++;
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Found %u-byte result when processing GET for key `%s'\n",
@@ -476,7 +476,7 @@ sqlite_plugin_get_closest (void *cls,
size_t psize;
uint32_t type;
struct GNUNET_HashCode hc;
- struct GNUNET_PeerIdentity *path;
+ struct GNUNET_DHT_PathElement *path;
struct GNUNET_SQ_QueryParam params[] =
{ GNUNET_SQ_query_param_auto_from_type (key),
GNUNET_SQ_query_param_absolute_time (&now),
@@ -510,13 +510,13 @@ sqlite_plugin_get_closest (void *cls,
GNUNET_break (0);
break;
}
- if (0 != psize % sizeof(struct GNUNET_PeerIdentity))
+ if (0 != psize % sizeof(struct GNUNET_DHT_PathElement))
{
GNUNET_break (0);
psize = 0;
path = NULL;
}
- psize /= sizeof(struct GNUNET_PeerIdentity);
+ psize /= sizeof(struct GNUNET_DHT_PathElement);
cnt++;
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Found %u-byte result at %s when processing GET_CLOSE\n",
diff --git a/src/datacache/plugin_datacache_template.c b/src/datacache/plugin_datacache_template.c
index 09279f55c..231413ce9 100644
--- a/src/datacache/plugin_datacache_template.c
+++ b/src/datacache/plugin_datacache_template.c
@@ -63,7 +63,7 @@ template_plugin_put (void *cls,
enum GNUNET_BLOCK_Type type,
struct GNUNET_TIME_Absolute discard_time,
unsigned int path_info_len,
- const struct GNUNET_PeerIdentity *path_info)
+ const struct GNUNET_DHT_PathElement *path_info)
{
GNUNET_break (0);
return -1;
diff --git a/src/datacache/test_datacache.c b/src/datacache/test_datacache.c
index 6f6e4eec1..5740d2b7d 100644
--- a/src/datacache/test_datacache.c
+++ b/src/datacache/test_datacache.c
@@ -46,7 +46,7 @@ checkIt (void *cls,
enum GNUNET_BLOCK_Type type,
struct GNUNET_TIME_Absolute exp,
unsigned int path_len,
- const struct GNUNET_PeerIdentity *path)
+ const struct GNUNET_DHT_PathElement *path)
{
(void) key;
(void) type;
diff --git a/src/datacache/test_datacache_data_postgres.conf b/src/datacache/test_datacache_data_postgres.conf
index 47c954b55..92313157c 100644
--- a/src/datacache/test_datacache_data_postgres.conf
+++ b/src/datacache/test_datacache_data_postgres.conf
@@ -4,6 +4,4 @@ QUOTA = 1 MB
DATABASE = postgres
[datacache-postgres]
-CONFIG = connect_timeout=10; dbname=gnunetcheck
-
-
+CONFIG = postgres:///gnunetcheck
diff --git a/src/dht/dht_api.c b/src/dht/dht_api.c
index 727f1a1f6..1ba2f7277 100644
--- a/src/dht/dht_api.c
+++ b/src/dht/dht_api.c
@@ -260,7 +260,7 @@ struct GNUNET_DHT_Handle
* @param h DHT handle to reconnect
* @return #GNUNET_YES on success, #GNUNET_NO on failure.
*/
-static int
+static enum GNUNET_GenericReturnValue
try_connect (struct GNUNET_DHT_Handle *h);
@@ -344,7 +344,7 @@ send_get_known_results (struct GNUNET_DHT_GetHandle *gh,
* @param value the `struct GNUNET_DHT_GetHandle *`
* @return #GNUNET_YES (always)
*/
-static int
+static enum GNUNET_GenericReturnValue
add_get_request_to_pending (void *cls,
const struct GNUNET_HashCode *key,
void *value)
@@ -488,7 +488,7 @@ mq_error_handler (void *cls,
* @return #GNUNET_OK if everything went fine,
* #GNUNET_SYSERR if the message is malformed.
*/
-static int
+static enum GNUNET_GenericReturnValue
check_monitor_get (void *cls,
const struct GNUNET_DHT_MonitorGetMessage *msg)
{
@@ -496,7 +496,7 @@ check_monitor_get (void *cls,
uint16_t msize = ntohs (msg->header.size) - sizeof(*msg);
if ((plen > UINT16_MAX) ||
- (plen * sizeof(struct GNUNET_PeerIdentity) != msize))
+ (plen * sizeof(struct GNUNET_DHT_PathElement) != msize))
{
GNUNET_break (0);
return GNUNET_SYSERR;
@@ -534,7 +534,7 @@ handle_monitor_get (void *cls,
ntohl (msg->hop_count),
ntohl (msg->desired_replication_level),
ntohl (msg->get_path_length),
- (struct GNUNET_PeerIdentity *) &msg[1],
+ (struct GNUNET_DHT_PathElement *) &msg[1],
&msg->key);
}
}
@@ -548,7 +548,7 @@ handle_monitor_get (void *cls,
* @return #GNUNET_OK if everything went fine,
* #GNUNET_SYSERR if the message is malformed.
*/
-static int
+static enum GNUNET_GenericReturnValue
check_monitor_get_resp (void *cls,
const struct GNUNET_DHT_MonitorGetRespMessage *msg)
{
@@ -557,7 +557,7 @@ check_monitor_get_resp (void *cls,
uint32_t putl = ntohl (msg->put_path_length);
if ((getl + putl < getl) ||
- ((msize / sizeof(struct GNUNET_PeerIdentity)) < getl + putl))
+ ((msize / sizeof(struct GNUNET_DHT_PathElement)) < getl + putl))
{
GNUNET_break (0);
return GNUNET_SYSERR;
@@ -578,12 +578,12 @@ handle_monitor_get_resp (void *cls,
{
struct GNUNET_DHT_Handle *handle = cls;
size_t msize = ntohs (msg->header.size) - sizeof(*msg);
- const struct GNUNET_PeerIdentity *path;
+ const struct GNUNET_DHT_PathElement *path;
uint32_t getl = ntohl (msg->get_path_length);
uint32_t putl = ntohl (msg->put_path_length);
struct GNUNET_DHT_MonitorHandle *mh;
- path = (const struct GNUNET_PeerIdentity *) &msg[1];
+ path = (const struct GNUNET_DHT_PathElement *) &msg[1];
for (mh = handle->monitor_head; NULL != mh; mh = mh->next)
{
if (NULL == mh->get_resp_cb)
@@ -603,8 +603,8 @@ handle_monitor_get_resp (void *cls,
GNUNET_TIME_absolute_ntoh (msg->expiration_time),
&msg->key,
(const void *) &path[getl + putl],
- msize - sizeof(struct GNUNET_PeerIdentity) * (putl
- + getl));
+ msize - sizeof(struct GNUNET_DHT_PathElement) * (putl
+ + getl));
}
}
@@ -617,7 +617,7 @@ handle_monitor_get_resp (void *cls,
* @return #GNUNET_OK if everything went fine,
* #GNUNET_SYSERR if the message is malformed.
*/
-static int
+static enum GNUNET_GenericReturnValue
check_monitor_put (void *cls,
const struct GNUNET_DHT_MonitorPutMessage *msg)
{
@@ -626,7 +626,7 @@ check_monitor_put (void *cls,
msize = ntohs (msg->header.size) - sizeof(*msg);
putl = ntohl (msg->put_path_length);
- if ((msize / sizeof(struct GNUNET_PeerIdentity)) < putl)
+ if ((msize / sizeof(struct GNUNET_DHT_PathElement)) < putl)
{
GNUNET_break (0);
return GNUNET_SYSERR;
@@ -648,10 +648,10 @@ handle_monitor_put (void *cls,
struct GNUNET_DHT_Handle *handle = cls;
size_t msize = ntohs (msg->header.size) - sizeof(*msg);
uint32_t putl = ntohl (msg->put_path_length);
- const struct GNUNET_PeerIdentity *path;
+ const struct GNUNET_DHT_PathElement *path;
struct GNUNET_DHT_MonitorHandle *mh;
- path = (const struct GNUNET_PeerIdentity *) &msg[1];
+ path = (const struct GNUNET_DHT_PathElement *) &msg[1];
for (mh = handle->monitor_head; NULL != mh; mh = mh->next)
{
if (NULL == mh->put_cb)
@@ -672,7 +672,7 @@ handle_monitor_put (void *cls,
GNUNET_TIME_absolute_ntoh (msg->expiration_time),
&msg->key,
(const void *) &path[putl],
- msize - sizeof(struct GNUNET_PeerIdentity) * putl);
+ msize - sizeof(struct GNUNET_DHT_PathElement) * putl);
}
}
@@ -685,7 +685,7 @@ handle_monitor_put (void *cls,
* @return #GNUNET_OK if everything went fine,
* #GNUNET_SYSERR if the message is malformed.
*/
-static int
+static enum GNUNET_GenericReturnValue
check_client_result (void *cls,
const struct GNUNET_DHT_ClientResultMessage *msg)
{
@@ -695,12 +695,12 @@ check_client_result (void *cls,
size_t meta_length;
meta_length =
- sizeof(struct GNUNET_PeerIdentity) * (get_path_length + put_path_length);
+ sizeof(struct GNUNET_DHT_PathElement) * (get_path_length + put_path_length);
if ((msize < meta_length) ||
(get_path_length >
- GNUNET_MAX_MESSAGE_SIZE / sizeof(struct GNUNET_PeerIdentity)) ||
+ GNUNET_MAX_MESSAGE_SIZE / sizeof(struct GNUNET_DHT_PathElement)) ||
(put_path_length >
- GNUNET_MAX_MESSAGE_SIZE / sizeof(struct GNUNET_PeerIdentity)))
+ GNUNET_MAX_MESSAGE_SIZE / sizeof(struct GNUNET_DHT_PathElement)))
{
GNUNET_break (0);
return GNUNET_SYSERR;
@@ -717,7 +717,7 @@ check_client_result (void *cls,
* @param value the `struct GNUNET_DHT_GetHandle` of a request matching the same key
* @return #GNUNET_YES to continue to iterate over all results
*/
-static int
+static enum GNUNET_GenericReturnValue
process_client_result (void *cls,
const struct GNUNET_HashCode *key,
void *value)
@@ -727,8 +727,8 @@ process_client_result (void *cls,
size_t msize = ntohs (crm->header.size) - sizeof(*crm);
uint32_t put_path_length = ntohl (crm->put_path_length);
uint32_t get_path_length = ntohl (crm->get_path_length);
- const struct GNUNET_PeerIdentity *put_path;
- const struct GNUNET_PeerIdentity *get_path;
+ const struct GNUNET_DHT_PathElement *put_path;
+ const struct GNUNET_DHT_PathElement *get_path;
struct GNUNET_HashCode hc;
size_t data_length;
size_t meta_length;
@@ -746,18 +746,18 @@ process_client_result (void *cls,
}
/* FIXME: might want to check that type matches */
meta_length =
- sizeof(struct GNUNET_PeerIdentity) * (get_path_length + put_path_length);
+ sizeof(struct GNUNET_DHT_PathElement) * (get_path_length + put_path_length);
data_length = msize - meta_length;
- put_path = (const struct GNUNET_PeerIdentity *) &crm[1];
+ put_path = (const struct GNUNET_DHT_PathElement *) &crm[1];
get_path = &put_path[put_path_length];
{
char *pp;
char *gp;
- gp = GNUNET_STRINGS_pp2s (get_path,
- get_path_length);
- pp = GNUNET_STRINGS_pp2s (put_path,
- put_path_length);
+ gp = GNUNET_DHT_pp2s (get_path,
+ get_path_length);
+ pp = GNUNET_DHT_pp2s (put_path,
+ put_path_length);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Giving %u byte reply for %s to application (GP: %s, PP: %s)\n",
(unsigned int) data_length,
@@ -838,7 +838,7 @@ handle_put_cont (void *cls)
* @param h DHT handle to reconnect
* @return #GNUNET_YES on success, #GNUNET_NO on failure.
*/
-static int
+static enum GNUNET_GenericReturnValue
try_connect (struct GNUNET_DHT_Handle *h)
{
struct GNUNET_MQ_MessageHandler handlers[] = {
@@ -878,14 +878,6 @@ try_connect (struct GNUNET_DHT_Handle *h)
}
-/**
- * Initialize the connection with the DHT service.
- *
- * @param cfg configuration to use
- * @param ht_len size of the internal hash table to use for
- * processing multiple GET/FIND requests in parallel
- * @return handle to the DHT service, or NULL on error
- */
struct GNUNET_DHT_Handle *
GNUNET_DHT_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
unsigned int ht_len)
@@ -909,11 +901,6 @@ GNUNET_DHT_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
}
-/**
- * Shutdown connection with the DHT service.
- *
- * @param handle handle of the DHT connection to stop
- */
void
GNUNET_DHT_disconnect (struct GNUNET_DHT_Handle *handle)
{
@@ -942,26 +929,6 @@ GNUNET_DHT_disconnect (struct GNUNET_DHT_Handle *handle)
}
-/**
- * Perform a PUT operation storing data in the DHT. FIXME: we should
- * change the protocol to get a confirmation for the PUT from the DHT
- * and call 'cont' only after getting the confirmation; otherwise, the
- * client has no good way of telling if the 'PUT' message actually got
- * to the DHT service!
- *
- * @param handle handle to DHT service
- * @param key the key to store under
- * @param desired_replication_level estimate of how many
- * nearest peers this request should reach
- * @param options routing options for this message
- * @param type type of the value
- * @param size number of bytes in data; must be less than 64k
- * @param data the data to store
- * @param exp desired expiration time for the value
- * @param cont continuation to call when done (transmitting request to service)
- * You must not call #GNUNET_DHT_disconnect in this continuation
- * @param cont_cls closure for @a cont
- */
struct GNUNET_DHT_PutHandle *
GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle,
const struct GNUNET_HashCode *key,
@@ -1020,17 +987,6 @@ GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle,
}
-/**
- * Cancels a DHT PUT operation. Note that the PUT request may still
- * go out over the network (we can't stop that); However, if the PUT
- * has not yet been sent to the service, cancelling the PUT will stop
- * this from happening (but there is no way for the user of this API
- * to tell if that is the case). The only use for this API is to
- * prevent a later call to 'cont' from #GNUNET_DHT_put (e.g. because
- * the system is shutting down).
- *
- * @param ph put operation to cancel ('cont' will no longer be called)
- */
void
GNUNET_DHT_put_cancel (struct GNUNET_DHT_PutHandle *ph)
{
@@ -1047,21 +1003,6 @@ GNUNET_DHT_put_cancel (struct GNUNET_DHT_PutHandle *ph)
}
-/**
- * Perform an asynchronous GET operation on the DHT identified.
- *
- * @param handle handle to the DHT service
- * @param type expected type of the response object
- * @param key the key to look up
- * @param desired_replication_level estimate of how many
- nearest peers this request should reach
- * @param options routing options for this message
- * @param xquery extended query data (can be NULL, depending on type)
- * @param xquery_size number of bytes in @a xquery
- * @param iter function to call on each result
- * @param iter_cls closure for @a iter
- * @return handle to stop the async get
- */
struct GNUNET_DHT_GetHandle *
GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle,
enum GNUNET_BLOCK_Type type,
@@ -1111,16 +1052,6 @@ GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle,
}
-/**
- * Tell the DHT not to return any of the following known results
- * to this client.
- *
- * @param get_handle get operation for which results should be filtered
- * @param num_results number of results to be blocked that are
- * provided in this call (size of the @a results array)
- * @param results array of hash codes over the 'data' of the results
- * to be blocked
- */
void
GNUNET_DHT_get_filter_known_results (struct GNUNET_DHT_GetHandle *get_handle,
unsigned int num_results,
@@ -1145,11 +1076,6 @@ GNUNET_DHT_get_filter_known_results (struct GNUNET_DHT_GetHandle *get_handle,
}
-/**
- * Stop async DHT-get.
- *
- * @param get_handle handle to the GET operation to stop
- */
void
GNUNET_DHT_get_stop (struct GNUNET_DHT_GetHandle *get_handle)
{
@@ -1183,18 +1109,6 @@ GNUNET_DHT_get_stop (struct GNUNET_DHT_GetHandle *get_handle)
}
-/**
- * Start monitoring the local DHT service.
- *
- * @param handle Handle to the DHT service.
- * @param type Type of blocks that are of interest.
- * @param key Key of data of interest, NULL for all.
- * @param get_cb Callback to process monitored get messages.
- * @param get_resp_cb Callback to process monitored get response messages.
- * @param put_cb Callback to process monitored put messages.
- * @param cb_cls Closure for callbacks.
- * @return Handle to stop monitoring.
- */
struct GNUNET_DHT_MonitorHandle *
GNUNET_DHT_monitor_start (struct GNUNET_DHT_Handle *handle,
enum GNUNET_BLOCK_Type type,
@@ -1227,13 +1141,6 @@ GNUNET_DHT_monitor_start (struct GNUNET_DHT_Handle *handle,
}
-/**
- * Stop monitoring.
- *
- * @param mh The handle to the monitor request returned by monitor_start.
- *
- * On return get_handle will no longer be valid, caller must not use again!!!
- */
void
GNUNET_DHT_monitor_stop (struct GNUNET_DHT_MonitorHandle *mh)
{
@@ -1262,4 +1169,28 @@ GNUNET_DHT_monitor_stop (struct GNUNET_DHT_MonitorHandle *mh)
}
+char *
+GNUNET_DHT_pp2s (const struct GNUNET_DHT_PathElement *path,
+ unsigned int path_len)
+{
+ char *buf;
+ size_t off;
+ size_t plen = path_len * 5 + 1;
+
+ GNUNET_assert (path_len < UINT32_MAX / 5);
+ off = 0;
+ buf = GNUNET_malloc (plen);
+ for (unsigned int i = 0; i < path_len; i++)
+ {
+ off += GNUNET_snprintf (&buf[off],
+ plen - off,
+ "%s%s",
+ GNUNET_i2s (&path[i].pred),
+ (i == path_len - 1) ? "" : "-");
+ }
+ return buf;
+
+}
+
+
/* end of dht_api.c */
diff --git a/src/dht/gnunet-dht-get.c b/src/dht/gnunet-dht-get.c
index c8a1cb735..f1076490b 100644
--- a/src/dht/gnunet-dht-get.c
+++ b/src/dht/gnunet-dht-get.c
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2009 GNUnet e.V.
+ Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2009, 2022 GNUnet e.V.
GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
@@ -146,16 +146,17 @@ static void
get_result_iterator (void *cls,
struct GNUNET_TIME_Absolute exp,
const struct GNUNET_HashCode *key,
- const struct GNUNET_PeerIdentity *get_path,
+ const struct GNUNET_DHT_PathElement *get_path,
unsigned int get_path_length,
- const struct GNUNET_PeerIdentity *put_path,
+ const struct GNUNET_DHT_PathElement *put_path,
unsigned int put_path_length,
enum GNUNET_BLOCK_Type type,
size_t size,
const void *data)
{
fprintf (stdout,
- (GNUNET_BLOCK_TYPE_TEST == type) ? _ ("Result %d, type %d:\n%.*s\n")
+ (GNUNET_BLOCK_TYPE_TEST == type)
+ ? _ ("Result %d, type %d:\n%.*s\n")
: _ ("Result %d, type %d:\n"),
result_count,
type,
@@ -163,13 +164,22 @@ get_result_iterator (void *cls,
(char *) data);
if (verbose)
{
- fprintf (stdout, " GET path: ");
+ fprintf (stdout,
+ " GET path: ");
for (unsigned int i = 0; i < get_path_length; i++)
- fprintf (stdout, "%s%s", (0 == i) ? "" : "-", GNUNET_i2s (&get_path[i]));
- fprintf (stdout, "\n PUT path: ");
+ fprintf (stdout,
+ "%s%s",
+ (0 == i) ? "" : "-",
+ GNUNET_i2s (&get_path[i].pred));
+ fprintf (stdout,
+ "\n PUT path: ");
for (unsigned int i = 0; i < put_path_length; i++)
- fprintf (stdout, "%s%s", (0 == i) ? "" : "-", GNUNET_i2s (&put_path[i]));
- fprintf (stdout, "\n");
+ fprintf (stdout,
+ "%s%s",
+ (0 == i) ? "" : "-",
+ GNUNET_i2s (&put_path[i].pred));
+ fprintf (stdout,
+ "\n");
}
result_count++;
}
@@ -194,13 +204,17 @@ run (void *cls,
cfg = c;
if (NULL == query_key)
{
- fprintf (stderr, "%s", _ ("Must provide key for DHT GET!\n"));
+ fprintf (stderr,
+ "%s",
+ _ ("Must provide key for DHT GET!\n"));
ret = 1;
return;
}
if (NULL == (dht_handle = GNUNET_DHT_connect (cfg, 1)))
{
- fprintf (stderr, "%s", _ ("Failed to connect to DHT service!\n"));
+ fprintf (stderr,
+ "%s",
+ _ ("Failed to connect to DHT service!\n"));
ret = 1;
return;
}
@@ -238,39 +252,45 @@ run (void *cls,
int
main (int argc, char *const *argv)
{
- struct GNUNET_GETOPT_CommandLineOption options[] =
- { GNUNET_GETOPT_option_string ('k',
- "key",
- "KEY",
- gettext_noop ("the query key"),
- &query_key),
+ struct GNUNET_GETOPT_CommandLineOption options[] = {
+ GNUNET_GETOPT_option_string (
+ 'k',
+ "key",
+ "KEY",
+ gettext_noop ("the query key"),
+ &query_key),
GNUNET_GETOPT_option_uint (
'r',
"replication",
"LEVEL",
gettext_noop ("how many parallel requests (replicas) to create"),
&replication),
- GNUNET_GETOPT_option_uint ('t',
- "type",
- "TYPE",
- gettext_noop ("the type of data to look for"),
- &query_type),
+ GNUNET_GETOPT_option_uint (
+ 't',
+ "type",
+ "TYPE",
+ gettext_noop ("the type of data to look for"),
+ &query_type),
GNUNET_GETOPT_option_relative_time (
'T',
"timeout",
"TIMEOUT",
gettext_noop ("how long to execute this query before giving up?"),
&timeout_request),
- GNUNET_GETOPT_option_flag ('x',
- "demultiplex",
- gettext_noop (
- "use DHT's demultiplex everywhere option"),
- &demultixplex_everywhere),
+ GNUNET_GETOPT_option_flag (
+ 'x',
+ "demultiplex",
+ gettext_noop (
+ "use DHT's demultiplex everywhere option"),
+ &demultixplex_everywhere),
GNUNET_GETOPT_option_verbose (&verbose),
- GNUNET_GETOPT_OPTION_END };
+ GNUNET_GETOPT_OPTION_END
+ };
- if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
+ if (GNUNET_OK !=
+ GNUNET_STRINGS_get_utf8_args (argc, argv,
+ &argc, &argv))
return 2;
return (GNUNET_OK ==
GNUNET_PROGRAM_run (
diff --git a/src/dht/gnunet-dht-monitor.c b/src/dht/gnunet-dht-monitor.c
index 8dc14e223..b4ec497e4 100644
--- a/src/dht/gnunet-dht-monitor.c
+++ b/src/dht/gnunet-dht-monitor.c
@@ -137,7 +137,7 @@ get_callback (void *cls,
uint32_t hop_count,
uint32_t desired_replication_level,
unsigned int path_length,
- const struct GNUNET_PeerIdentity *path,
+ const struct GNUNET_DHT_PathElement *path,
const struct GNUNET_HashCode *key)
{
fprintf (stdout,
@@ -166,9 +166,9 @@ get_callback (void *cls,
static void
get_resp_callback (void *cls,
enum GNUNET_BLOCK_Type type,
- const struct GNUNET_PeerIdentity *get_path,
+ const struct GNUNET_DHT_PathElement *get_path,
unsigned int get_path_length,
- const struct GNUNET_PeerIdentity *put_path,
+ const struct GNUNET_DHT_PathElement *put_path,
unsigned int put_path_length,
struct GNUNET_TIME_Absolute exp,
const struct GNUNET_HashCode *key,
@@ -211,7 +211,7 @@ put_callback (void *cls,
uint32_t hop_count,
uint32_t desired_replication_level,
unsigned int path_length,
- const struct GNUNET_PeerIdentity *path,
+ const struct GNUNET_DHT_PathElement *path,
struct GNUNET_TIME_Absolute exp,
const struct GNUNET_HashCode *key,
const void *data,
diff --git a/src/dht/gnunet-dht-put.c b/src/dht/gnunet-dht-put.c
index 7ee4ec185..531107ef2 100644
--- a/src/dht/gnunet-dht-put.c
+++ b/src/dht/gnunet-dht-put.c
@@ -179,48 +179,57 @@ run (void *cls,
int
main (int argc, char *const *argv)
{
- struct GNUNET_GETOPT_CommandLineOption options[] =
- { GNUNET_GETOPT_option_string ('d',
- "data",
- "DATA",
- gettext_noop (
- "the data to insert under the key"),
- &data),
+ struct GNUNET_GETOPT_CommandLineOption options[] = {
+ GNUNET_GETOPT_option_string (
+ 'd',
+ "data",
+ "DATA",
+ gettext_noop (
+ "the data to insert under the key"),
+ &data),
GNUNET_GETOPT_option_relative_time (
'e',
"expiration",
"EXPIRATION",
gettext_noop ("how long to store this entry in the dht (in seconds)"),
&expiration),
- GNUNET_GETOPT_option_string ('k',
- "key",
- "KEY",
- gettext_noop ("the query key"),
- &query_key),
- GNUNET_GETOPT_option_flag ('x',
- "demultiplex",
- gettext_noop (
- "use DHT's demultiplex everywhere option"),
- &demultixplex_everywhere),
- GNUNET_GETOPT_option_uint ('r',
- "replication",
- "LEVEL",
- gettext_noop ("how many replicas to create"),
- &replication),
- GNUNET_GETOPT_option_flag ('R',
- "record",
- gettext_noop ("use DHT's record route option"),
- &record_route),
- GNUNET_GETOPT_option_uint ('t',
- "type",
- "TYPE",
- gettext_noop ("the type to insert data as"),
- &query_type),
+ GNUNET_GETOPT_option_string (
+ 'k',
+ "key",
+ "KEY",
+ gettext_noop ("the query key"),
+ &query_key),
+ GNUNET_GETOPT_option_flag (
+ 'x',
+ "demultiplex",
+ gettext_noop (
+ "use DHT's demultiplex everywhere option"),
+ &demultixplex_everywhere),
+ GNUNET_GETOPT_option_uint (
+ 'r',
+ "replication",
+ "LEVEL",
+ gettext_noop ("how many replicas to create"),
+ &replication),
+ GNUNET_GETOPT_option_flag (
+ 'R',
+ "record",
+ gettext_noop ("use DHT's record route option"),
+ &record_route),
+ GNUNET_GETOPT_option_uint (
+ 't',
+ "type",
+ "TYPE",
+ gettext_noop ("the type to insert data as"),
+ &query_type),
GNUNET_GETOPT_option_verbose (&verbose),
- GNUNET_GETOPT_OPTION_END };
+ GNUNET_GETOPT_OPTION_END
+ };
- if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
+ if (GNUNET_OK !=
+ GNUNET_STRINGS_get_utf8_args (argc, argv,
+ &argc, &argv))
return 2;
expiration = GNUNET_TIME_UNIT_HOURS;
return (GNUNET_OK ==
diff --git a/src/dht/gnunet-service-dht.h b/src/dht/gnunet-service-dht.h
index e9b1ff63a..367ff426e 100644
--- a/src/dht/gnunet-service-dht.h
+++ b/src/dht/gnunet-service-dht.h
@@ -73,7 +73,7 @@ void
GDS_CLIENTS_handle_reply (const struct GDS_DATACACHE_BlockData *bd,
const struct GNUNET_HashCode *query_hash,
unsigned int get_path_length,
- const struct GNUNET_PeerIdentity *get_path);
+ const struct GNUNET_DHT_PathElement *get_path);
/**
@@ -94,7 +94,7 @@ GDS_CLIENTS_process_get (enum GNUNET_DHT_RouteOption options,
uint32_t hop_count,
uint32_t desired_replication_level,
unsigned int path_length,
- const struct GNUNET_PeerIdentity *path,
+ const struct GNUNET_DHT_PathElement *path,
const struct GNUNET_HashCode *key);
@@ -108,7 +108,7 @@ GDS_CLIENTS_process_get (enum GNUNET_DHT_RouteOption options,
*/
void
GDS_CLIENTS_process_get_resp (const struct GDS_DATACACHE_BlockData *bd,
- const struct GNUNET_PeerIdentity *get_path,
+ const struct GNUNET_DHT_PathElement *get_path,
unsigned int get_path_length);
diff --git a/src/dht/gnunet-service-dht_clients.c b/src/dht/gnunet-service-dht_clients.c
index 245130dbc..a1c3024de 100644
--- a/src/dht/gnunet-service-dht_clients.c
+++ b/src/dht/gnunet-service-dht_clients.c
@@ -644,8 +644,8 @@ handle_dht_local_get (void *cls,
cqr->type,
0, /* hop count */
cqr->replication,
- 1, /* path length */
- GDS_NEIGHBOURS_get_id (),
+ 0, /* path length */
+ NULL,
&get->key);
/* start remote requests */
if (NULL != retry_task)
@@ -867,7 +867,7 @@ struct ForwardReplyContext
/**
* GET path taken.
*/
- const struct GNUNET_PeerIdentity *get_path;
+ const struct GNUNET_DHT_PathElement *get_path;
/**
* Number of entries in @e get_path.
@@ -900,7 +900,7 @@ forward_reply (void *cls,
enum GNUNET_BLOCK_ReplyEvaluationResult eval;
bool do_free;
struct GNUNET_HashCode ch;
- struct GNUNET_PeerIdentity *paths;
+ struct GNUNET_DHT_PathElement *paths;
LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG,
"CLIENT-RESULT %s\n",
@@ -989,7 +989,7 @@ forward_reply (void *cls,
env = GNUNET_MQ_msg_extra (reply,
frc->bd->data_size
+ (frc->get_path_length + frc->bd->put_path_length)
- * sizeof(struct GNUNET_PeerIdentity),
+ * sizeof(struct GNUNET_DHT_PathElement),
GNUNET_MESSAGE_TYPE_DHT_CLIENT_RESULT);
reply->type = htonl (frc->bd->type);
reply->get_path_length = htonl (frc->get_path_length);
@@ -997,13 +997,14 @@ forward_reply (void *cls,
reply->unique_id = record->unique_id;
reply->expiration = GNUNET_TIME_absolute_hton (frc->bd->expiration_time);
reply->key = frc->bd->key;
- paths = (struct GNUNET_PeerIdentity *) &reply[1];
+ paths = (struct GNUNET_DHT_PathElement *) &reply[1];
GNUNET_memcpy (paths,
frc->bd->put_path,
- sizeof(struct GNUNET_PeerIdentity) * frc->bd->put_path_length);
+ sizeof(struct GNUNET_DHT_PathElement)
+ * frc->bd->put_path_length);
GNUNET_memcpy (&paths[frc->bd->put_path_length],
frc->get_path,
- sizeof(struct GNUNET_PeerIdentity) * frc->get_path_length);
+ sizeof(struct GNUNET_DHT_PathElement) * frc->get_path_length);
GNUNET_memcpy (&paths[frc->get_path_length + frc->bd->put_path_length],
frc->bd->data,
frc->bd->data_size);
@@ -1023,13 +1024,13 @@ void
GDS_CLIENTS_handle_reply (const struct GDS_DATACACHE_BlockData *bd,
const struct GNUNET_HashCode *query_hash,
unsigned int get_path_length,
- const struct GNUNET_PeerIdentity *get_path)
+ const struct GNUNET_DHT_PathElement *get_path)
{
struct ForwardReplyContext frc;
size_t msize = sizeof (struct GNUNET_DHT_ClientResultMessage)
+ bd->data_size
+ (get_path_length + bd->put_path_length)
- * sizeof(struct GNUNET_PeerIdentity);
+ * sizeof(struct GNUNET_DHT_PathElement);
if (msize >= GNUNET_MAX_MESSAGE_SIZE)
{
@@ -1203,7 +1204,7 @@ struct GetActionContext
uint32_t hop_count;
uint32_t desired_replication_level;
unsigned int get_path_length;
- const struct GNUNET_PeerIdentity *get_path;
+ const struct GNUNET_DHT_PathElement *get_path;
const struct GNUNET_HashCode *key;
};
@@ -1222,10 +1223,10 @@ get_action (void *cls,
struct GetActionContext *gac = cls;
struct GNUNET_MQ_Envelope *env;
struct GNUNET_DHT_MonitorGetMessage *mmsg;
- struct GNUNET_PeerIdentity *msg_path;
+ struct GNUNET_DHT_PathElement *msg_path;
size_t msize;
- msize = gac->get_path_length * sizeof(struct GNUNET_PeerIdentity);
+ msize = gac->get_path_length * sizeof(struct GNUNET_DHT_PathElement);
env = GNUNET_MQ_msg_extra (mmsg,
msize,
GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET);
@@ -1235,10 +1236,10 @@ get_action (void *cls,
mmsg->desired_replication_level = htonl (gac->desired_replication_level);
mmsg->get_path_length = htonl (gac->get_path_length);
mmsg->key = *gac->key;
- msg_path = (struct GNUNET_PeerIdentity *) &mmsg[1];
+ msg_path = (struct GNUNET_DHT_PathElement *) &mmsg[1];
GNUNET_memcpy (msg_path,
gac->get_path,
- gac->get_path_length * sizeof(struct GNUNET_PeerIdentity));
+ gac->get_path_length * sizeof(struct GNUNET_DHT_PathElement));
GNUNET_MQ_send (m->ch->mq,
env);
}
@@ -1262,7 +1263,7 @@ GDS_CLIENTS_process_get (enum GNUNET_DHT_RouteOption options,
uint32_t hop_count,
uint32_t desired_replication_level,
unsigned int path_length,
- const struct GNUNET_PeerIdentity *path,
+ const struct GNUNET_DHT_PathElement *path,
const struct GNUNET_HashCode *key)
{
struct GetActionContext gac = {
@@ -1288,7 +1289,7 @@ GDS_CLIENTS_process_get (enum GNUNET_DHT_RouteOption options,
struct ResponseActionContext
{
const struct GDS_DATACACHE_BlockData *bd;
- const struct GNUNET_PeerIdentity *get_path;
+ const struct GNUNET_DHT_PathElement *get_path;
unsigned int get_path_length;
};
@@ -1309,12 +1310,12 @@ response_action (void *cls,
struct GNUNET_MQ_Envelope *env;
struct GNUNET_DHT_MonitorGetRespMessage *mmsg;
- struct GNUNET_PeerIdentity *path;
+ struct GNUNET_DHT_PathElement *path;
size_t msize;
msize = bd->data_size;
msize += (resp_ctx->get_path_length + bd->put_path_length)
- * sizeof(struct GNUNET_PeerIdentity);
+ * sizeof(struct GNUNET_DHT_PathElement);
env = GNUNET_MQ_msg_extra (mmsg,
msize,
GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET_RESP);
@@ -1323,14 +1324,14 @@ response_action (void *cls,
mmsg->get_path_length = htonl (resp_ctx->get_path_length);
mmsg->expiration_time = GNUNET_TIME_absolute_hton (bd->expiration_time);
mmsg->key = bd->key;
- path = (struct GNUNET_PeerIdentity *) &mmsg[1];
+ path = (struct GNUNET_DHT_PathElement *) &mmsg[1];
GNUNET_memcpy (path,
bd->put_path,
- bd->put_path_length * sizeof(struct GNUNET_PeerIdentity));
+ bd->put_path_length * sizeof(struct GNUNET_DHT_PathElement));
GNUNET_memcpy (path,
resp_ctx->get_path,
resp_ctx->get_path_length * sizeof(struct
- GNUNET_PeerIdentity));
+ GNUNET_DHT_PathElement));
GNUNET_memcpy (&path[resp_ctx->get_path_length],
bd->data,
bd->data_size);
@@ -1341,7 +1342,7 @@ response_action (void *cls,
void
GDS_CLIENTS_process_get_resp (const struct GDS_DATACACHE_BlockData *bd,
- const struct GNUNET_PeerIdentity *get_path,
+ const struct GNUNET_DHT_PathElement *get_path,
unsigned int get_path_length)
{
struct ResponseActionContext rac = {
@@ -1384,12 +1385,12 @@ put_action (void *cls,
const struct GDS_DATACACHE_BlockData *bd = put_ctx->bd;
struct GNUNET_MQ_Envelope *env;
struct GNUNET_DHT_MonitorPutMessage *mmsg;
- struct GNUNET_PeerIdentity *msg_path;
+ struct GNUNET_DHT_PathElement *msg_path;
size_t msize;
msize = bd->data_size
+ bd->put_path_length
- * sizeof(struct GNUNET_PeerIdentity);
+ * sizeof(struct GNUNET_DHT_PathElement);
env = GNUNET_MQ_msg_extra (mmsg,
msize,
GNUNET_MESSAGE_TYPE_DHT_MONITOR_PUT);
@@ -1400,10 +1401,10 @@ put_action (void *cls,
mmsg->put_path_length = htonl (bd->put_path_length);
mmsg->key = bd->key;
mmsg->expiration_time = GNUNET_TIME_absolute_hton (bd->expiration_time);
- msg_path = (struct GNUNET_PeerIdentity *) &mmsg[1];
+ msg_path = (struct GNUNET_DHT_PathElement *) &mmsg[1];
GNUNET_memcpy (msg_path,
bd->put_path,
- bd->put_path_length * sizeof(struct GNUNET_PeerIdentity));
+ bd->put_path_length * sizeof(struct GNUNET_DHT_PathElement));
GNUNET_memcpy (&msg_path[bd->put_path_length],
bd->data,
bd->data_size);
diff --git a/src/dht/gnunet-service-dht_datacache.c b/src/dht/gnunet-service-dht_datacache.c
index 214c4a3f4..cb778717b 100644
--- a/src/dht/gnunet-service-dht_datacache.c
+++ b/src/dht/gnunet-service-dht_datacache.c
@@ -152,7 +152,7 @@ datacache_get_iterator (void *cls,
enum GNUNET_BLOCK_Type type,
struct GNUNET_TIME_Absolute exp,
unsigned int put_path_length,
- const struct GNUNET_PeerIdentity *put_path)
+ const struct GNUNET_DHT_PathElement *put_path)
{
struct GetRequestContext *ctx = cls;
enum GNUNET_BLOCK_ReplyEvaluationResult eval;
@@ -301,7 +301,8 @@ datacache_get_successors_iterator (void *cls,
enum GNUNET_BLOCK_Type type,
struct GNUNET_TIME_Absolute exp,
unsigned int put_path_length,
- const struct GNUNET_PeerIdentity *put_path)
+ const struct
+ GNUNET_DHT_PathElement *put_path)
{
const struct SuccContext *sc = cls;
struct GDS_DATACACHE_BlockData bd = {
diff --git a/src/dht/gnunet-service-dht_datacache.h b/src/dht/gnunet-service-dht_datacache.h
index 249bb8ee3..691a51e0e 100644
--- a/src/dht/gnunet-service-dht_datacache.h
+++ b/src/dht/gnunet-service-dht_datacache.h
@@ -50,7 +50,7 @@ struct GDS_DATACACHE_BlockData
/**
* PUT path taken by the block, array of peer identities.
*/
- const struct GNUNET_PeerIdentity *put_path;
+ const struct GNUNET_DHT_PathElement *put_path;
/**
* Actual block data.
diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c
index 35502e0f5..e100ae2ee 100644
--- a/src/dht/gnunet-service-dht_neighbours.c
+++ b/src/dht/gnunet-service-dht_neighbours.c
@@ -346,11 +346,6 @@ struct ConnectInfo
static int cache_results;
/**
- * Should routing details be logged to stderr (for debugging)?
- */
-static int log_route_details_stderr;
-
-/**
* The lowest currently used bucket, initially 0 (for 0-bits matching bucket).
*/
static unsigned int closest_bucket;
@@ -1437,7 +1432,7 @@ GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type,
struct GNUNET_MQ_Envelope *env;
struct PeerGetMessage *pgm;
char *xq;
-
+
if (GNUNET_MQ_get_length (target->mq) >= MAXIMUM_PENDING_PER_PEER)
{
/* skip */
@@ -1503,20 +1498,20 @@ GDS_NEIGHBOURS_handle_reply (struct PeerInfo *pi,
const struct GDS_DATACACHE_BlockData *bd,
const struct GNUNET_HashCode *query_hash,
unsigned int get_path_length,
- const struct GNUNET_PeerIdentity *get_path)
+ const struct GNUNET_DHT_PathElement *get_path)
{
struct GNUNET_MQ_Envelope *env;
struct PeerResultMessage *prm;
- struct GNUNET_PeerIdentity *paths;
+ struct GNUNET_DHT_PathElement *paths;
size_t msize;
msize = bd->data_size + (get_path_length + bd->put_path_length)
- * sizeof(struct GNUNET_PeerIdentity);
+ * sizeof(struct GNUNET_DHT_PathElement);
if ( (msize + sizeof(struct PeerResultMessage) >= GNUNET_MAX_MESSAGE_SIZE) ||
(get_path_length >
- GNUNET_MAX_MESSAGE_SIZE / sizeof(struct GNUNET_PeerIdentity)) ||
+ GNUNET_MAX_MESSAGE_SIZE / sizeof(struct GNUNET_DHT_PathElement)) ||
(bd->put_path_length >
- GNUNET_MAX_MESSAGE_SIZE / sizeof(struct GNUNET_PeerIdentity)) ||
+ GNUNET_MAX_MESSAGE_SIZE / sizeof(struct GNUNET_DHT_PathElement)) ||
(bd->data_size > GNUNET_MAX_MESSAGE_SIZE))
{
GNUNET_break (0);
@@ -1551,13 +1546,13 @@ GDS_NEIGHBOURS_handle_reply (struct PeerInfo *pi,
prm->get_path_length = htonl (get_path_length);
prm->expiration_time = GNUNET_TIME_absolute_hton (bd->expiration_time);
prm->key = *query_hash;
- paths = (struct GNUNET_PeerIdentity *) &prm[1];
+ paths = (struct GNUNET_DHT_PathElement *) &prm[1];
GNUNET_memcpy (paths,
bd->put_path,
- bd->put_path_length * sizeof(struct GNUNET_PeerIdentity));
+ bd->put_path_length * sizeof(struct GNUNET_DHT_PathElement));
GNUNET_memcpy (&paths[bd->put_path_length],
get_path,
- get_path_length * sizeof(struct GNUNET_PeerIdentity));
+ get_path_length * sizeof(struct GNUNET_DHT_PathElement));
GNUNET_memcpy (&paths[bd->put_path_length + get_path_length],
bd->data,
bd->data_size);
@@ -1582,7 +1577,7 @@ core_init (void *cls,
GNUNET_i2s (identity));
my_identity = *identity;
GNUNET_CRYPTO_hash (identity,
- sizeof(struct GNUNET_PeerIdentity),
+ sizeof(struct GNUNET_PeerIdentity),
&my_identity_hash);
GNUNET_SERVICE_resume (GDS_service);
}
@@ -1605,9 +1600,9 @@ check_dht_p2p_put (void *cls,
(void) cls;
if ( (msize <
sizeof(struct PeerPutMessage)
- + putlen * sizeof(struct GNUNET_PeerIdentity)) ||
+ + putlen * sizeof(struct GNUNET_DHT_PathElement)) ||
(putlen >
- GNUNET_MAX_MESSAGE_SIZE / sizeof(struct GNUNET_PeerIdentity)) )
+ GNUNET_MAX_MESSAGE_SIZE / sizeof(struct GNUNET_DHT_PathElement)) )
{
GNUNET_break_op (0);
return GNUNET_SYSERR;
@@ -1635,13 +1630,13 @@ handle_dht_p2p_put (void *cls,
.expiration_time = GNUNET_TIME_absolute_ntoh (put->expiration_time),
.type = ntohl (put->type)
};
- const struct GNUNET_PeerIdentity *put_path
- = (const struct GNUNET_PeerIdentity *) &put[1];
+ const struct GNUNET_DHT_PathElement *put_path
+ = (const struct GNUNET_DHT_PathElement *) &put[1];
uint32_t putlen
= ntohl (put->put_path_length);
bd.data_size = msize - (sizeof(*put)
- + putlen * sizeof(struct GNUNET_PeerIdentity));
+ + putlen * sizeof(struct GNUNET_DHT_PathElement));
bd.data = &put_path[putlen];
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"PUT for `%s' from %s\n",
@@ -1663,35 +1658,6 @@ handle_dht_p2p_put (void *cls,
"# P2P PUT bytes received",
msize,
GNUNET_NO);
- if (GNUNET_YES == log_route_details_stderr)
- {
- char *tmp;
- char *pp;
- struct GNUNET_HashCode mxor;
- struct GNUNET_HashCode pxor;
-
- GNUNET_CRYPTO_hash_xor (&my_identity_hash,
- &put->key,
- &mxor);
- GNUNET_CRYPTO_hash_xor (&peer->phash,
- &put->key,
- &pxor);
- pp = GNUNET_STRINGS_pp2s (put_path,
- putlen);
- tmp = GNUNET_strdup (GNUNET_i2s (&my_identity));
- LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG,
- "R5N PUT %s: %s->%s (%u, %u=>%u, PP: %s)\n",
- GNUNET_h2s (&put->key),
- GNUNET_i2s (peer->id),
- tmp,
- ntohl (put->hop_count),
- GNUNET_CRYPTO_hash_count_leading_zeros (&pxor),
- GNUNET_CRYPTO_hash_count_leading_zeros (&mxor),
- pp);
- GNUNET_free (pp);
- GNUNET_free (tmp);
- }
-
{
struct GNUNET_HashCode test_key;
enum GNUNET_GenericReturnValue ret;
@@ -1733,7 +1699,7 @@ handle_dht_p2p_put (void *cls,
{
struct GNUNET_CONTAINER_BloomFilter *bf;
- struct GNUNET_PeerIdentity pp[putlen + 1];
+ struct GNUNET_DHT_PathElement pp[putlen + 1];
bf = GNUNET_CONTAINER_bloomfilter_init (put->bloomfilter,
DHT_BLOOM_SIZE,
@@ -1742,7 +1708,7 @@ handle_dht_p2p_put (void *cls,
GNUNET_CONTAINER_bloomfilter_test (bf,
&peer->phash));
/* extend 'put path' by sender */
- bd.put_path = (const struct GNUNET_PeerIdentity *) pp;
+ bd.put_path = (const struct GNUNET_DHT_PathElement *) pp;
bd.put_path_length = putlen + 1;
if (0 != (options & GNUNET_DHT_RO_RECORD_ROUTE))
{
@@ -1752,18 +1718,22 @@ handle_dht_p2p_put (void *cls,
for (unsigned int j = 0; j < i; j++)
{
GNUNET_break (0 !=
- GNUNET_memcmp (&pp[i],
- &pp[j]));
+ GNUNET_memcmp (&pp[i].pred,
+ &pp[j].pred));
}
GNUNET_break (0 !=
- GNUNET_memcmp (&pp[i],
+ GNUNET_memcmp (&pp[i].pred,
peer->id));
}
#endif
GNUNET_memcpy (pp,
put_path,
- putlen * sizeof(struct GNUNET_PeerIdentity));
- pp[putlen] = *peer->id;
+ putlen * sizeof(struct GNUNET_DHT_PathElement));
+ pp[putlen].pred = *peer->id;
+ /* zero-out signature, not valid until we actually do forward! */
+ memset (&pp[putlen].sig,
+ 0,
+ sizeof (pp[putlen].sig));
putlen++;
}
else
@@ -1938,17 +1908,6 @@ handle_local_result (void *cls,
{
struct PeerInfo *peer = cls;
- {
- char *pp;
-
- pp = GNUNET_STRINGS_pp2s (bd->put_path,
- bd->put_path_length);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Found local result for %s (PP: %s)\n",
- GNUNET_h2s (&bd->key),
- pp);
- GNUNET_free (pp);
- }
GDS_NEIGHBOURS_handle_reply (peer,
bd,
&bd->key,
@@ -1996,7 +1955,8 @@ handle_dht_p2p_get (void *cls,
uint32_t hop_count = ntohl (get->hop_count);
size_t reply_bf_size = msize - (sizeof(*get) + xquery_size);
enum GNUNET_BLOCK_Type type = (enum GNUNET_BLOCK_Type) ntohl (get->type);
- enum GNUNET_DHT_RouteOption options = (enum GNUNET_DHT_RouteOption) ntohl (get->options);
+ enum GNUNET_DHT_RouteOption options = (enum GNUNET_DHT_RouteOption) ntohl (
+ get->options);
enum GNUNET_BLOCK_ReplyEvaluationResult eval = GNUNET_BLOCK_REPLY_OK_MORE;
const void *xquery = (const void *) &get[1];
@@ -2009,31 +1969,6 @@ handle_dht_p2p_get (void *cls,
"# P2P GET bytes received",
msize,
GNUNET_NO);
- if (GNUNET_YES == log_route_details_stderr)
- {
- char *tmp;
- struct GNUNET_HashCode mxor;
- struct GNUNET_HashCode pxor;
-
- GNUNET_CRYPTO_hash_xor (&my_identity_hash,
- &get->key,
- &mxor);
- GNUNET_CRYPTO_hash_xor (&peer->phash,
- &get->key,
- &pxor);
- tmp = GNUNET_strdup (GNUNET_i2s (&my_identity));
- LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG,
- "R5N GET %s: %s->%s (%u, %u=>%u) xq: %.*s\n",
- GNUNET_h2s (&get->key),
- GNUNET_i2s (peer->id),
- tmp,
- hop_count,
- GNUNET_CRYPTO_hash_count_leading_zeros (&pxor),
- GNUNET_CRYPTO_hash_count_leading_zeros (&mxor),
- ntohl (get->xquery_size),
- (const char *) xquery);
- GNUNET_free (tmp);
- }
if (GNUNET_NO ==
GNUNET_BLOCK_check_query (GDS_block_context,
type,
@@ -2096,13 +2031,13 @@ handle_dht_p2p_get (void *cls,
}
}
else
- {
- GNUNET_STATISTICS_update (GDS_stats,
- "# P2P GET requests ONLY routed",
- 1,
- GNUNET_NO);
- }
-
+ {
+ GNUNET_STATISTICS_update (GDS_stats,
+ "# P2P GET requests ONLY routed",
+ 1,
+ GNUNET_NO);
+ }
+
/* remember request for routing replies */
GDS_ROUTING_add (peer->id,
type,
@@ -2115,7 +2050,8 @@ handle_dht_p2p_get (void *cls,
/* P2P forwarding */
{
bool forwarded = false;
- uint32_t desired_replication_level = ntohl (get->desired_replication_level);
+ uint32_t desired_replication_level = ntohl (
+ get->desired_replication_level);
if (eval != GNUNET_BLOCK_REPLY_OK_LAST)
forwarded = (GNUNET_OK ==
@@ -2129,8 +2065,8 @@ handle_dht_p2p_get (void *cls,
bg,
peer_bf));
GDS_CLIENTS_process_get (
- options |
- (forwarded
+ options
+ | (forwarded
? 0
: GNUNET_DHT_RO_LAST_HOP),
type,
@@ -2158,7 +2094,7 @@ static void
process_reply_with_path (const struct GDS_DATACACHE_BlockData *bd,
const struct GNUNET_HashCode *query_hash,
unsigned int get_path_length,
- const struct GNUNET_PeerIdentity *get_path)
+ const struct GNUNET_DHT_PathElement *get_path)
{
/* forward to local clients */
GDS_CLIENTS_handle_reply (bd,
@@ -2170,16 +2106,16 @@ process_reply_with_path (const struct GDS_DATACACHE_BlockData *bd,
get_path_length);
if (GNUNET_YES == cache_results)
{
- struct GNUNET_PeerIdentity xput_path[GNUNET_NZL (get_path_length
- + bd->put_path_length)];
+ struct GNUNET_DHT_PathElement xput_path[GNUNET_NZL (get_path_length
+ + bd->put_path_length)];
struct GDS_DATACACHE_BlockData bdx = *bd;
GNUNET_memcpy (xput_path,
bd->put_path,
- bd->put_path_length * sizeof(struct GNUNET_PeerIdentity));
+ bd->put_path_length * sizeof(struct GNUNET_DHT_PathElement));
GNUNET_memcpy (&xput_path[bd->put_path_length],
get_path,
- get_path_length * sizeof(struct GNUNET_PeerIdentity));
+ get_path_length * sizeof(struct GNUNET_DHT_PathElement));
bdx.put_path = xput_path;
bdx.put_path_length += get_path_length;
GDS_DATACACHE_handle_put (&bdx);
@@ -2211,11 +2147,11 @@ check_dht_p2p_result (void *cls,
if ( (msize <
sizeof(struct PeerResultMessage)
+ (get_path_length + put_path_length)
- * sizeof(struct GNUNET_PeerIdentity)) ||
+ * sizeof(struct GNUNET_DHT_PathElement)) ||
(get_path_length >
- GNUNET_MAX_MESSAGE_SIZE / sizeof(struct GNUNET_PeerIdentity)) ||
+ GNUNET_MAX_MESSAGE_SIZE / sizeof(struct GNUNET_DHT_PathElement)) ||
(put_path_length >
- GNUNET_MAX_MESSAGE_SIZE / sizeof(struct GNUNET_PeerIdentity)) )
+ GNUNET_MAX_MESSAGE_SIZE / sizeof(struct GNUNET_DHT_PathElement)) )
{
GNUNET_break_op (0);
return GNUNET_SYSERR;
@@ -2239,11 +2175,11 @@ handle_dht_p2p_result (void *cls,
uint32_t get_path_length = ntohl (prm->get_path_length);
struct GDS_DATACACHE_BlockData bd = {
.expiration_time = GNUNET_TIME_absolute_ntoh (prm->expiration_time),
- .put_path = (const struct GNUNET_PeerIdentity *) &prm[1],
+ .put_path = (const struct GNUNET_DHT_PathElement *) &prm[1],
.put_path_length = ntohl (prm->put_path_length),
.type = ntohl (prm->type)
};
- const struct GNUNET_PeerIdentity *get_path
+ const struct GNUNET_DHT_PathElement *get_path
= &bd.put_path[bd.put_path_length];
/* parse and validate message */
@@ -2259,7 +2195,7 @@ handle_dht_p2p_result (void *cls,
bd.data = (const void *) &get_path[get_path_length];
bd.data_size = msize - (sizeof(struct PeerResultMessage)
+ (get_path_length + bd.put_path_length)
- * sizeof(struct GNUNET_PeerIdentity));
+ * sizeof(struct GNUNET_DHT_PathElement));
GNUNET_STATISTICS_update (GDS_stats,
"# P2P RESULTS received",
1,
@@ -2295,29 +2231,6 @@ handle_dht_p2p_result (void *cls,
}
}
- if (GNUNET_YES == log_route_details_stderr)
- {
- char *tmp;
- char *pp;
- char *gp;
-
- gp = GNUNET_STRINGS_pp2s (get_path,
- get_path_length);
- pp = GNUNET_STRINGS_pp2s (bd.put_path,
- bd.put_path_length);
- tmp = GNUNET_strdup (GNUNET_i2s (&my_identity));
- LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG,
- "R5N RESULT %s: %s->%s (GP: %s, PP: %s)\n",
- GNUNET_h2s (&prm->key),
- GNUNET_i2s (peer->id),
- tmp,
- gp,
- pp);
- GNUNET_free (gp);
- GNUNET_free (pp);
- GNUNET_free (tmp);
- }
-
/* if we got a HELLO, consider it for our own routing table */
if (GNUNET_BLOCK_TYPE_DHT_HELLO == bd.type)
{
@@ -2352,7 +2265,7 @@ handle_dht_p2p_result (void *cls,
/* First, check if 'peer' is already on the path, and if
so, truncate it instead of expanding. */
for (unsigned int i = 0; i <= get_path_length; i++)
- if (0 == GNUNET_memcmp (&get_path[i],
+ if (0 == GNUNET_memcmp (&get_path[i].pred,
peer->id))
{
process_reply_with_path (&bd,
@@ -2363,12 +2276,15 @@ handle_dht_p2p_result (void *cls,
/* Need to append 'peer' to 'get_path' (normal case) */
{
- struct GNUNET_PeerIdentity xget_path[get_path_length + 1];
+ struct GNUNET_DHT_PathElement xget_path[get_path_length + 1];
GNUNET_memcpy (xget_path,
get_path,
- get_path_length * sizeof(struct GNUNET_PeerIdentity));
- xget_path[get_path_length] = *peer->id;
+ get_path_length * sizeof(struct GNUNET_DHT_PathElement));
+ xget_path[get_path_length].pred = *peer->id;
+ memset (&xget_path[get_path_length].sig,
+ 0,
+ sizeof (xget_path[get_path_length].sig));
process_reply_with_path (&bd,
&prm->key,
get_path_length + 1, xget_path);
@@ -2411,8 +2327,6 @@ GDS_NEIGHBOURS_init ()
"DHT",
"CACHE_RESULTS");
- log_route_details_stderr =
- (NULL != getenv ("GNUNET_DHT_ROUTE_DEBUG")) ? GNUNET_YES : GNUNET_NO;
ats_ch = GNUNET_ATS_connectivity_init (GDS_cfg);
core_api = GNUNET_CORE_connect (GDS_cfg,
NULL,
diff --git a/src/dht/gnunet-service-dht_neighbours.h b/src/dht/gnunet-service-dht_neighbours.h
index 28468c740..35bbb125d 100644
--- a/src/dht/gnunet-service-dht_neighbours.h
+++ b/src/dht/gnunet-service-dht_neighbours.h
@@ -42,7 +42,7 @@ struct PeerInfo;
/**
* Lookup peer by peer's identity.
- *
+ *
* @param target peer to look up
* @return NULL if we are not connected to @a target
*/
@@ -118,7 +118,7 @@ GDS_NEIGHBOURS_handle_reply (struct PeerInfo *pi,
const struct GDS_DATACACHE_BlockData *bd,
const struct GNUNET_HashCode *query_hash,
unsigned int get_path_length,
- const struct GNUNET_PeerIdentity *get_path);
+ const struct GNUNET_DHT_PathElement *get_path);
/**
diff --git a/src/dht/gnunet-service-dht_routing.c b/src/dht/gnunet-service-dht_routing.c
index ec36eae75..e7b5c3571 100644
--- a/src/dht/gnunet-service-dht_routing.c
+++ b/src/dht/gnunet-service-dht_routing.c
@@ -109,7 +109,7 @@ struct ProcessContext
/**
* Path of the reply.
*/
- const struct GNUNET_PeerIdentity *get_path;
+ const struct GNUNET_DHT_PathElement *get_path;
/**
* Number of entries in @e get_path.
@@ -181,7 +181,7 @@ process (void *cls,
case GNUNET_BLOCK_REPLY_TYPE_NOT_SUPPORTED:
{
struct PeerInfo *pi;
-
+
GNUNET_STATISTICS_update (GDS_stats,
"# Good REPLIES matched against routing table",
1,
@@ -244,7 +244,7 @@ void
GDS_ROUTING_process (const struct GDS_DATACACHE_BlockData *bd,
const struct GNUNET_HashCode *query_hash,
unsigned int get_path_length,
- const struct GNUNET_PeerIdentity *get_path)
+ const struct GNUNET_DHT_PathElement *get_path)
{
struct ProcessContext pc = {
.bd = bd,
diff --git a/src/dht/gnunet-service-dht_routing.h b/src/dht/gnunet-service-dht_routing.h
index 1a1514cc5..1e35f3dc0 100644
--- a/src/dht/gnunet-service-dht_routing.h
+++ b/src/dht/gnunet-service-dht_routing.h
@@ -47,7 +47,7 @@ void
GDS_ROUTING_process (const struct GDS_DATACACHE_BlockData *bd,
const struct GNUNET_HashCode *query_hash,
unsigned int get_path_length,
- const struct GNUNET_PeerIdentity *get_path);
+ const struct GNUNET_DHT_PathElement *get_path);
/**
diff --git a/src/dht/gnunet_dht_profiler.c b/src/dht/gnunet_dht_profiler.c
index ba50c3d1a..bac101bdd 100644
--- a/src/dht/gnunet_dht_profiler.c
+++ b/src/dht/gnunet_dht_profiler.c
@@ -469,9 +469,9 @@ static void
get_iter (void *cls,
struct GNUNET_TIME_Absolute exp,
const struct GNUNET_HashCode *key,
- const struct GNUNET_PeerIdentity *get_path,
+ const struct GNUNET_DHT_PathElement *get_path,
unsigned int get_path_length,
- const struct GNUNET_PeerIdentity *put_path,
+ const struct GNUNET_DHT_PathElement *put_path,
unsigned int put_path_length,
enum GNUNET_BLOCK_Type type,
size_t size, const void *data)
diff --git a/src/dht/test_dht_api.c b/src/dht/test_dht_api.c
index 957c71d7f..4d557bba8 100644
--- a/src/dht/test_dht_api.c
+++ b/src/dht/test_dht_api.c
@@ -87,9 +87,9 @@ static void
test_get_iterator (void *cls,
struct GNUNET_TIME_Absolute exp,
const struct GNUNET_HashCode *key,
- const struct GNUNET_PeerIdentity *get_path,
+ const struct GNUNET_DHT_PathElement *get_path,
unsigned int get_path_length,
- const struct GNUNET_PeerIdentity *put_path,
+ const struct GNUNET_DHT_PathElement *put_path,
unsigned int put_path_length,
enum GNUNET_BLOCK_Type type,
size_t size,
diff --git a/src/dht/test_dht_monitor.c b/src/dht/test_dht_monitor.c
index 95fb37bcd..8af02ad8a 100644
--- a/src/dht/test_dht_monitor.c
+++ b/src/dht/test_dht_monitor.c
@@ -174,9 +174,9 @@ timeout_task_cb (void *cls)
static void
dht_get_handler (void *cls, struct GNUNET_TIME_Absolute exp,
const struct GNUNET_HashCode *key,
- const struct GNUNET_PeerIdentity *get_path,
+ const struct GNUNET_DHT_PathElement *get_path,
unsigned int get_path_length,
- const struct GNUNET_PeerIdentity *put_path,
+ const struct GNUNET_DHT_PathElement *put_path,
unsigned int put_path_length,
enum GNUNET_BLOCK_Type type,
size_t size, const void *data)
@@ -261,7 +261,7 @@ monitor_get_cb (void *cls,
uint32_t hop_count,
uint32_t desired_replication_level,
unsigned int path_length,
- const struct GNUNET_PeerIdentity *path,
+ const struct GNUNET_DHT_PathElement *path,
const struct GNUNET_HashCode *key)
{
unsigned int i;
@@ -298,7 +298,7 @@ monitor_put_cb (void *cls,
uint32_t hop_count,
uint32_t desired_replication_level,
unsigned int path_length,
- const struct GNUNET_PeerIdentity *path,
+ const struct GNUNET_DHT_PathElement *path,
struct GNUNET_TIME_Absolute exp,
const struct GNUNET_HashCode *key,
const void *data,
@@ -334,9 +334,9 @@ monitor_put_cb (void *cls,
static void
monitor_res_cb (void *cls,
enum GNUNET_BLOCK_Type type,
- const struct GNUNET_PeerIdentity *get_path,
+ const struct GNUNET_DHT_PathElement *get_path,
unsigned int get_path_length,
- const struct GNUNET_PeerIdentity *put_path,
+ const struct GNUNET_DHT_PathElement *put_path,
unsigned int put_path_length,
struct GNUNET_TIME_Absolute exp,
const struct GNUNET_HashCode *key,
diff --git a/src/dht/test_dht_topo.c b/src/dht/test_dht_topo.c
index 7f737ea03..dfe969bb9 100644
--- a/src/dht/test_dht_topo.c
+++ b/src/dht/test_dht_topo.c
@@ -302,9 +302,9 @@ static void
dht_get_handler (void *cls,
struct GNUNET_TIME_Absolute exp,
const struct GNUNET_HashCode *key,
- const struct GNUNET_PeerIdentity *get_path,
+ const struct GNUNET_DHT_PathElement *get_path,
unsigned int get_path_length,
- const struct GNUNET_PeerIdentity *put_path,
+ const struct GNUNET_DHT_PathElement *put_path,
unsigned int put_path_length,
enum GNUNET_BLOCK_Type type,
size_t size,
diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c
index c3fe5ff58..beb29a506 100644
--- a/src/fs/gnunet-service-fs_pr.c
+++ b/src/fs/gnunet-service-fs_pr.c
@@ -1102,9 +1102,9 @@ static void
handle_dht_reply (void *cls,
struct GNUNET_TIME_Absolute exp,
const struct GNUNET_HashCode *key,
- const struct GNUNET_PeerIdentity *get_path,
+ const struct GNUNET_DHT_PathElement *get_path,
unsigned int get_path_length,
- const struct GNUNET_PeerIdentity *put_path,
+ const struct GNUNET_DHT_PathElement *put_path,
unsigned int put_path_length,
enum GNUNET_BLOCK_Type type,
size_t size,
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c
index 958bf2e94..51e650b4f 100644
--- a/src/gns/gnunet-service-gns_resolver.c
+++ b/src/gns/gnunet-service-gns_resolver.c
@@ -2456,9 +2456,9 @@ static void
handle_dht_response (void *cls,
struct GNUNET_TIME_Absolute exp,
const struct GNUNET_HashCode *key,
- const struct GNUNET_PeerIdentity *get_path,
+ const struct GNUNET_DHT_PathElement *get_path,
unsigned int get_path_length,
- const struct GNUNET_PeerIdentity *put_path,
+ const struct GNUNET_DHT_PathElement *put_path,
unsigned int put_path_length,
enum GNUNET_BLOCK_Type type,
size_t size,
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 @@
#include "gnunet_util_lib.h"
#include "gnunet_block_lib.h"
+#include "gnunet_dht_service.h"
#ifdef __cplusplus
extern "C"
@@ -89,15 +90,15 @@ GNUNET_DATACACHE_destroy (struct GNUNET_DATACACHE_Handle *h);
* @param path_info a path through the network
* @return #GNUNET_OK to continue iterating, #GNUNET_SYSERR to abort
*/
-typedef int
-(*GNUNET_DATACACHE_Iterator) (void *cls,
- const struct GNUNET_HashCode *key,
- size_t data_size,
- const char *data,
- enum GNUNET_BLOCK_Type type,
- struct GNUNET_TIME_Absolute exp,
- unsigned int path_info_len,
- const struct GNUNET_PeerIdentity *path_info);
+typedef enum GNUNET_GenericReturnValue
+(*GNUNET_DATACACHE_Iterator)(void *cls,
+ const struct GNUNET_HashCode *key,
+ size_t data_size,
+ const char *data,
+ enum GNUNET_BLOCK_Type type,
+ struct GNUNET_TIME_Absolute exp,
+ unsigned int path_info_len,
+ const struct GNUNET_DHT_PathElement *path_info);
/**
@@ -114,7 +115,7 @@ typedef int
* @param path_info a path through the network
* @return #GNUNET_OK on success, #GNUNET_SYSERR on error, #GNUNET_NO if duplicate
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_DATACACHE_put (struct GNUNET_DATACACHE_Handle *h,
const struct GNUNET_HashCode *key,
uint32_t xor_distance,
@@ -123,7 +124,7 @@ GNUNET_DATACACHE_put (struct GNUNET_DATACACHE_Handle *h,
enum GNUNET_BLOCK_Type type,
struct GNUNET_TIME_Absolute discard_time,
unsigned int path_info_len,
- const struct GNUNET_PeerIdentity *path_info);
+ const struct GNUNET_DHT_PathElement *path_info);
/**
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
enum GNUNET_BLOCK_Type type,
struct GNUNET_TIME_Absolute discard_time,
unsigned int path_info_len,
- const struct GNUNET_PeerIdentity *path_info);
+ const struct GNUNET_DHT_PathElement *path_info);
/**
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);
* @param get_path_length number of entries in @a get_path
* @param put_path peers on the PUT path (or NULL if not recorded)
* [0] = origin, [length - 1] = datastore
- * @param put_path_length number of entries in @a put_path
+ * @param put_path_length number of entries in @a put_path,
+ * note that the last signature will be all zeros as
+ * we did not forward and thus did not sign!
* @param type type of the result
* @param size number of bytes in @a data
* @param data pointer to the result data
@@ -266,9 +268,9 @@ typedef void
(*GNUNET_DHT_GetIterator) (void *cls,
struct GNUNET_TIME_Absolute exp,
const struct GNUNET_HashCode *key,
- const struct GNUNET_PeerIdentity *get_path,
+ const struct GNUNET_DHT_PathElement *get_path,
unsigned int get_path_length,
- const struct GNUNET_PeerIdentity *put_path,
+ const struct GNUNET_DHT_PathElement *put_path,
unsigned int put_path_length,
enum GNUNET_BLOCK_Type type,
size_t size,
@@ -343,6 +345,8 @@ struct GNUNET_DHT_MonitorHandle;
* @param hop_count Hop count so far.
* @param path_length number of entries in @a path (or 0 if not recorded).
* @param path peers on the GET path (or NULL if not recorded).
+ * note that the last signature will be all zeros as
+ * we did not forward and thus did not sign!
* @param desired_replication_level Desired replication level.
* @param key Key of the requested data.
*/
@@ -353,7 +357,7 @@ typedef void
uint32_t hop_count,
uint32_t desired_replication_level,
unsigned int path_length,
- const struct GNUNET_PeerIdentity *path,
+ const struct GNUNET_DHT_PathElement *path,
const struct GNUNET_HashCode *key);
@@ -363,6 +367,8 @@ typedef void
* @param cls Closure.
* @param type The type of data in the result.
* @param get_path Peers on GET path (or NULL if not recorded).
+ * note that the last signature will be all zeros as
+ * we did not forward and thus did not sign!
* @param get_path_length number of entries in @a get_path.
* @param put_path peers on the PUT path (or NULL if not recorded).
* @param put_path_length number of entries in @a get_path.
@@ -374,9 +380,9 @@ typedef void
typedef void
(*GNUNET_DHT_MonitorGetRespCB) (void *cls,
enum GNUNET_BLOCK_Type type,
- const struct GNUNET_PeerIdentity *get_path,
+ const struct GNUNET_DHT_PathElement *get_path,
unsigned int get_path_length,
- const struct GNUNET_PeerIdentity *put_path,
+ const struct GNUNET_DHT_PathElement *put_path,
unsigned int put_path_length,
struct GNUNET_TIME_Absolute exp,
const struct GNUNET_HashCode *key,
@@ -393,6 +399,8 @@ typedef void
* @param hop_count Hop count so far.
* @param path_length number of entries in @a path (or 0 if not recorded).
* @param path peers on the PUT path (or NULL if not recorded).
+ * note that the last signature will be all zeros as
+ * we did not forward and thus did not sign!
* @param desired_replication_level Desired replication level.
* @param exp Expiration time of the data.
* @param key Key under which data is to be stored.
@@ -406,7 +414,7 @@ typedef void
uint32_t hop_count,
uint32_t desired_replication_level,
unsigned int path_length,
- const struct GNUNET_PeerIdentity *path,
+ const struct GNUNET_DHT_PathElement *path,
struct GNUNET_TIME_Absolute exp,
const struct GNUNET_HashCode *key,
const void *data,
@@ -446,6 +454,18 @@ void
GNUNET_DHT_monitor_stop (struct GNUNET_DHT_MonitorHandle *handle);
+/**
+ * Convert a peer path to a human-readable string.
+ *
+ * @param path array of path elements to convert to a string
+ * @param num_pids length of the @a pids array
+ * @return string representing the array of @a pids
+ */
+char *
+GNUNET_DHT_pp2s (const struct GNUNET_DHT_PathElement *path,
+ unsigned int path_len);
+
+
#if 0 /* keep Emacsens' auto-indent happy */
{
#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,
/**
- * Convert a peer path to a human-readable string.
- *
- * @param pids array of PIDs to convert to a string
- * @param num_pids length of the @a pids array
- * @return string representing the array of @a pids
- */
-char *
-GNUNET_STRINGS_pp2s (const struct GNUNET_PeerIdentity *pids,
- unsigned int num_pids);
-
-
-/**
* Parse a path that might be an URI.
*
* @param path path to parse. Must be NULL-terminated.
diff --git a/src/pt/gnunet-daemon-pt.c b/src/pt/gnunet-daemon-pt.c
index da4374223..b79a8e464 100644
--- a/src/pt/gnunet-daemon-pt.c
+++ b/src/pt/gnunet-daemon-pt.c
@@ -1140,9 +1140,9 @@ static void
handle_dht_result (void *cls,
struct GNUNET_TIME_Absolute exp,
const struct GNUNET_HashCode *key,
- const struct GNUNET_PeerIdentity *get_path,
+ const struct GNUNET_DHT_PathElement *get_path,
unsigned int get_path_length,
- const struct GNUNET_PeerIdentity *put_path,
+ const struct GNUNET_DHT_PathElement *put_path,
unsigned int put_path_length,
enum GNUNET_BLOCK_Type type,
size_t size, const void *data)
diff --git a/src/regex/gnunet-regex-profiler.c b/src/regex/gnunet-regex-profiler.c
index bd223ae8e..75a1d2f99 100644
--- a/src/regex/gnunet-regex-profiler.c
+++ b/src/regex/gnunet-regex-profiler.c
@@ -23,11 +23,7 @@
* @brief Regex profiler for testing distributed regex use.
* @author Bartlomiej Polot
* @author Maximilian Szengel
- *
*/
-
-#include <string.h>
-
#include "platform.h"
#include "gnunet_applications.h"
#include "gnunet_util_lib.h"
@@ -727,9 +723,9 @@ find_string (void *cls);
static void
regex_found_handler (void *cls,
const struct GNUNET_PeerIdentity *id,
- const struct GNUNET_PeerIdentity *get_path,
+ const struct GNUNET_DHT_PathElement *get_path,
unsigned int get_path_length,
- const struct GNUNET_PeerIdentity *put_path,
+ const struct GNUNET_DHT_PathElement *put_path,
unsigned int put_path_length)
{
struct RegexPeer *peer = cls;
@@ -1558,53 +1554,56 @@ int
main (int argc, char *const *argv)
{
struct GNUNET_GETOPT_CommandLineOption options[] = {
- GNUNET_GETOPT_option_filename ('o',
- "output-file",
- "FILENAME",
- gettext_noop (
- "name of the file for writing statistics"),
- &data_filename),
-
- GNUNET_GETOPT_option_relative_time ('t',
- "matching-timeout",
- "TIMEOUT",
- gettext_noop (
- "wait TIMEOUT before ending the experiment"),
- &search_timeout_time),
-
- GNUNET_GETOPT_option_filename ('p',
- "policy-dir",
- "DIRECTORY",
- gettext_noop ("directory with policy files"),
- &policy_dir),
-
-
- GNUNET_GETOPT_option_filename ('s',
- "strings-file",
- "FILENAME",
- gettext_noop (
- "name of file with input strings"),
- &strings_file),
-
- GNUNET_GETOPT_option_filename ('H',
- "hosts-file",
- "FILENAME",
- gettext_noop (
- "name of file with hosts' names"),
- &hosts_file),
+ GNUNET_GETOPT_option_filename (
+ 'o',
+ "output-file",
+ "FILENAME",
+ gettext_noop (
+ "name of the file for writing statistics"),
+ &data_filename),
+ GNUNET_GETOPT_option_relative_time (
+ 't',
+ "matching-timeout",
+ "TIMEOUT",
+ gettext_noop (
+ "wait TIMEOUT before ending the experiment"),
+ &search_timeout_time),
+ GNUNET_GETOPT_option_filename (
+ 'p',
+ "policy-dir",
+ "DIRECTORY",
+ gettext_noop ("directory with policy files"),
+ &policy_dir),
+ GNUNET_GETOPT_option_filename (
+ 's',
+ "strings-file",
+ "FILENAME",
+ gettext_noop (
+ "name of file with input strings"),
+ &strings_file),
+ GNUNET_GETOPT_option_filename (
+ 'H',
+ "hosts-file",
+ "FILENAME",
+ gettext_noop (
+ "name of file with hosts' names"),
+ &hosts_file),
GNUNET_GETOPT_OPTION_END
};
int ret;
- if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
+ if (GNUNET_OK !=
+ GNUNET_STRINGS_get_utf8_args (argc, argv,
+ &argc, &argv))
return 2;
result = GNUNET_SYSERR;
ret =
GNUNET_PROGRAM_run (argc, argv,
"gnunet-regex-profiler",
_ ("Profiler for regex"),
- options, &run, NULL);
+ options,
+ &run, NULL);
if (GNUNET_OK != ret)
return ret;
if (GNUNET_OK != result)
diff --git a/src/regex/gnunet-service-regex.c b/src/regex/gnunet-service-regex.c
index 7a5cc1f05..deaa6112e 100644
--- a/src/regex/gnunet-service-regex.c
+++ b/src/regex/gnunet-service-regex.c
@@ -196,9 +196,9 @@ handle_announce (void *cls,
static void
handle_search_result (void *cls,
const struct GNUNET_PeerIdentity *id,
- const struct GNUNET_PeerIdentity *get_path,
+ const struct GNUNET_DHT_PathElement *get_path,
unsigned int get_path_length,
- const struct GNUNET_PeerIdentity *put_path,
+ const struct GNUNET_DHT_PathElement *put_path,
unsigned int put_path_length)
{
struct ClientEntry *ce = cls;
@@ -209,15 +209,15 @@ handle_search_result (void *cls,
if ((get_path_length >= 65536) ||
(put_path_length >= 65536) ||
- ( ((get_path_length + put_path_length) * sizeof(struct
- GNUNET_PeerIdentity))
+ ( ((get_path_length + put_path_length)
+ * sizeof(struct GNUNET_PeerIdentity))
+ sizeof(struct ResultMessage) >= GNUNET_MAX_MESSAGE_SIZE) )
{
GNUNET_break (0);
return;
}
- size = (get_path_length + put_path_length) * sizeof(struct
- GNUNET_PeerIdentity);
+ size = (get_path_length + put_path_length)
+ * sizeof(struct GNUNET_PeerIdentity);
env = GNUNET_MQ_msg_extra (result,
size,
GNUNET_MESSAGE_TYPE_REGEX_RESULT);
@@ -225,12 +225,10 @@ handle_search_result (void *cls,
result->put_path_length = htons ((uint16_t) put_path_length);
result->id = *id;
gp = &result->id;
- GNUNET_memcpy (&gp[1],
- get_path,
- get_path_length * sizeof(struct GNUNET_PeerIdentity));
- GNUNET_memcpy (&gp[1 + get_path_length],
- put_path,
- put_path_length * sizeof(struct GNUNET_PeerIdentity));
+ for (unsigned int i = 0; i<get_path_length; i++)
+ gp[i + 1] = get_path[i].pred;
+ for (unsigned int i = 0; i<put_path_length; i++)
+ gp[i + get_path_length + 1] = put_path[i].pred;
GNUNET_MQ_send (ce->mq,
env);
}
diff --git a/src/regex/regex_internal.h b/src/regex/regex_internal.h
index 8f29cff33..5b434b30c 100644
--- a/src/regex/regex_internal.h
+++ b/src/regex/regex_internal.h
@@ -340,10 +340,10 @@ REGEX_INTERNAL_construct_nfa (const char *regex, const size_t len);
*
* @return GNUNET_YES to proceed traversal, GNUNET_NO to stop.
*/
-typedef int (*REGEX_INTERNAL_traverse_check) (void *cls,
- struct REGEX_INTERNAL_State *s,
- struct REGEX_INTERNAL_Transition *
- t);
+typedef int
+(*REGEX_INTERNAL_traverse_check) (void *cls,
+ struct REGEX_INTERNAL_State *s,
+ struct REGEX_INTERNAL_Transition *t);
/**
@@ -353,9 +353,10 @@ typedef int (*REGEX_INTERNAL_traverse_check) (void *cls,
* @param count current count of the state, from 0 to a->state_count -1.
* @param s state.
*/
-typedef void (*REGEX_INTERNAL_traverse_action) (void *cls,
- const unsigned int count,
- struct REGEX_INTERNAL_State *s);
+typedef void
+(*REGEX_INTERNAL_traverse_action) (void *cls,
+ const unsigned int count,
+ struct REGEX_INTERNAL_State *s);
/**
diff --git a/src/regex/regex_internal_dht.c b/src/regex/regex_internal_dht.c
index 3fb74c319..2248de1f1 100644
--- a/src/regex/regex_internal_dht.c
+++ b/src/regex/regex_internal_dht.c
@@ -384,9 +384,9 @@ regex_next_edge (const struct RegexBlock *block,
static void
dht_get_string_accept_handler (void *cls, struct GNUNET_TIME_Absolute exp,
const struct GNUNET_HashCode *key,
- const struct GNUNET_PeerIdentity *get_path,
+ const struct GNUNET_DHT_PathElement *get_path,
unsigned int get_path_length,
- const struct GNUNET_PeerIdentity *put_path,
+ const struct GNUNET_DHT_PathElement *put_path,
unsigned int put_path_length,
enum GNUNET_BLOCK_Type type,
size_t size, const void *data)
@@ -464,9 +464,9 @@ regex_find_path (const struct GNUNET_HashCode *key,
static void
dht_get_string_handler (void *cls, struct GNUNET_TIME_Absolute exp,
const struct GNUNET_HashCode *key,
- const struct GNUNET_PeerIdentity *get_path,
+ const struct GNUNET_DHT_PathElement *get_path,
unsigned int get_path_length,
- const struct GNUNET_PeerIdentity *put_path,
+ const struct GNUNET_DHT_PathElement *put_path,
unsigned int put_path_length,
enum GNUNET_BLOCK_Type type,
size_t size, const void *data)
diff --git a/src/regex/regex_internal_lib.h b/src/regex/regex_internal_lib.h
index 94fac19f9..9baf84995 100644
--- a/src/regex/regex_internal_lib.h
+++ b/src/regex/regex_internal_lib.h
@@ -221,9 +221,9 @@ REGEX_INTERNAL_announce_cancel (struct REGEX_INTERNAL_Announcement *h);
typedef void
(*REGEX_INTERNAL_Found)(void *cls,
const struct GNUNET_PeerIdentity *id,
- const struct GNUNET_PeerIdentity *get_path,
+ const struct GNUNET_DHT_PathElement *get_path,
unsigned int get_path_length,
- const struct GNUNET_PeerIdentity *put_path,
+ const struct GNUNET_DHT_PathElement *put_path,
unsigned int put_path_length);
diff --git a/src/util/strings.c b/src/util/strings.c
index db672da87..76125b92e 100644
--- a/src/util/strings.c
+++ b/src/util/strings.c
@@ -69,29 +69,6 @@ GNUNET_STRINGS_buffer_fill (char *buffer,
}
-char *
-GNUNET_STRINGS_pp2s (const struct GNUNET_PeerIdentity *pids,
- unsigned int num_pids)
-{
- char *buf;
- size_t off;
- size_t plen = num_pids * 5 + 1;
-
- GNUNET_assert (num_pids < UINT32_MAX / 5);
- off = 0;
- buf = GNUNET_malloc (plen);
- for (unsigned int i = 0; i < num_pids; i++)
- {
- off += GNUNET_snprintf (&buf[off],
- plen - off,
- "%s%s",
- GNUNET_i2s (&pids[i]),
- (i == num_pids - 1) ? "" : "-");
- }
- return buf;
-}
-
-
unsigned int
GNUNET_STRINGS_buffer_tokenize (const char *buffer,
size_t size,