aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-transport.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/gnunet-transport.c')
-rw-r--r--src/transport/gnunet-transport.c38
1 files changed, 17 insertions, 21 deletions
diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c
index 66f02b104..c069bfb24 100644
--- a/src/transport/gnunet-transport.c
+++ b/src/transport/gnunet-transport.c
@@ -437,14 +437,14 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
437 traffic_received += ntohs (message->size); 437 traffic_received += ntohs (message->size);
438} 438}
439 439
440void process_string (void *cls, 440void
441 const char *address) 441process_string (void *cls, const char *address)
442{ 442{
443 struct GNUNET_PeerIdentity * peer = cls; 443 struct GNUNET_PeerIdentity *peer = cls;
444 444
445 if ((address != NULL)) 445 if ((address != NULL))
446 { 446 {
447 fprintf (stdout, _("Peer `%s': %s\n"), GNUNET_i2s(peer), address); 447 fprintf (stdout, _("Peer `%s': %s\n"), GNUNET_i2s (peer), address);
448 } 448 }
449 else 449 else
450 { 450 {
@@ -463,29 +463,25 @@ void process_string (void *cls,
463 * @param addrlen number of bytes in addr 463 * @param addrlen number of bytes in addr
464 */ 464 */
465static void 465static void
466process_address (void *cls, 466process_address (void *cls, const struct GNUNET_PeerIdentity *peer,
467 const struct GNUNET_PeerIdentity *peer, 467 const struct GNUNET_HELLO_Address *address)
468 const struct GNUNET_HELLO_Address *address)
469{ 468{
470 const struct GNUNET_CONFIGURATION_Handle * cfg = cls; 469 const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
471 struct GNUNET_PeerIdentity *peercp; 470 struct GNUNET_PeerIdentity *peercp;
472 471
473 if ( (address == NULL) || (peer == NULL) ) 472 if ((address == NULL) || (peer == NULL))
474 { 473 {
475 /* done */ 474 /* done */
476 return; 475 return;
477 } 476 }
478 477
479 peercp = GNUNET_malloc(sizeof (struct GNUNET_PeerIdentity)); 478 peercp = GNUNET_malloc (sizeof (struct GNUNET_PeerIdentity));
480 *peercp = *peer; 479 *peercp = *peer;
481 480
482 /* Resolve address to string */ 481 /* Resolve address to string */
483 GNUNET_TRANSPORT_address_to_string (cfg, 482 GNUNET_TRANSPORT_address_to_string (cfg, address, numeric,
484 address, 483 GNUNET_TIME_UNIT_MINUTES, &process_string,
485 numeric, 484 peercp);
486 GNUNET_TIME_UNIT_MINUTES,
487 &process_string,
488 peercp);
489} 485}
490 486
491 487
@@ -542,8 +538,8 @@ run (void *cls, char *const *args, const char *cfgfile,
542 if (iterate_connections) 538 if (iterate_connections)
543 { 539 {
544 GNUNET_TRANSPORT_peer_get_active_addresses (cfg, NULL, GNUNET_YES, 540 GNUNET_TRANSPORT_peer_get_active_addresses (cfg, NULL, GNUNET_YES,
545 GNUNET_TIME_UNIT_MINUTES, 541 GNUNET_TIME_UNIT_MINUTES,
546 &process_address, (void *)cfg); 542 &process_address, (void *) cfg);
547 } 543 }
548} 544}
549 545
@@ -568,9 +564,9 @@ main (int argc, char *const *argv)
568 {'t', "test", NULL, 564 {'t', "test", NULL,
569 gettext_noop ("test transport configuration (involves external server)"), 565 gettext_noop ("test transport configuration (involves external server)"),
570 0, &GNUNET_GETOPT_set_one, &test_configuration}, 566 0, &GNUNET_GETOPT_set_one, &test_configuration},
571 {'n', "numeric", NULL, 567 {'n', "numeric", NULL,
572 gettext_noop ("do not resolve hostnames"), 568 gettext_noop ("do not resolve hostnames"),
573 0, &GNUNET_GETOPT_set_one, &numeric}, 569 0, &GNUNET_GETOPT_set_one, &numeric},
574 GNUNET_GETOPT_OPTION_VERBOSE (&verbosity), 570 GNUNET_GETOPT_OPTION_VERBOSE (&verbosity),
575 GNUNET_GETOPT_OPTION_END 571 GNUNET_GETOPT_OPTION_END
576 }; 572 };