aboutsummaryrefslogtreecommitdiff
path: root/src/dht
diff options
context:
space:
mode:
authorng0 <ng0@n0.is>2019-09-06 22:46:29 +0000
committerng0 <ng0@n0.is>2019-09-06 22:46:29 +0000
commit6e599264ad13e8fc105493d74d7c11d46f8739ed (patch)
tree169bef1ecbade5a659831fb169f3ae6943af127f /src/dht
parent4f13bc15113021ebf71d5d81e99bc29f8a07fc9c (diff)
downloadgnunet-6e599264ad13e8fc105493d74d7c11d46f8739ed.tar.gz
gnunet-6e599264ad13e8fc105493d74d7c11d46f8739ed.zip
first step to remove plibc
Diffstat (limited to 'src/dht')
-rw-r--r--src/dht/gnunet-dht-get.c149
-rw-r--r--src/dht/gnunet-dht-monitor.c110
-rw-r--r--src/dht/gnunet-dht-put.c118
-rw-r--r--src/dht/test_dht_api.c2
-rw-r--r--src/dht/test_dht_topo.c2
5 files changed, 194 insertions, 187 deletions
diff --git a/src/dht/gnunet-dht-get.c b/src/dht/gnunet-dht-get.c
index b42326fc5..af667584b 100644
--- a/src/dht/gnunet-dht-get.c
+++ b/src/dht/gnunet-dht-get.c
@@ -26,7 +26,7 @@
26#include "platform.h" 26#include "platform.h"
27#include "gnunet_dht_service.h" 27#include "gnunet_dht_service.h"
28 28
29#define LOG(kind,...) GNUNET_log_from (kind, "dht-clients",__VA_ARGS__) 29#define LOG(kind, ...) GNUNET_log_from (kind, "dht-clients", __VA_ARGS__)
30/** 30/**
31 * The type of the query 31 * The type of the query
32 */ 32 */
@@ -45,7 +45,7 @@ static char *query_key;
45/** 45/**
46 * User supplied timeout value 46 * User supplied timeout value
47 */ 47 */
48static struct GNUNET_TIME_Relative timeout_request = { 60000 }; 48static struct GNUNET_TIME_Relative timeout_request = {60000};
49 49
50/** 50/**
51 * Be verbose 51 * Be verbose
@@ -143,8 +143,9 @@ timeout_task (void *cls)
143 * @param data pointer to the result data 143 * @param data pointer to the result data
144 */ 144 */
145static void 145static void
146get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp, 146get_result_iterator (void *cls,
147 const struct GNUNET_HashCode * key, 147 struct GNUNET_TIME_Absolute exp,
148 const struct GNUNET_HashCode *key,
148 const struct GNUNET_PeerIdentity *get_path, 149 const struct GNUNET_PeerIdentity *get_path,
149 unsigned int get_path_length, 150 unsigned int get_path_length,
150 const struct GNUNET_PeerIdentity *put_path, 151 const struct GNUNET_PeerIdentity *put_path,
@@ -153,32 +154,22 @@ get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
153 size_t size, 154 size_t size,
154 const void *data) 155 const void *data)
155{ 156{
156 FPRINTF (stdout, 157 fprintf (stdout,
157 (GNUNET_BLOCK_TYPE_TEST == type) 158 (GNUNET_BLOCK_TYPE_TEST == type) ? _ ("Result %d, type %d:\n%.*s\n")
158 ? _("Result %d, type %d:\n%.*s\n") 159 : _ ("Result %d, type %d:\n"),
159 : _("Result %d, type %d:\n"), 160 result_count,
160 result_count,
161 type, 161 type,
162 (unsigned int) size, 162 (unsigned int) size,
163 (char *) data); 163 (char *) data);
164 if (verbose) 164 if (verbose)
165 { 165 {
166 FPRINTF (stdout, 166 fprintf (stdout, " GET path: ");
167 " GET path: "); 167 for (unsigned int i = 0; i < get_path_length; i++)
168 for (unsigned int i=0;i<get_path_length;i++) 168 fprintf (stdout, "%s%s", (0 == i) ? "" : "-", GNUNET_i2s (&get_path[i]));
169 FPRINTF (stdout, 169 fprintf (stdout, "\n PUT path: ");
170 "%s%s", 170 for (unsigned int i = 0; i < put_path_length; i++)
171 (0 == i) ? "" : "-", 171 fprintf (stdout, "%s%s", (0 == i) ? "" : "-", GNUNET_i2s (&put_path[i]));
172 GNUNET_i2s (&get_path[i])); 172 fprintf (stdout, "\n");
173 FPRINTF (stdout,
174 "\n PUT path: ");
175 for (unsigned int i=0;i<put_path_length;i++)
176 FPRINTF (stdout,
177 "%s%s",
178 (0 == i) ? "" : "-",
179 GNUNET_i2s (&put_path[i]));
180 FPRINTF (stdout,
181 "\n");
182 } 173 }
183 result_count++; 174 result_count++;
184} 175}
@@ -193,7 +184,9 @@ get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
193 * @param c configuration 184 * @param c configuration
194 */ 185 */
195static void 186static void
196run (void *cls, char *const *args, const char *cfgfile, 187run (void *cls,
188 char *const *args,
189 const char *cfgfile,
197 const struct GNUNET_CONFIGURATION_Handle *c) 190 const struct GNUNET_CONFIGURATION_Handle *c)
198{ 191{
199 struct GNUNET_HashCode key; 192 struct GNUNET_HashCode key;
@@ -201,33 +194,37 @@ run (void *cls, char *const *args, const char *cfgfile,
201 cfg = c; 194 cfg = c;
202 if (NULL == query_key) 195 if (NULL == query_key)
203 { 196 {
204 FPRINTF (stderr, "%s", _("Must provide key for DHT GET!\n")); 197 fprintf (stderr, "%s", _ ("Must provide key for DHT GET!\n"));
205 ret = 1; 198 ret = 1;
206 return; 199 return;
207 } 200 }
208 if (NULL == (dht_handle = GNUNET_DHT_connect (cfg, 1))) 201 if (NULL == (dht_handle = GNUNET_DHT_connect (cfg, 1)))
209 { 202 {
210 FPRINTF (stderr, "%s", _("Failed to connect to DHT service!\n")); 203 fprintf (stderr, "%s", _ ("Failed to connect to DHT service!\n"));
211 ret = 1; 204 ret = 1;
212 return; 205 return;
213 } 206 }
214 if (query_type == GNUNET_BLOCK_TYPE_ANY) /* Type of data not set */ 207 if (query_type == GNUNET_BLOCK_TYPE_ANY) /* Type of data not set */
215 query_type = GNUNET_BLOCK_TYPE_TEST; 208 query_type = GNUNET_BLOCK_TYPE_TEST;
216 GNUNET_CRYPTO_hash (query_key, strlen (query_key), &key); 209 GNUNET_CRYPTO_hash (query_key, strlen (query_key), &key);
217 if (verbose) 210 if (verbose)
218 FPRINTF (stderr, "%s `%s' \n", 211 fprintf (stderr,
219 _("Issuing DHT GET with key"), 212 "%s `%s' \n",
213 _ ("Issuing DHT GET with key"),
220 GNUNET_h2s_full (&key)); 214 GNUNET_h2s_full (&key));
221 GNUNET_SCHEDULER_add_shutdown (&cleanup_task, NULL); 215 GNUNET_SCHEDULER_add_shutdown (&cleanup_task, NULL);
222 tt = GNUNET_SCHEDULER_add_delayed (timeout_request, 216 tt = GNUNET_SCHEDULER_add_delayed (timeout_request, &timeout_task, NULL);
223 &timeout_task, 217 get_handle = GNUNET_DHT_get_start (dht_handle,
218 query_type,
219 &key,
220 replication,
221 (demultixplex_everywhere)
222 ? GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE
223 : GNUNET_DHT_RO_NONE,
224 NULL,
225 0,
226 &get_result_iterator,
224 NULL); 227 NULL);
225 get_handle =
226 GNUNET_DHT_get_start (dht_handle, query_type, &key, replication,
227 (demultixplex_everywhere) ? GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE : GNUNET_DHT_RO_NONE,
228 NULL, 0,
229 &get_result_iterator,
230 NULL);
231} 228}
232 229
233 230
@@ -241,44 +238,52 @@ run (void *cls, char *const *args, const char *cfgfile,
241int 238int
242main (int argc, char *const *argv) 239main (int argc, char *const *argv)
243{ 240{
244 struct GNUNET_GETOPT_CommandLineOption options[] = { 241 struct GNUNET_GETOPT_CommandLineOption options[] =
245 GNUNET_GETOPT_option_string ('k', 242 {GNUNET_GETOPT_option_string ('k',
246 "key", 243 "key",
247 "KEY", 244 "KEY",
248 gettext_noop ("the query key"), 245 gettext_noop ("the query key"),
249 &query_key), 246 &query_key),
250 GNUNET_GETOPT_option_uint ('r', 247 GNUNET_GETOPT_option_uint (
251 "replication", 248 'r',
252 "LEVEL", 249 "replication",
253 gettext_noop ("how many parallel requests (replicas) to create"), 250 "LEVEL",
254 &replication), 251 gettext_noop ("how many parallel requests (replicas) to create"),
255 GNUNET_GETOPT_option_uint ('t', 252 &replication),
256 "type", 253 GNUNET_GETOPT_option_uint ('t',
257 "TYPE", 254 "type",
258 gettext_noop ("the type of data to look for"), 255 "TYPE",
259 &query_type), 256 gettext_noop ("the type of data to look for"),
260 GNUNET_GETOPT_option_relative_time ('T', 257 &query_type),
261 "timeout", 258 GNUNET_GETOPT_option_relative_time (
262 "TIMEOUT", 259 'T',
263 gettext_noop ("how long to execute this query before giving up?"), 260 "timeout",
264 &timeout_request), 261 "TIMEOUT",
265 GNUNET_GETOPT_option_flag ('x', 262 gettext_noop ("how long to execute this query before giving up?"),
266 "demultiplex", 263 &timeout_request),
267 gettext_noop ("use DHT's demultiplex everywhere option"), 264 GNUNET_GETOPT_option_flag ('x',
268 &demultixplex_everywhere), 265 "demultiplex",
269 GNUNET_GETOPT_option_verbose (&verbose), 266 gettext_noop (
270 GNUNET_GETOPT_OPTION_END 267 "use DHT's demultiplex everywhere option"),
271 }; 268 &demultixplex_everywhere),
272 269 GNUNET_GETOPT_option_verbose (&verbose),
270 GNUNET_GETOPT_OPTION_END};
273 271
274 272
275 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) 273 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
276 return 2; 274 return 2;
277 return (GNUNET_OK == 275 return (GNUNET_OK ==
278 GNUNET_PROGRAM_run (argc, argv, "gnunet-dht-get", 276 GNUNET_PROGRAM_run (
279 gettext_noop 277 argc,
280 ("Issue a GET request to the GNUnet DHT, prints results."), 278 argv,
281 options, &run, NULL)) ? ret : 1; 279 "gnunet-dht-get",
280 gettext_noop (
281 "Issue a GET request to the GNUnet DHT, prints results."),
282 options,
283 &run,
284 NULL))
285 ? ret
286 : 1;
282} 287}
283 288
284/* end of gnunet-dht-get.c */ 289/* end of gnunet-dht-get.c */
diff --git a/src/dht/gnunet-dht-monitor.c b/src/dht/gnunet-dht-monitor.c
index 52a57473b..3787b7cfa 100644
--- a/src/dht/gnunet-dht-monitor.c
+++ b/src/dht/gnunet-dht-monitor.c
@@ -39,7 +39,7 @@ static char *query_key;
39/** 39/**
40 * User supplied timeout value (in seconds) 40 * User supplied timeout value (in seconds)
41 */ 41 */
42static struct GNUNET_TIME_Relative timeout_request = { 60000 }; 42static struct GNUNET_TIME_Relative timeout_request = {60000};
43 43
44/** 44/**
45 * Be verbose 45 * Be verbose
@@ -86,7 +86,7 @@ static void
86cleanup_task (void *cls) 86cleanup_task (void *cls)
87{ 87{
88 if (verbose) 88 if (verbose)
89 FPRINTF (stderr, "%s", "Cleaning up!\n"); 89 fprintf (stderr, "%s", "Cleaning up!\n");
90 if (NULL != monitor_handle) 90 if (NULL != monitor_handle)
91 { 91 {
92 GNUNET_DHT_monitor_stop (monitor_handle); 92 GNUNET_DHT_monitor_stop (monitor_handle);
@@ -118,7 +118,6 @@ timeout_task (void *cls)
118} 118}
119 119
120 120
121
122/** 121/**
123 * Callback called on each GET request going through the DHT. 122 * Callback called on each GET request going through the DHT.
124 * 123 *
@@ -139,13 +138,13 @@ get_callback (void *cls,
139 uint32_t desired_replication_level, 138 uint32_t desired_replication_level,
140 unsigned int path_length, 139 unsigned int path_length,
141 const struct GNUNET_PeerIdentity *path, 140 const struct GNUNET_PeerIdentity *path,
142 const struct GNUNET_HashCode * key) 141 const struct GNUNET_HashCode *key)
143{ 142{
144 FPRINTF (stdout, 143 fprintf (stdout,
145 "GET #%u: type %d, key `%s'\n", 144 "GET #%u: type %d, key `%s'\n",
146 result_count, 145 result_count,
147 (int) type, 146 (int) type,
148 GNUNET_h2s_full(key)); 147 GNUNET_h2s_full (key));
149 result_count++; 148 result_count++;
150} 149}
151 150
@@ -172,14 +171,14 @@ get_resp_callback (void *cls,
172 const struct GNUNET_PeerIdentity *put_path, 171 const struct GNUNET_PeerIdentity *put_path,
173 unsigned int put_path_length, 172 unsigned int put_path_length,
174 struct GNUNET_TIME_Absolute exp, 173 struct GNUNET_TIME_Absolute exp,
175 const struct GNUNET_HashCode * key, 174 const struct GNUNET_HashCode *key,
176 const void *data, 175 const void *data,
177 size_t size) 176 size_t size)
178{ 177{
179 FPRINTF (stdout, 178 fprintf (stdout,
180 (GNUNET_BLOCK_TYPE_TEST == type) 179 (GNUNET_BLOCK_TYPE_TEST == type)
181 ? "RESPONSE #%u (%s): type %d, key `%s', data `%.*s'\n" 180 ? "RESPONSE #%u (%s): type %d, key `%s', data `%.*s'\n"
182 : "RESPONSE #%u (%s): type %d, key `%s'\n", 181 : "RESPONSE #%u (%s): type %d, key `%s'\n",
183 result_count, 182 result_count,
184 GNUNET_STRINGS_absolute_time_to_string (exp), 183 GNUNET_STRINGS_absolute_time_to_string (exp),
185 (int) type, 184 (int) type,
@@ -214,18 +213,18 @@ put_callback (void *cls,
214 unsigned int path_length, 213 unsigned int path_length,
215 const struct GNUNET_PeerIdentity *path, 214 const struct GNUNET_PeerIdentity *path,
216 struct GNUNET_TIME_Absolute exp, 215 struct GNUNET_TIME_Absolute exp,
217 const struct GNUNET_HashCode * key, 216 const struct GNUNET_HashCode *key,
218 const void *data, 217 const void *data,
219 size_t size) 218 size_t size)
220{ 219{
221 FPRINTF (stdout, 220 fprintf (stdout,
222 (GNUNET_BLOCK_TYPE_TEST == type) 221 (GNUNET_BLOCK_TYPE_TEST == type)
223 ? "PUT %u (%s): type %d, key `%s', data `%.*s'\n" 222 ? "PUT %u (%s): type %d, key `%s', data `%.*s'\n"
224 : "PUT %u (%s): type %d, key `%s'\n", 223 : "PUT %u (%s): type %d, key `%s'\n",
225 result_count, 224 result_count,
226 GNUNET_STRINGS_absolute_time_to_string (exp), 225 GNUNET_STRINGS_absolute_time_to_string (exp),
227 (int) type, 226 (int) type,
228 GNUNET_h2s_full(key), 227 GNUNET_h2s_full (key),
229 (unsigned int) size, 228 (unsigned int) size,
230 (char *) data); 229 (char *) data);
231 result_count++; 230 result_count++;
@@ -253,33 +252,29 @@ run (void *cls,
253 252
254 if (NULL == (dht_handle = GNUNET_DHT_connect (cfg, 1))) 253 if (NULL == (dht_handle = GNUNET_DHT_connect (cfg, 1)))
255 { 254 {
256 FPRINTF (stderr, "%s", 255 fprintf (stderr, "%s", _ ("Failed to connect to DHT service!\n"));
257 _("Failed to connect to DHT service!\n"));
258 ret = 1; 256 ret = 1;
259 return; 257 return;
260 } 258 }
261 if (GNUNET_BLOCK_TYPE_ANY == block_type) /* Type of data not set */ 259 if (GNUNET_BLOCK_TYPE_ANY == block_type) /* Type of data not set */
262 block_type = GNUNET_BLOCK_TYPE_TEST; 260 block_type = GNUNET_BLOCK_TYPE_TEST;
263 if (NULL != query_key) 261 if (NULL != query_key)
264 { 262 {
265 key = &hc; 263 key = &hc;
266 if (GNUNET_OK != 264 if (GNUNET_OK != GNUNET_CRYPTO_hash_from_string (query_key, key))
267 GNUNET_CRYPTO_hash_from_string (query_key, key)) 265 GNUNET_CRYPTO_hash (query_key, strlen (query_key), key);
268 GNUNET_CRYPTO_hash (query_key, strlen (query_key), key); 266 }
269 }
270 else 267 else
271 { 268 {
272 key = NULL; 269 key = NULL;
273 } 270 }
274 if (verbose) 271 if (verbose)
275 FPRINTF (stderr, 272 fprintf (stderr,
276 "Monitoring for %s\n", 273 "Monitoring for %s\n",
277 GNUNET_STRINGS_relative_time_to_string (timeout_request, GNUNET_NO)); 274 GNUNET_STRINGS_relative_time_to_string (timeout_request,
278 tt = GNUNET_SCHEDULER_add_delayed (timeout_request, 275 GNUNET_NO));
279 &timeout_task, 276 tt = GNUNET_SCHEDULER_add_delayed (timeout_request, &timeout_task, NULL);
280 NULL); 277 GNUNET_SCHEDULER_add_shutdown (&cleanup_task, NULL);
281 GNUNET_SCHEDULER_add_shutdown (&cleanup_task,
282 NULL);
283 monitor_handle = GNUNET_DHT_monitor_start (dht_handle, 278 monitor_handle = GNUNET_DHT_monitor_start (dht_handle,
284 block_type, 279 block_type,
285 key, 280 key,
@@ -308,34 +303,41 @@ main (int argc, char *const *argv)
308 &query_key), 303 &query_key),
309 304
310 GNUNET_GETOPT_option_uint ('t', 305 GNUNET_GETOPT_option_uint ('t',
311 "type", 306 "type",
312 "TYPE", 307 "TYPE",
313 gettext_noop ("the type of data to look for"), 308 gettext_noop ("the type of data to look for"),
314 &block_type), 309 &block_type),
315 310
316 GNUNET_GETOPT_option_relative_time ('T', 311 GNUNET_GETOPT_option_relative_time (
317 "timeout", 312 'T',
318 "TIMEOUT", 313 "timeout",
319 gettext_noop ("how long should the monitor command run"), 314 "TIMEOUT",
320 &timeout_request), 315 gettext_noop ("how long should the monitor command run"),
316 &timeout_request),
321 317
322 GNUNET_GETOPT_option_flag ('V', 318 GNUNET_GETOPT_option_flag ('V',
323 "verbose", 319 "verbose",
324 gettext_noop ("be verbose (print progress information)"), 320 gettext_noop (
325 &verbose), 321 "be verbose (print progress information)"),
322 &verbose),
326 323
327 GNUNET_GETOPT_OPTION_END 324 GNUNET_GETOPT_OPTION_END};
328 };
329 325
330 326
331 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) 327 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
332 return 2; 328 return 2;
333 329
334 return (GNUNET_OK == 330 return (GNUNET_OK ==
335 GNUNET_PROGRAM_run (argc, argv, "gnunet-dht-monitor", 331 GNUNET_PROGRAM_run (argc,
336 gettext_noop 332 argv,
337 ("Prints all packets that go through the DHT."), 333 "gnunet-dht-monitor",
338 options, &run, NULL)) ? ret : 1; 334 gettext_noop (
335 "Prints all packets that go through the DHT."),
336 options,
337 &run,
338 NULL))
339 ? ret
340 : 1;
339} 341}
340 342
341/* end of gnunet-dht-monitor.c */ 343/* end of gnunet-dht-monitor.c */
diff --git a/src/dht/gnunet-dht-put.c b/src/dht/gnunet-dht-put.c
index 4c26f98a5..0432dc4a0 100644
--- a/src/dht/gnunet-dht-put.c
+++ b/src/dht/gnunet-dht-put.c
@@ -107,8 +107,7 @@ shutdown_task (void *cls)
107static void 107static void
108message_sent_cont (void *cls) 108message_sent_cont (void *cls)
109{ 109{
110 GNUNET_SCHEDULER_add_now (&shutdown_task, 110 GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
111 NULL);
112} 111}
113 112
114 113
@@ -131,26 +130,25 @@ run (void *cls,
131 cfg = c; 130 cfg = c;
132 if ((NULL == query_key) || (NULL == data)) 131 if ((NULL == query_key) || (NULL == data))
133 { 132 {
134 FPRINTF (stderr, "%s", _("Must provide KEY and DATA for DHT put!\n")); 133 fprintf (stderr, "%s", _ ("Must provide KEY and DATA for DHT put!\n"));
135 ret = 1; 134 ret = 1;
136 return; 135 return;
137 } 136 }
138 137
139 if (NULL == (dht_handle = GNUNET_DHT_connect (cfg, 1))) 138 if (NULL == (dht_handle = GNUNET_DHT_connect (cfg, 1)))
140 { 139 {
141 FPRINTF (stderr, 140 fprintf (stderr, _ ("Could not connect to DHT service!\n"));
142 _("Could not connect to DHT service!\n"));
143 ret = 1; 141 ret = 1;
144 return; 142 return;
145 } 143 }
146 if (GNUNET_BLOCK_TYPE_ANY == query_type) /* Type of data not set */ 144 if (GNUNET_BLOCK_TYPE_ANY == query_type) /* Type of data not set */
147 query_type = GNUNET_BLOCK_TYPE_TEST; 145 query_type = GNUNET_BLOCK_TYPE_TEST;
148 146
149 GNUNET_CRYPTO_hash (query_key, strlen (query_key), &key); 147 GNUNET_CRYPTO_hash (query_key, strlen (query_key), &key);
150 148
151 if (verbose) 149 if (verbose)
152 FPRINTF (stderr, 150 fprintf (stderr,
153 _("Issuing put request for `%s' with data `%s'!\n"), 151 _ ("Issuing put request for `%s' with data `%s'!\n"),
154 query_key, 152 query_key,
155 data); 153 data);
156 ro = GNUNET_DHT_RO_NONE; 154 ro = GNUNET_DHT_RO_NONE;
@@ -181,60 +179,62 @@ int
181main (int argc, char *const *argv) 179main (int argc, char *const *argv)
182{ 180{
183 181
184 struct GNUNET_GETOPT_CommandLineOption options[] = { 182 struct GNUNET_GETOPT_CommandLineOption options[] =
185 GNUNET_GETOPT_option_string ('d', 183 {GNUNET_GETOPT_option_string ('d',
186 "data", 184 "data",
187 "DATA", 185 "DATA",
188 gettext_noop ("the data to insert under the key"), 186 gettext_noop (
189 &data), 187 "the data to insert under the key"),
190 GNUNET_GETOPT_option_relative_time ('e', 188 &data),
191 "expiration", 189 GNUNET_GETOPT_option_relative_time (
192 "EXPIRATION", 190 'e',
193 gettext_noop ("how long to store this entry in the dht (in seconds)"), 191 "expiration",
194 &expiration), 192 "EXPIRATION",
195 GNUNET_GETOPT_option_string ('k', 193 gettext_noop ("how long to store this entry in the dht (in seconds)"),
196 "key", 194 &expiration),
197 "KEY", 195 GNUNET_GETOPT_option_string ('k',
198 gettext_noop ("the query key"), 196 "key",
199 &query_key), 197 "KEY",
200 GNUNET_GETOPT_option_flag ('x', 198 gettext_noop ("the query key"),
201 "demultiplex", 199 &query_key),
202 gettext_noop ("use DHT's demultiplex everywhere option"), 200 GNUNET_GETOPT_option_flag ('x',
203 &demultixplex_everywhere), 201 "demultiplex",
204 GNUNET_GETOPT_option_uint ('r', 202 gettext_noop (
205 "replication", 203 "use DHT's demultiplex everywhere option"),
206 "LEVEL", 204 &demultixplex_everywhere),
207 gettext_noop ("how many replicas to create"), 205 GNUNET_GETOPT_option_uint ('r',
208 &replication), 206 "replication",
209 GNUNET_GETOPT_option_flag ('R', 207 "LEVEL",
210 "record", 208 gettext_noop ("how many replicas to create"),
211 gettext_noop ("use DHT's record route option"), 209 &replication),
212 &record_route), 210 GNUNET_GETOPT_option_flag ('R',
213 GNUNET_GETOPT_option_uint ('t', 211 "record",
214 "type", 212 gettext_noop ("use DHT's record route option"),
215 "TYPE", 213 &record_route),
216 gettext_noop ("the type to insert data as"), 214 GNUNET_GETOPT_option_uint ('t',
217 &query_type), 215 "type",
218 GNUNET_GETOPT_option_verbose (&verbose), 216 "TYPE",
219 GNUNET_GETOPT_OPTION_END 217 gettext_noop ("the type to insert data as"),
220 }; 218 &query_type),
221 219 GNUNET_GETOPT_option_verbose (&verbose),
222 220 GNUNET_GETOPT_OPTION_END};
223 if (GNUNET_OK != 221
224 GNUNET_STRINGS_get_utf8_args (argc, argv, 222
225 &argc, &argv)) 223 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
226 return 2; 224 return 2;
227 expiration = GNUNET_TIME_UNIT_HOURS; 225 expiration = GNUNET_TIME_UNIT_HOURS;
228 return (GNUNET_OK == 226 return (GNUNET_OK ==
229 GNUNET_PROGRAM_run (argc, 227 GNUNET_PROGRAM_run (
230 argv, 228 argc,
231 "gnunet-dht-put", 229 argv,
232 gettext_noop 230 "gnunet-dht-put",
233 ("Issue a PUT request to the GNUnet DHT insert DATA under KEY."), 231 gettext_noop (
234 options, 232 "Issue a PUT request to the GNUnet DHT insert DATA under KEY."),
235 &run, 233 options,
236 NULL)) 234 &run,
237 ? ret : 1; 235 NULL))
236 ? ret
237 : 1;
238} 238}
239 239
240/* end of gnunet-dht-put.c */ 240/* end of gnunet-dht-put.c */
diff --git a/src/dht/test_dht_api.c b/src/dht/test_dht_api.c
index 38adbc219..7ec6758b7 100644
--- a/src/dht/test_dht_api.c
+++ b/src/dht/test_dht_api.c
@@ -74,7 +74,7 @@ static void
74end_badly (void *cls) 74end_badly (void *cls)
75{ 75{
76 die_task = NULL; 76 die_task = NULL;
77 FPRINTF (stderr, 77 fprintf (stderr,
78 "%s", 78 "%s",
79 "Ending on an unhappy note.\n"); 79 "Ending on an unhappy note.\n");
80 GNUNET_SCHEDULER_shutdown (); 80 GNUNET_SCHEDULER_shutdown ();
diff --git a/src/dht/test_dht_topo.c b/src/dht/test_dht_topo.c
index 2ff0e7a59..a0d80e52c 100644
--- a/src/dht/test_dht_topo.c
+++ b/src/dht/test_dht_topo.c
@@ -212,7 +212,7 @@ stats_finished (void *cls,
212 return; 212 return;
213 } 213 }
214 for (i = 0; NULL != stats[i].name; i++) 214 for (i = 0; NULL != stats[i].name; i++)
215 FPRINTF (stderr, 215 fprintf (stderr,
216 "%6s/%60s = %12llu\n", 216 "%6s/%60s = %12llu\n",
217 stats[i].subsystem, 217 stats[i].subsystem,
218 stats[i].name, 218 stats[i].name,