aboutsummaryrefslogtreecommitdiff
path: root/src/dht/gnunet-dht-put.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-01-31 14:44:41 +0100
committerChristian Grothoff <christian@grothoff.org>2017-01-31 14:44:41 +0100
commit2503d0fdf24b506999ed927240c55d3863e6163c (patch)
tree25ee56b2b9abf775057b2872f9770341ea64328a /src/dht/gnunet-dht-put.c
parentfbb30a3aff6bdc2b33ad8c97f0a69f9181853a39 (diff)
downloadgnunet-2503d0fdf24b506999ed927240c55d3863e6163c.tar.gz
gnunet-2503d0fdf24b506999ed927240c55d3863e6163c.zip
add method to record and print DHT routes to DHT command-line tools
Diffstat (limited to 'src/dht/gnunet-dht-put.c')
-rw-r--r--src/dht/gnunet-dht-put.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/dht/gnunet-dht-put.c b/src/dht/gnunet-dht-put.c
index 1f3df1d35..9b17da01f 100644
--- a/src/dht/gnunet-dht-put.c
+++ b/src/dht/gnunet-dht-put.c
@@ -57,11 +57,16 @@ static unsigned int replication = 5;
57static int verbose; 57static int verbose;
58 58
59/** 59/**
60 * Use DHT demultixplex_everywhere 60 * Use #GNUNET_DHT_DEMULTIPLEX_EVERYWHERE.
61 */ 61 */
62static int demultixplex_everywhere; 62static int demultixplex_everywhere;
63 63
64/** 64/**
65 * Use #GNUNET_DHT_RO_RECORD_ROUTE.
66 */
67static int record_route;
68
69/**
65 * Handle to the DHT 70 * Handle to the DHT
66 */ 71 */
67static struct GNUNET_DHT_Handle *dht_handle; 72static struct GNUNET_DHT_Handle *dht_handle;
@@ -144,6 +149,7 @@ run (void *cls,
144 const struct GNUNET_CONFIGURATION_Handle *c) 149 const struct GNUNET_CONFIGURATION_Handle *c)
145{ 150{
146 struct GNUNET_TIME_Absolute expiration; 151 struct GNUNET_TIME_Absolute expiration;
152 enum GNUNET_DHT_RouteOption ro;
147 153
148 cfg = c; 154 cfg = c;
149 if ((NULL == query_key) || (NULL == data)) 155 if ((NULL == query_key) || (NULL == data))
@@ -171,10 +177,15 @@ run (void *cls,
171 if (verbose) 177 if (verbose)
172 FPRINTF (stderr, _("Issuing put request for `%s' with data `%s'!\n"), 178 FPRINTF (stderr, _("Issuing put request for `%s' with data `%s'!\n"),
173 query_key, data); 179 query_key, data);
180 ro = GNUNET_DHT_RO_NONE;
181 if (demultixplex_everywhere)
182 ro |= GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE;
183 if (record_route)
184 ro |= GNUNET_DHT_RO_RECORD_ROUTE;
174 GNUNET_DHT_put (dht_handle, 185 GNUNET_DHT_put (dht_handle,
175 &key, 186 &key,
176 replication, 187 replication,
177 (demultixplex_everywhere) ? GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE : GNUNET_DHT_RO_NONE, 188 ro,
178 query_type, 189 query_type,
179 strlen (data), 190 strlen (data),
180 data, 191 data,
@@ -203,6 +214,9 @@ static struct GNUNET_GETOPT_CommandLineOption options[] = {
203 {'r', "replication", "LEVEL", 214 {'r', "replication", "LEVEL",
204 gettext_noop ("how many replicas to create"), 215 gettext_noop ("how many replicas to create"),
205 1, &GNUNET_GETOPT_set_uint, &replication}, 216 1, &GNUNET_GETOPT_set_uint, &replication},
217 {'R', "record", NULL,
218 gettext_noop ("use DHT's record route option"),
219 0, &GNUNET_GETOPT_set_one, &record_route},
206 {'t', "type", "TYPE", 220 {'t', "type", "TYPE",
207 gettext_noop ("the type to insert data as"), 221 gettext_noop ("the type to insert data as"),
208 1, &GNUNET_GETOPT_set_uint, &query_type}, 222 1, &GNUNET_GETOPT_set_uint, &query_type},