aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-transport.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2011-11-29 18:04:01 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2011-11-29 18:04:01 +0000
commit56c32ea37a52b239494a7f91933e60eb7caf30f3 (patch)
tree5c8c8ef6b577da4931ec3e546b2fb60ed0e8f029 /src/transport/gnunet-transport.c
parent5ca85864950a1fe92613f5ed3a69cd08d248423e (diff)
downloadgnunet-56c32ea37a52b239494a7f91933e60eb7caf30f3.tar.gz
gnunet-56c32ea37a52b239494a7f91933e60eb7caf30f3.zip
- finale commit for the api change
Diffstat (limited to 'src/transport/gnunet-transport.c')
-rw-r--r--src/transport/gnunet-transport.c43
1 files changed, 30 insertions, 13 deletions
diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c
index 58d20e16d..9097311a6 100644
--- a/src/transport/gnunet-transport.c
+++ b/src/transport/gnunet-transport.c
@@ -76,6 +76,11 @@ static int iterate_connections;
76static int test_configuration; 76static int test_configuration;
77 77
78/** 78/**
79 * Option -n.
80 */
81static int numeric;
82
83/**
79 * Global return value (0 success). 84 * Global return value (0 success).
80 */ 85 */
81static int ret; 86static int ret;
@@ -150,7 +155,6 @@ struct TestContext
150 155
151}; 156};
152 157
153struct GNUNET_CONFIGURATION_Handle * cfg;
154 158
155/** 159/**
156 * Display the result of the test. 160 * Display the result of the test.
@@ -436,7 +440,17 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
436void process_string (void *cls, 440void process_string (void *cls,
437 const char *address) 441 const char *address)
438{ 442{
439 fprintf (stdout, _("process_string\n")); 443 struct GNUNET_PeerIdentity * peer = cls;
444
445 if ((address != NULL))
446 {
447 fprintf (stdout, _("Peer `%s' : %s\n"), GNUNET_i2s(peer), address);
448 }
449 else
450 {
451 /* done */
452 GNUNET_free (peer);
453 }
440} 454}
441 455
442/** 456/**
@@ -451,23 +465,24 @@ void process_string (void *cls,
451static void 465static void
452process_address (void *cls, const struct GNUNET_HELLO_Address *address) 466process_address (void *cls, const struct GNUNET_HELLO_Address *address)
453{ 467{
468 const struct GNUNET_CONFIGURATION_Handle * cfg = cls;
469
454 if (address == NULL) 470 if (address == NULL)
455 { 471 {
472 /* done */
456 return; 473 return;
457 } 474 }
458 475
459 fprintf (stdout, _("Peer `%s'\n"), 476 struct GNUNET_PeerIdentity * peer = GNUNET_malloc(sizeof (struct GNUNET_PeerIdentity));
460 GNUNET_i2s (&address->peer)); 477 *peer = address->peer;
461 478
462 /* Resolve address to string */ 479 /* Resolve address to string */
463 /*
464 GNUNET_TRANSPORT_address_to_string (cfg, 480 GNUNET_TRANSPORT_address_to_string (cfg,
465 address, 481 address,
466 GNUNET_NO, 482 numeric,
467 GNUNET_TIME_UNIT_MINUTES, 483 GNUNET_TIME_UNIT_MINUTES,
468 &process_string, 484 &process_string,
469 NULL); 485 peer);
470 */
471} 486}
472 487
473 488
@@ -483,7 +498,6 @@ static void
483run (void *cls, char *const *args, const char *cfgfile, 498run (void *cls, char *const *args, const char *cfgfile,
484 const struct GNUNET_CONFIGURATION_Handle *cfg) 499 const struct GNUNET_CONFIGURATION_Handle *cfg)
485{ 500{
486 cfg = cfg;
487 if (test_configuration) 501 if (test_configuration)
488 { 502 {
489 do_test_configuration (cfg); 503 do_test_configuration (cfg);
@@ -525,7 +539,7 @@ run (void *cls, char *const *args, const char *cfgfile,
525 if (iterate_connections) 539 if (iterate_connections)
526 { 540 {
527 GNUNET_TRANSPORT_address_iterate (cfg, GNUNET_TIME_UNIT_MINUTES, 541 GNUNET_TRANSPORT_address_iterate (cfg, GNUNET_TIME_UNIT_MINUTES,
528 &process_address, NULL); 542 &process_address, (void *)cfg);
529 } 543 }
530} 544}
531 545
@@ -550,6 +564,9 @@ main (int argc, char *const *argv)
550 {'t', "test", NULL, 564 {'t', "test", NULL,
551 gettext_noop ("test transport configuration (involves external server)"), 565 gettext_noop ("test transport configuration (involves external server)"),
552 0, &GNUNET_GETOPT_set_one, &test_configuration}, 566 0, &GNUNET_GETOPT_set_one, &test_configuration},
567 {'n', "numeric", NULL,
568 gettext_noop ("do not resolve hostnames"),
569 0, &GNUNET_GETOPT_set_one, &numeric},
553 GNUNET_GETOPT_OPTION_VERBOSE (&verbosity), 570 GNUNET_GETOPT_OPTION_VERBOSE (&verbosity),
554 GNUNET_GETOPT_OPTION_END 571 GNUNET_GETOPT_OPTION_END
555 }; 572 };