aboutsummaryrefslogtreecommitdiff
path: root/src/dht/gnunet-dht-monitor.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dht/gnunet-dht-monitor.c')
-rw-r--r--src/dht/gnunet-dht-monitor.c45
1 files changed, 26 insertions, 19 deletions
diff --git a/src/dht/gnunet-dht-monitor.c b/src/dht/gnunet-dht-monitor.c
index b7360bbab..b08521c7b 100644
--- a/src/dht/gnunet-dht-monitor.c
+++ b/src/dht/gnunet-dht-monitor.c
@@ -2,20 +2,18 @@
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2012 GNUnet e.V. 3 Copyright (C) 2012 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20/** 18/**
21 * @file dht/gnunet-dht-monitor.c 19 * @file dht/gnunet-dht-monitor.c
@@ -141,7 +139,8 @@ get_callback (void *cls,
141 const struct GNUNET_PeerIdentity *path, 139 const struct GNUNET_PeerIdentity *path,
142 const struct GNUNET_HashCode * key) 140 const struct GNUNET_HashCode * key)
143{ 141{
144 FPRINTF (stdout, "GET #%u: type %d, key `%s'\n", 142 FPRINTF (stdout,
143 "GET #%u: type %d, key `%s'\n",
145 result_count, 144 result_count,
146 (int) type, 145 (int) type,
147 GNUNET_h2s_full(key)); 146 GNUNET_h2s_full(key));
@@ -176,8 +175,11 @@ get_resp_callback (void *cls,
176 size_t size) 175 size_t size)
177{ 176{
178 FPRINTF (stdout, 177 FPRINTF (stdout,
179 "RESPONSE #%u: type %d, key `%s', data `%.*s'\n", 178 (GNUNET_BLOCK_TYPE_TEST == type)
179 ? "RESPONSE #%u (%s): type %d, key `%s', data `%.*s'\n"
180 : "RESPONSE #%u (%s): type %d, key `%s'\n",
180 result_count, 181 result_count,
182 GNUNET_STRINGS_absolute_time_to_string (exp),
181 (int) type, 183 (int) type,
182 GNUNET_h2s_full (key), 184 GNUNET_h2s_full (key),
183 (unsigned int) size, 185 (unsigned int) size,
@@ -215,8 +217,11 @@ put_callback (void *cls,
215 size_t size) 217 size_t size)
216{ 218{
217 FPRINTF (stdout, 219 FPRINTF (stdout,
218 "PUT %u: type %d, key `%s', data `%.*s'\n", 220 (GNUNET_BLOCK_TYPE_TEST == type)
221 ? "PUT %u (%s): type %d, key `%s', data `%.*s'\n"
222 : "PUT %u (%s): type %d, key `%s'\n",
219 result_count, 223 result_count,
224 GNUNET_STRINGS_absolute_time_to_string (exp),
220 (int) type, 225 (int) type,
221 GNUNET_h2s_full(key), 226 GNUNET_h2s_full(key),
222 (unsigned int) size, 227 (unsigned int) size,
@@ -234,7 +239,9 @@ put_callback (void *cls,
234 * @param c configuration 239 * @param c configuration
235 */ 240 */
236static void 241static void
237run (void *cls, char *const *args, const char *cfgfile, 242run (void *cls,
243 char *const *args,
244 const char *cfgfile,
238 const struct GNUNET_CONFIGURATION_Handle *c) 245 const struct GNUNET_CONFIGURATION_Handle *c)
239{ 246{
240 struct GNUNET_HashCode *key; 247 struct GNUNET_HashCode *key;
@@ -291,30 +298,30 @@ int
291main (int argc, char *const *argv) 298main (int argc, char *const *argv)
292{ 299{
293 struct GNUNET_GETOPT_CommandLineOption options[] = { 300 struct GNUNET_GETOPT_CommandLineOption options[] = {
294 301
295 GNUNET_GETOPT_option_string ('k', 302 GNUNET_GETOPT_option_string ('k',
296 "key", 303 "key",
297 "KEY", 304 "KEY",
298 gettext_noop ("the query key"), 305 gettext_noop ("the query key"),
299 &query_key), 306 &query_key),
300 307
301 GNUNET_GETOPT_option_uint ('t', 308 GNUNET_GETOPT_option_uint ('t',
302 "type", 309 "type",
303 "TYPE", 310 "TYPE",
304 gettext_noop ("the type of data to look for"), 311 gettext_noop ("the type of data to look for"),
305 &block_type), 312 &block_type),
306 313
307 GNUNET_GETOPT_option_relative_time ('T', 314 GNUNET_GETOPT_option_relative_time ('T',
308 "timeout", 315 "timeout",
309 "TIMEOUT", 316 "TIMEOUT",
310 gettext_noop ("how long should the monitor command run"), 317 gettext_noop ("how long should the monitor command run"),
311 &timeout_request), 318 &timeout_request),
312 319
313 GNUNET_GETOPT_option_flag ('V', 320 GNUNET_GETOPT_option_flag ('V',
314 "verbose", 321 "verbose",
315 gettext_noop ("be verbose (print progress information)"), 322 gettext_noop ("be verbose (print progress information)"),
316 &verbose), 323 &verbose),
317 324
318 GNUNET_GETOPT_OPTION_END 325 GNUNET_GETOPT_OPTION_END
319 }; 326 };
320 327