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.c571
1 files changed, 256 insertions, 315 deletions
diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c
index c3c1afc38..36c8fc451 100644
--- a/src/transport/gnunet-transport.c
+++ b/src/transport/gnunet-transport.c
@@ -29,12 +29,12 @@
29#include "gnunet_resolver_service.h" 29#include "gnunet_resolver_service.h"
30#include "gnunet_protocols.h" 30#include "gnunet_protocols.h"
31#include "gnunet_transport_service.h" 31#include "gnunet_transport_service.h"
32#include "gnunet_transport_core_service.h"
33 32
34/** 33/**
35 * Timeout for a name resolution 34 * Timeout for a name resolution
36 */ 35 */
37#define RESOLUTION_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) 36#define RESOLUTION_TIMEOUT \
37 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
38 38
39/** 39/**
40 * Timeout for an operation 40 * Timeout for an operation
@@ -332,16 +332,13 @@ static struct PeerResolutionContext *rc_tail;
332 * @return #GNUNET_OK (continue to iterate) 332 * @return #GNUNET_OK (continue to iterate)
333 */ 333 */
334static int 334static int
335destroy_it (void *cls, 335destroy_it (void *cls, const struct GNUNET_PeerIdentity *key, void *value)
336 const struct GNUNET_PeerIdentity *key,
337 void *value)
338{ 336{
339 struct MonitoredPeer *m = value; 337 struct MonitoredPeer *m = value;
340 338
341 GNUNET_assert (GNUNET_OK == 339 GNUNET_assert (
342 GNUNET_CONTAINER_multipeermap_remove (monitored_peers, 340 GNUNET_OK ==
343 key, 341 GNUNET_CONTAINER_multipeermap_remove (monitored_peers, key, value));
344 value));
345 GNUNET_free_non_null (m->address); 342 GNUNET_free_non_null (m->address);
346 GNUNET_free (value); 343 GNUNET_free (value);
347 return GNUNET_OK; 344 return GNUNET_OK;
@@ -384,18 +381,14 @@ shutdown_task (void *cls)
384 next = cur->next; 381 next = cur->next;
385 382
386 GNUNET_TRANSPORT_address_to_string_cancel (cur->asc); 383 GNUNET_TRANSPORT_address_to_string_cancel (cur->asc);
387 GNUNET_CONTAINER_DLL_remove (vc_head, 384 GNUNET_CONTAINER_DLL_remove (vc_head, vc_tail, cur);
388 vc_tail,
389 cur);
390 GNUNET_free (cur->transport); 385 GNUNET_free (cur->transport);
391 GNUNET_HELLO_address_free (cur->addrcp); 386 GNUNET_HELLO_address_free (cur->addrcp);
392 GNUNET_free (cur); 387 GNUNET_free (cur);
393 } 388 }
394 while (NULL != (rc = rc_head)) 389 while (NULL != (rc = rc_head))
395 { 390 {
396 GNUNET_CONTAINER_DLL_remove (rc_head, 391 GNUNET_CONTAINER_DLL_remove (rc_head, rc_tail, rc);
397 rc_tail,
398 rc);
399 GNUNET_TRANSPORT_address_to_string_cancel (rc->asc); 392 GNUNET_TRANSPORT_address_to_string_cancel (rc->asc);
400 GNUNET_free (rc->transport); 393 GNUNET_free (rc->transport);
401 GNUNET_free (rc->addrcp); 394 GNUNET_free (rc->addrcp);
@@ -410,35 +403,30 @@ shutdown_task (void *cls)
410 { 403 {
411 duration = GNUNET_TIME_absolute_get_duration (start_time); 404 duration = GNUNET_TIME_absolute_get_duration (start_time);
412 FPRINTF (stdout, 405 FPRINTF (stdout,
413 _("Transmitted %llu bytes/s (%llu bytes in %s)\n"), 406 _ ("Transmitted %llu bytes/s (%llu bytes in %s)\n"),
414 1000LL * 1000LL * traffic_sent / (1 + duration.rel_value_us), 407 1000LL * 1000LL * traffic_sent / (1 + duration.rel_value_us),
415 traffic_sent, 408 traffic_sent,
416 GNUNET_STRINGS_relative_time_to_string (duration, 409 GNUNET_STRINGS_relative_time_to_string (duration, GNUNET_YES));
417 GNUNET_YES));
418 } 410 }
419 if (benchmark_receive) 411 if (benchmark_receive)
420 { 412 {
421 duration = GNUNET_TIME_absolute_get_duration (start_time); 413 duration = GNUNET_TIME_absolute_get_duration (start_time);
422 FPRINTF (stdout, 414 FPRINTF (stdout,
423 _("Received %llu bytes/s (%llu bytes in %s)\n"), 415 _ ("Received %llu bytes/s (%llu bytes in %s)\n"),
424 1000LL * 1000LL * traffic_received / (1 + duration.rel_value_us), 416 1000LL * 1000LL * traffic_received / (1 + duration.rel_value_us),
425 traffic_received, 417 traffic_received,
426 GNUNET_STRINGS_relative_time_to_string (duration, 418 GNUNET_STRINGS_relative_time_to_string (duration, GNUNET_YES));
427 GNUNET_YES));
428 } 419 }
429 420
430 if (NULL != monitored_peers) 421 if (NULL != monitored_peers)
431 { 422 {
432 GNUNET_CONTAINER_multipeermap_iterate (monitored_peers, 423 GNUNET_CONTAINER_multipeermap_iterate (monitored_peers, &destroy_it, NULL);
433 &destroy_it,
434 NULL);
435 GNUNET_CONTAINER_multipeermap_destroy (monitored_peers); 424 GNUNET_CONTAINER_multipeermap_destroy (monitored_peers);
436 monitored_peers = NULL; 425 monitored_peers = NULL;
437 } 426 }
438 if (NULL != monitored_plugins) 427 if (NULL != monitored_plugins)
439 { 428 {
440 GNUNET_break (0 == 429 GNUNET_break (0 == GNUNET_CONTAINER_multipeermap_size (monitored_plugins));
441 GNUNET_CONTAINER_multipeermap_size (monitored_plugins));
442 GNUNET_CONTAINER_multipeermap_destroy (monitored_plugins); 430 GNUNET_CONTAINER_multipeermap_destroy (monitored_plugins);
443 monitored_plugins = NULL; 431 monitored_plugins = NULL;
444 } 432 }
@@ -463,9 +451,7 @@ operation_timeout (void *cls)
463 op_timeout = NULL; 451 op_timeout = NULL;
464 if ((benchmark_send) || (benchmark_receive)) 452 if ((benchmark_send) || (benchmark_receive))
465 { 453 {
466 FPRINTF (stdout, 454 FPRINTF (stdout, _ ("Failed to connect to `%s'\n"), GNUNET_i2s_full (&pid));
467 _("Failed to connect to `%s'\n"),
468 GNUNET_i2s_full (&pid));
469 GNUNET_SCHEDULER_shutdown (); 455 GNUNET_SCHEDULER_shutdown ();
470 ret = 1; 456 ret = 1;
471 return; 457 return;
@@ -477,21 +463,18 @@ operation_timeout (void *cls)
477 { 463 {
478 next = cur->next; 464 next = cur->next;
479 FPRINTF (stdout, 465 FPRINTF (stdout,
480 _("Failed to resolve address for peer `%s'\n"), 466 _ ("Failed to resolve address for peer `%s'\n"),
481 GNUNET_i2s (&cur->addrcp->peer)); 467 GNUNET_i2s (&cur->addrcp->peer));
482 468
483 GNUNET_CONTAINER_DLL_remove(rc_head, 469 GNUNET_CONTAINER_DLL_remove (rc_head, rc_tail, cur);
484 rc_tail,
485 cur);
486 GNUNET_TRANSPORT_address_to_string_cancel (cur->asc); 470 GNUNET_TRANSPORT_address_to_string_cancel (cur->asc);
487 GNUNET_free (cur->transport); 471 GNUNET_free (cur->transport);
488 GNUNET_free (cur->addrcp); 472 GNUNET_free (cur->addrcp);
489 GNUNET_free (cur); 473 GNUNET_free (cur);
490
491 } 474 }
492 FPRINTF (stdout, 475 FPRINTF (stdout,
493 "%s", 476 "%s",
494 _("Failed to list connections, timeout occurred\n")); 477 _ ("Failed to list connections, timeout occurred\n"));
495 GNUNET_SCHEDULER_shutdown (); 478 GNUNET_SCHEDULER_shutdown ();
496 ret = 1; 479 ret = 1;
497 return; 480 return;
@@ -512,22 +495,15 @@ do_send (void *cls)
512 struct GNUNET_MessageHeader *m; 495 struct GNUNET_MessageHeader *m;
513 struct GNUNET_MQ_Envelope *env; 496 struct GNUNET_MQ_Envelope *env;
514 497
515 env = GNUNET_MQ_msg_extra (m, 498 env = GNUNET_MQ_msg_extra (m, BLOCKSIZE * 1024, GNUNET_MESSAGE_TYPE_DUMMY);
516 BLOCKSIZE * 1024, 499 memset (&m[1], 52, BLOCKSIZE * 1024 - sizeof (struct GNUNET_MessageHeader));
517 GNUNET_MESSAGE_TYPE_DUMMY);
518 memset (&m[1],
519 52,
520 BLOCKSIZE * 1024 - sizeof(struct GNUNET_MessageHeader));
521 traffic_sent += BLOCKSIZE * 1024; 500 traffic_sent += BLOCKSIZE * 1024;
522 GNUNET_MQ_notify_sent (env, 501 GNUNET_MQ_notify_sent (env, &do_send, mq);
523 &do_send,
524 mq);
525 if (verbosity > 0) 502 if (verbosity > 0)
526 FPRINTF (stdout, 503 FPRINTF (stdout,
527 _("Transmitting %u bytes\n"), 504 _ ("Transmitting %u bytes\n"),
528 (unsigned int) BLOCKSIZE * 1024); 505 (unsigned int) BLOCKSIZE * 1024);
529 GNUNET_MQ_send (mq, 506 GNUNET_MQ_send (mq, env);
530 env);
531} 507}
532 508
533 509
@@ -542,11 +518,9 @@ do_send (void *cls)
542static void * 518static void *
543notify_connect (void *cls, 519notify_connect (void *cls,
544 const struct GNUNET_PeerIdentity *peer, 520 const struct GNUNET_PeerIdentity *peer,
545 struct GNUNET_MQ_Handle *mq) 521 struct GNUNET_MQ_Handle *mq)
546{ 522{
547 if (0 != memcmp (&pid, 523 if (0 != memcmp (&pid, peer, sizeof (struct GNUNET_PeerIdentity)))
548 peer,
549 sizeof(struct GNUNET_PeerIdentity)))
550 return NULL; 524 return NULL;
551 ret = 0; 525 ret = 0;
552 if (! benchmark_send) 526 if (! benchmark_send)
@@ -557,10 +531,12 @@ notify_connect (void *cls,
557 op_timeout = NULL; 531 op_timeout = NULL;
558 } 532 }
559 if (verbosity > 0) 533 if (verbosity > 0)
560 FPRINTF (stdout, 534 FPRINTF (
561 _("Successfully connected to `%s', starting to send benchmark data in %u Kb blocks\n"), 535 stdout,
562 GNUNET_i2s (peer), 536 _ (
563 BLOCKSIZE); 537 "Successfully connected to `%s', starting to send benchmark data in %u Kb blocks\n"),
538 GNUNET_i2s (peer),
539 BLOCKSIZE);
564 start_time = GNUNET_TIME_absolute_get (); 540 start_time = GNUNET_TIME_absolute_get ();
565 do_send (mq); 541 do_send (mq);
566 return mq; 542 return mq;
@@ -578,19 +554,17 @@ notify_connect (void *cls,
578static void 554static void
579notify_disconnect (void *cls, 555notify_disconnect (void *cls,
580 const struct GNUNET_PeerIdentity *peer, 556 const struct GNUNET_PeerIdentity *peer,
581 void *internal_cls) 557 void *internal_cls)
582{ 558{
583 if (0 != memcmp (&pid, 559 if (0 != memcmp (&pid, peer, sizeof (struct GNUNET_PeerIdentity)))
584 peer,
585 sizeof(struct GNUNET_PeerIdentity)))
586 return; 560 return;
587 if (NULL == internal_cls) 561 if (NULL == internal_cls)
588 return; /* not about target peer */ 562 return; /* not about target peer */
589 if (! benchmark_send) 563 if (! benchmark_send)
590 return; /* not transmitting */ 564 return; /* not transmitting */
591 FPRINTF (stdout, 565 FPRINTF (stdout,
592 _("Disconnected from peer `%s' while benchmarking\n"), 566 _ ("Disconnected from peer `%s' while benchmarking\n"),
593 GNUNET_i2s (&pid)); 567 GNUNET_i2s (&pid));
594} 568}
595 569
596 570
@@ -606,16 +580,16 @@ notify_disconnect (void *cls,
606static void * 580static void *
607monitor_notify_connect (void *cls, 581monitor_notify_connect (void *cls,
608 const struct GNUNET_PeerIdentity *peer, 582 const struct GNUNET_PeerIdentity *peer,
609 struct GNUNET_MQ_Handle *mq) 583 struct GNUNET_MQ_Handle *mq)
610{ 584{
611 struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); 585 struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
612 const char *now_str = GNUNET_STRINGS_absolute_time_to_string (now); 586 const char *now_str = GNUNET_STRINGS_absolute_time_to_string (now);
613 587
614 monitor_connect_counter++; 588 monitor_connect_counter++;
615 FPRINTF (stdout, 589 FPRINTF (stdout,
616 _("%24s: %-17s %4s (%u connections in total)\n"), 590 _ ("%24s: %-17s %4s (%u connections in total)\n"),
617 now_str, 591 now_str,
618 _("Connected to"), 592 _ ("Connected to"),
619 GNUNET_i2s (peer), 593 GNUNET_i2s (peer),
620 monitor_connect_counter); 594 monitor_connect_counter);
621 return NULL; 595 return NULL;
@@ -633,18 +607,18 @@ monitor_notify_connect (void *cls,
633static void 607static void
634monitor_notify_disconnect (void *cls, 608monitor_notify_disconnect (void *cls,
635 const struct GNUNET_PeerIdentity *peer, 609 const struct GNUNET_PeerIdentity *peer,
636 void *internal_cls) 610 void *internal_cls)
637{ 611{
638 struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); 612 struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
639 const char *now_str = GNUNET_STRINGS_absolute_time_to_string (now); 613 const char *now_str = GNUNET_STRINGS_absolute_time_to_string (now);
640 614
641 GNUNET_assert(monitor_connect_counter > 0); 615 GNUNET_assert (monitor_connect_counter > 0);
642 monitor_connect_counter--; 616 monitor_connect_counter--;
643 617
644 FPRINTF (stdout, 618 FPRINTF (stdout,
645 _("%24s: %-17s %4s (%u connections in total)\n"), 619 _ ("%24s: %-17s %4s (%u connections in total)\n"),
646 now_str, 620 now_str,
647 _("Disconnected from"), 621 _ ("Disconnected from"),
648 GNUNET_i2s (peer), 622 GNUNET_i2s (peer),
649 monitor_connect_counter); 623 monitor_connect_counter);
650} 624}
@@ -658,8 +632,7 @@ monitor_notify_disconnect (void *cls,
658 * @return #GNUNET_OK 632 * @return #GNUNET_OK
659 */ 633 */
660static int 634static int
661check_dummy (void *cls, 635check_dummy (void *cls, const struct GNUNET_MessageHeader *message)
662 const struct GNUNET_MessageHeader *message)
663{ 636{
664 return GNUNET_OK; /* all messages are fine */ 637 return GNUNET_OK; /* all messages are fine */
665} 638}
@@ -672,15 +645,14 @@ check_dummy (void *cls,
672 * @param message the message 645 * @param message the message
673 */ 646 */
674static void 647static void
675handle_dummy (void *cls, 648handle_dummy (void *cls, const struct GNUNET_MessageHeader *message)
676 const struct GNUNET_MessageHeader *message)
677{ 649{
678 if (! benchmark_receive) 650 if (! benchmark_receive)
679 return; 651 return;
680 if (verbosity > 0) 652 if (verbosity > 0)
681 FPRINTF (stdout, 653 FPRINTF (stdout,
682 _("Received %u bytes\n"), 654 _ ("Received %u bytes\n"),
683 (unsigned int) ntohs (message->size)); 655 (unsigned int) ntohs (message->size));
684 if (0 == traffic_received) 656 if (0 == traffic_received)
685 start_time = GNUNET_TIME_absolute_get (); 657 start_time = GNUNET_TIME_absolute_get ();
686 traffic_received += ntohs (message->size); 658 traffic_received += ntohs (message->size);
@@ -711,24 +683,23 @@ print_info (const struct GNUNET_PeerIdentity *id,
711 struct GNUNET_TIME_Absolute state_timeout) 683 struct GNUNET_TIME_Absolute state_timeout)
712{ 684{
713 685
714 if ( ((GNUNET_YES == iterate_connections) && 686 if (((GNUNET_YES == iterate_connections) && (GNUNET_YES == iterate_all)) ||
715 (GNUNET_YES == iterate_all)) || 687 (GNUNET_YES == monitor_connections))
716 (GNUNET_YES == monitor_connections))
717 { 688 {
718 FPRINTF (stdout, 689 FPRINTF (stdout,
719 _("Peer `%s': %s %s in state `%s' until %s\n"), 690 _ ("Peer `%s': %s %s in state `%s' until %s\n"),
720 GNUNET_i2s (id), 691 GNUNET_i2s (id),
721 (NULL == transport) ? "<none>" : transport, 692 (NULL == transport) ? "<none>" : transport,
722 (NULL == transport) ? "<none>" : addr, 693 (NULL == transport) ? "<none>" : addr,
723 GNUNET_TRANSPORT_ps2s (state), 694 GNUNET_TRANSPORT_ps2s (state),
724 GNUNET_STRINGS_absolute_time_to_string (state_timeout)); 695 GNUNET_STRINGS_absolute_time_to_string (state_timeout));
725 } 696 }
726 else if ( (GNUNET_YES == iterate_connections) && 697 else if ((GNUNET_YES == iterate_connections) &&
727 (GNUNET_TRANSPORT_is_connected(state)) ) 698 (GNUNET_TRANSPORT_is_connected (state)))
728 { 699 {
729 /* Only connected peers, skip state */ 700 /* Only connected peers, skip state */
730 FPRINTF (stdout, 701 FPRINTF (stdout,
731 _("Peer `%s': %s %s\n"), 702 _ ("Peer `%s': %s %s\n"),
732 GNUNET_i2s (id), 703 GNUNET_i2s (id),
733 transport, 704 transport,
734 addr); 705 addr);
@@ -753,9 +724,7 @@ print_info (const struct GNUNET_PeerIdentity *id,
753 * if #GNUNET_SYSERR: communication error (IPC error) 724 * if #GNUNET_SYSERR: communication error (IPC error)
754 */ 725 */
755static void 726static void
756process_peer_string (void *cls, 727process_peer_string (void *cls, const char *address, int res)
757 const char *address,
758 int res)
759{ 728{
760 struct PeerResolutionContext *rc = cls; 729 struct PeerResolutionContext *rc = cls;
761 730
@@ -763,11 +732,12 @@ process_peer_string (void *cls,
763 { 732 {
764 if (GNUNET_SYSERR == res) 733 if (GNUNET_SYSERR == res)
765 { 734 {
766 FPRINTF (stderr, 735 FPRINTF (
767 "Failed to convert address for peer `%s' plugin `%s' length %u to string \n", 736 stderr,
768 GNUNET_i2s (&rc->addrcp->peer), 737 "Failed to convert address for peer `%s' plugin `%s' length %u to string \n",
769 rc->addrcp->transport_name, 738 GNUNET_i2s (&rc->addrcp->peer),
770 (unsigned int) rc->addrcp->address_length); 739 rc->addrcp->transport_name,
740 (unsigned int) rc->addrcp->address_length);
771 print_info (&rc->addrcp->peer, 741 print_info (&rc->addrcp->peer,
772 rc->transport, 742 rc->transport,
773 NULL, 743 NULL,
@@ -818,9 +788,7 @@ process_peer_string (void *cls,
818 } 788 }
819 GNUNET_free (rc->transport); 789 GNUNET_free (rc->transport);
820 GNUNET_free (rc->addrcp); 790 GNUNET_free (rc->addrcp);
821 GNUNET_CONTAINER_DLL_remove (rc_head, 791 GNUNET_CONTAINER_DLL_remove (rc_head, rc_tail, rc);
822 rc_tail,
823 rc);
824 GNUNET_free (rc); 792 GNUNET_free (rc);
825 if ((0 == address_resolutions) && (iterate_connections)) 793 if ((0 == address_resolutions) && (iterate_connections))
826 { 794 {
@@ -854,9 +822,7 @@ resolve_peer_address (const struct GNUNET_HELLO_Address *address,
854 struct PeerResolutionContext *rc; 822 struct PeerResolutionContext *rc;
855 823
856 rc = GNUNET_new (struct PeerResolutionContext); 824 rc = GNUNET_new (struct PeerResolutionContext);
857 GNUNET_CONTAINER_DLL_insert (rc_head, 825 GNUNET_CONTAINER_DLL_insert (rc_head, rc_tail, rc);
858 rc_tail,
859 rc);
860 address_resolutions++; 826 address_resolutions++;
861 rc->transport = GNUNET_strdup (address->transport_name); 827 rc->transport = GNUNET_strdup (address->transport_name);
862 rc->addrcp = GNUNET_HELLO_address_copy (address); 828 rc->addrcp = GNUNET_HELLO_address_copy (address);
@@ -869,7 +835,7 @@ resolve_peer_address (const struct GNUNET_HELLO_Address *address,
869 numeric, 835 numeric,
870 RESOLUTION_TIMEOUT, 836 RESOLUTION_TIMEOUT,
871 &process_peer_string, 837 &process_peer_string,
872 rc); 838 rc);
873} 839}
874 840
875 841
@@ -897,15 +863,14 @@ process_peer_iteration_cb (void *cls,
897 return; 863 return;
898 } 864 }
899 865
900 if ( (GNUNET_NO == iterate_all) && 866 if ((GNUNET_NO == iterate_all) &&
901 (GNUNET_NO == GNUNET_TRANSPORT_is_connected(state))) 867 (GNUNET_NO == GNUNET_TRANSPORT_is_connected (state)))
902 return; /* Display only connected peers */ 868 return; /* Display only connected peers */
903 869
904 if (NULL != op_timeout) 870 if (NULL != op_timeout)
905 GNUNET_SCHEDULER_cancel (op_timeout); 871 GNUNET_SCHEDULER_cancel (op_timeout);
906 op_timeout = GNUNET_SCHEDULER_add_delayed (OP_TIMEOUT, 872 op_timeout =
907 &operation_timeout, 873 GNUNET_SCHEDULER_add_delayed (OP_TIMEOUT, &operation_timeout, NULL);
908 NULL);
909 874
910 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 875 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
911 "Received address for peer `%s': %s\n", 876 "Received address for peer `%s': %s\n",
@@ -913,16 +878,9 @@ process_peer_iteration_cb (void *cls,
913 address ? address->transport_name : ""); 878 address ? address->transport_name : "");
914 879
915 if (NULL != address) 880 if (NULL != address)
916 resolve_peer_address (address, 881 resolve_peer_address (address, numeric, state, state_timeout);
917 numeric,
918 state,
919 state_timeout);
920 else 882 else
921 print_info (peer, 883 print_info (peer, NULL, NULL, state, state_timeout);
922 NULL,
923 NULL,
924 state,
925 state_timeout);
926} 884}
927 885
928 886
@@ -958,7 +916,7 @@ struct PluginMonitorAddress
958 */ 916 */
959static void 917static void
960print_plugin_event_info (struct PluginMonitorAddress *addr, 918print_plugin_event_info (struct PluginMonitorAddress *addr,
961 const struct GNUNET_TRANSPORT_SessionInfo *info) 919 const struct GNUNET_TRANSPORT_SessionInfo *info)
962{ 920{
963 const char *state; 921 const char *state;
964 922
@@ -987,20 +945,22 @@ print_plugin_event_info (struct PluginMonitorAddress *addr,
987 "%s: state %s timeout in %s @ %s%s\n", 945 "%s: state %s timeout in %s @ %s%s\n",
988 GNUNET_i2s (&info->address->peer), 946 GNUNET_i2s (&info->address->peer),
989 state, 947 state,
990 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (info->session_timeout), 948 GNUNET_STRINGS_relative_time_to_string (
991 GNUNET_YES), 949 GNUNET_TIME_absolute_get_remaining (info->session_timeout),
992 addr->str, 950 GNUNET_YES),
951 addr->str,
993 (info->is_inbound == GNUNET_YES) ? " (INBOUND)" : ""); 952 (info->is_inbound == GNUNET_YES) ? " (INBOUND)" : "");
994 fprintf (stdout, 953 fprintf (stdout,
995 "%s: queue has %3u messages and %6u bytes\n", 954 "%s: queue has %3u messages and %6u bytes\n",
996 GNUNET_i2s (&info->address->peer), 955 GNUNET_i2s (&info->address->peer),
997 info->num_msg_pending, 956 info->num_msg_pending,
998 info->num_bytes_pending); 957 info->num_bytes_pending);
999 if (0 != GNUNET_TIME_absolute_get_remaining (info->receive_delay).rel_value_us) 958 if (0 !=
959 GNUNET_TIME_absolute_get_remaining (info->receive_delay).rel_value_us)
1000 fprintf (stdout, 960 fprintf (stdout,
1001 "%s: receiving blocked until %s\n", 961 "%s: receiving blocked until %s\n",
1002 GNUNET_i2s (&info->address->peer), 962 GNUNET_i2s (&info->address->peer),
1003 GNUNET_STRINGS_absolute_time_to_string (info->receive_delay)); 963 GNUNET_STRINGS_absolute_time_to_string (info->receive_delay));
1004} 964}
1005 965
1006 966
@@ -1021,9 +981,7 @@ print_plugin_event_info (struct PluginMonitorAddress *addr,
1021 * if #GNUNET_SYSERR: communication error (IPC error) 981 * if #GNUNET_SYSERR: communication error (IPC error)
1022 */ 982 */
1023static void 983static void
1024address_cb (void *cls, 984address_cb (void *cls, const char *address, int res)
1025 const char *address,
1026 int res)
1027{ 985{
1028 struct PluginMonitorAddress *addr = cls; 986 struct PluginMonitorAddress *addr = cls;
1029 987
@@ -1035,8 +993,7 @@ address_cb (void *cls,
1035 if (NULL != addr->str) 993 if (NULL != addr->str)
1036 return; 994 return;
1037 addr->str = GNUNET_strdup (address); 995 addr->str = GNUNET_strdup (address);
1038 print_plugin_event_info (addr, 996 print_plugin_event_info (addr, &addr->si);
1039 &addr->si);
1040} 997}
1041 998
1042 999
@@ -1065,8 +1022,7 @@ plugin_monitoring_cb (void *cls,
1065{ 1022{
1066 struct PluginMonitorAddress *addr; 1023 struct PluginMonitorAddress *addr;
1067 1024
1068 if ( (NULL == info) && 1025 if ((NULL == info) && (NULL == session))
1069 (NULL == session) )
1070 return; /* in sync with transport service */ 1026 return; /* in sync with transport service */
1071 addr = *session_ctx; 1027 addr = *session_ctx;
1072 if (NULL == info) 1028 if (NULL == info)
@@ -1084,26 +1040,25 @@ plugin_monitoring_cb (void *cls,
1084 } 1040 }
1085 return; /* shutdown */ 1041 return; /* shutdown */
1086 } 1042 }
1087 if (0 != memcmp (&info->address->peer, 1043 if (0 !=
1088 &pid, 1044 memcmp (&info->address->peer, &pid, sizeof (struct GNUNET_PeerIdentity)))
1089 sizeof (struct GNUNET_PeerIdentity)))
1090 return; /* filtered */ 1045 return; /* filtered */
1091 if (NULL == addr) 1046 if (NULL == addr)
1092 { 1047 {
1093 addr = GNUNET_new (struct PluginMonitorAddress); 1048 addr = GNUNET_new (struct PluginMonitorAddress);
1094 addr->asc = GNUNET_TRANSPORT_address_to_string (cfg, 1049 addr->asc =
1095 info->address, 1050 GNUNET_TRANSPORT_address_to_string (cfg,
1096 numeric, 1051 info->address,
1097 GNUNET_TIME_UNIT_FOREVER_REL, 1052 numeric,
1098 &address_cb, 1053 GNUNET_TIME_UNIT_FOREVER_REL,
1099 addr); 1054 &address_cb,
1055 addr);
1100 *session_ctx = addr; 1056 *session_ctx = addr;
1101 } 1057 }
1102 if (NULL == addr->str) 1058 if (NULL == addr->str)
1103 addr->si = *info; 1059 addr->si = *info;
1104 else 1060 else
1105 print_plugin_event_info (addr, 1061 print_plugin_event_info (addr, info);
1106 info);
1107 if (GNUNET_TRANSPORT_SS_DONE == info->state) 1062 if (GNUNET_TRANSPORT_SS_DONE == info->state)
1108 { 1063 {
1109 if (NULL != addr->asc) 1064 if (NULL != addr->asc)
@@ -1141,38 +1096,35 @@ process_peer_monitoring_cb (void *cls,
1141 { 1096 {
1142 FPRINTF (stdout, 1097 FPRINTF (stdout,
1143 "%s", 1098 "%s",
1144 _("Monitor disconnected from transport service. Reconnecting.\n")); 1099 _ (
1100 "Monitor disconnected from transport service. Reconnecting.\n"));
1145 return; 1101 return;
1146 } 1102 }
1147 1103
1148 if (NULL != op_timeout) 1104 if (NULL != op_timeout)
1149 GNUNET_SCHEDULER_cancel (op_timeout); 1105 GNUNET_SCHEDULER_cancel (op_timeout);
1150 op_timeout = GNUNET_SCHEDULER_add_delayed (OP_TIMEOUT, 1106 op_timeout =
1151 &operation_timeout, 1107 GNUNET_SCHEDULER_add_delayed (OP_TIMEOUT, &operation_timeout, NULL);
1152 NULL);
1153 1108
1154 if (NULL == (m = GNUNET_CONTAINER_multipeermap_get (monitored_peers, 1109 if (NULL == (m = GNUNET_CONTAINER_multipeermap_get (monitored_peers, peer)))
1155 peer)))
1156 { 1110 {
1157 m = GNUNET_new (struct MonitoredPeer); 1111 m = GNUNET_new (struct MonitoredPeer);
1158 GNUNET_CONTAINER_multipeermap_put (monitored_peers, 1112 GNUNET_CONTAINER_multipeermap_put (
1159 peer, 1113 monitored_peers,
1160 m, 1114 peer,
1161 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); 1115 m,
1116 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
1162 } 1117 }
1163 else 1118 else
1164 { 1119 {
1165 if ( (m->state == state) && 1120 if ((m->state == state) &&
1166 (m->state_timeout.abs_value_us == state_timeout.abs_value_us) && 1121 (m->state_timeout.abs_value_us == state_timeout.abs_value_us) &&
1167 (NULL == address) && 1122 (NULL == address) && (NULL == m->address))
1168 (NULL == m->address) )
1169 { 1123 {
1170 return; /* No real change */ 1124 return; /* No real change */
1171 } 1125 }
1172 if ( (m->state == state) && 1126 if ((m->state == state) && (NULL != address) && (NULL != m->address) &&
1173 (NULL != address) && 1127 (0 == GNUNET_HELLO_address_cmp (m->address, address)))
1174 (NULL != m->address) &&
1175 (0 == GNUNET_HELLO_address_cmp(m->address, address)) )
1176 return; /* No real change */ 1128 return; /* No real change */
1177 } 1129 }
1178 1130
@@ -1187,16 +1139,9 @@ process_peer_monitoring_cb (void *cls,
1187 m->state_timeout = state_timeout; 1139 m->state_timeout = state_timeout;
1188 1140
1189 if (NULL != address) 1141 if (NULL != address)
1190 resolve_peer_address (m->address, 1142 resolve_peer_address (m->address, numeric, m->state, m->state_timeout);
1191 numeric,
1192 m->state,
1193 m->state_timeout);
1194 else 1143 else
1195 print_info (peer, 1144 print_info (peer, NULL, NULL, m->state, m->state_timeout);
1196 NULL,
1197 NULL,
1198 m->state,
1199 m->state_timeout);
1200} 1145}
1201 1146
1202 1147
@@ -1210,12 +1155,9 @@ process_peer_monitoring_cb (void *cls,
1210 * @return #GNUNET_OK if the connection is allowed, #GNUNET_SYSERR if not 1155 * @return #GNUNET_OK if the connection is allowed, #GNUNET_SYSERR if not
1211 */ 1156 */
1212static int 1157static int
1213blacklist_cb (void *cls, 1158blacklist_cb (void *cls, const struct GNUNET_PeerIdentity *cpid)
1214 const struct GNUNET_PeerIdentity *cpid)
1215{ 1159{
1216 if (0 == memcmp (cpid, 1160 if (0 == memcmp (cpid, &pid, sizeof (struct GNUNET_PeerIdentity)))
1217 &pid,
1218 sizeof (struct GNUNET_PeerIdentity)))
1219 return GNUNET_SYSERR; 1161 return GNUNET_SYSERR;
1220 return GNUNET_OK; 1162 return GNUNET_OK;
1221} 1163}
@@ -1231,7 +1173,7 @@ blacklist_cb (void *cls,
1231 */ 1173 */
1232static void 1174static void
1233run (void *cls, 1175run (void *cls,
1234 char * const *args, 1176 char *const *args,
1235 const char *cfgfile, 1177 const char *cfgfile,
1236 const struct GNUNET_CONFIGURATION_Handle *mycfg) 1178 const struct GNUNET_CONFIGURATION_Handle *mycfg)
1237{ 1179{
@@ -1241,127 +1183,119 @@ run (void *cls,
1241 1183
1242 cfg = (struct GNUNET_CONFIGURATION_Handle *) mycfg; 1184 cfg = (struct GNUNET_CONFIGURATION_Handle *) mycfg;
1243 1185
1244 counter = benchmark_send + benchmark_receive + iterate_connections 1186 counter = benchmark_send + benchmark_receive + iterate_connections +
1245 + monitor_connections + monitor_connects + do_disconnect + 1187 monitor_connections + monitor_connects + do_disconnect +
1246 monitor_plugins; 1188 monitor_plugins;
1247 1189
1248 if (1 < counter) 1190 if (1 < counter)
1249 { 1191 {
1250 FPRINTF (stderr, 1192 FPRINTF (
1251 _("Multiple operations given. Please choose only one operation: %s, %s, %s, %s, %s, %s %s\n"), 1193 stderr,
1252 "disconnect", 1194 _ (
1253 "benchmark send", 1195 "Multiple operations given. Please choose only one operation: %s, %s, %s, %s, %s, %s %s\n"),
1254 "benchmark receive", 1196 "disconnect",
1255 "information", 1197 "benchmark send",
1256 "monitor", 1198 "benchmark receive",
1257 "events", 1199 "information",
1258 "plugins"); 1200 "monitor",
1201 "events",
1202 "plugins");
1259 return; 1203 return;
1260 } 1204 }
1261 if (0 == counter) 1205 if (0 == counter)
1262 { 1206 {
1263 FPRINTF (stderr, 1207 FPRINTF (
1264 _("No operation given. Please choose one operation: %s, %s, %s, %s, %s, %s, %s\n"), 1208 stderr,
1265 "disconnect", 1209 _ (
1266 "benchmark send", 1210 "No operation given. Please choose one operation: %s, %s, %s, %s, %s, %s, %s\n"),
1267 "benchmark receive", 1211 "disconnect",
1268 "information", 1212 "benchmark send",
1269 "monitor", 1213 "benchmark receive",
1270 "events", 1214 "information",
1271 "plugins"); 1215 "monitor",
1216 "events",
1217 "plugins");
1272 return; 1218 return;
1273 } 1219 }
1274 1220
1275 if (do_disconnect) /* -D: Disconnect from peer */ 1221 if (do_disconnect) /* -D: Disconnect from peer */
1276 { 1222 {
1277 if (0 == memcmp (&zero_pid, 1223 if (0 == memcmp (&zero_pid, &pid, sizeof (pid)))
1278 &pid,
1279 sizeof (pid)))
1280 { 1224 {
1281 FPRINTF (stderr, 1225 FPRINTF (stderr,
1282 _("Option `%s' makes no sense without option `%s'.\n"), 1226 _ ("Option `%s' makes no sense without option `%s'.\n"),
1283 "-D", "-p"); 1227 "-D",
1228 "-p");
1284 ret = 1; 1229 ret = 1;
1285 return; 1230 return;
1286 } 1231 }
1287 blacklist = GNUNET_TRANSPORT_blacklist (cfg, 1232 blacklist = GNUNET_TRANSPORT_blacklist (cfg, &blacklist_cb, NULL);
1288 &blacklist_cb,
1289 NULL);
1290 if (NULL == blacklist) 1233 if (NULL == blacklist)
1291 { 1234 {
1292 FPRINTF (stderr, 1235 FPRINTF (stderr,
1293 "%s", 1236 "%s",
1294 _("Failed to connect to transport service for disconnection\n")); 1237 _ (
1238 "Failed to connect to transport service for disconnection\n"));
1295 ret = 1; 1239 ret = 1;
1296 return; 1240 return;
1297 } 1241 }
1298 FPRINTF (stdout, 1242 FPRINTF (stdout,
1299 "%s", 1243 "%s",
1300 _("Blacklisting request in place, stop with CTRL-C\n")); 1244 _ ("Blacklisting request in place, stop with CTRL-C\n"));
1301 } 1245 }
1302 else if (benchmark_send) /* -s: Benchmark sending */ 1246 else if (benchmark_send) /* -s: Benchmark sending */
1303 { 1247 {
1304 if (0 == memcmp (&zero_pid, 1248 if (0 == memcmp (&zero_pid, &pid, sizeof (pid)))
1305 &pid,
1306 sizeof (pid)))
1307 { 1249 {
1308 FPRINTF (stderr, 1250 FPRINTF (stderr,
1309 _("Option `%s' makes no sense without option `%s'.\n"), 1251 _ ("Option `%s' makes no sense without option `%s'.\n"),
1310 "-s", "-p"); 1252 "-s",
1253 "-p");
1311 ret = 1; 1254 ret = 1;
1312 return; 1255 return;
1313 } 1256 }
1314 handle = GNUNET_TRANSPORT_core_connect (cfg, 1257 handle = GNUNET_TRANSPORT_core_connect (cfg,
1315 NULL, 1258 NULL,
1316 NULL, 1259 NULL,
1317 NULL, 1260 NULL,
1318 &notify_connect, 1261 &notify_connect,
1319 &notify_disconnect, 1262 &notify_disconnect,
1320 NULL); 1263 NULL);
1321 if (NULL == handle) 1264 if (NULL == handle)
1322 { 1265 {
1323 FPRINTF (stderr, 1266 FPRINTF (stderr, "%s", _ ("Failed to connect to transport service\n"));
1324 "%s",
1325 _("Failed to connect to transport service\n"));
1326 ret = 1; 1267 ret = 1;
1327 return; 1268 return;
1328 } 1269 }
1329 start_time = GNUNET_TIME_absolute_get (); 1270 start_time = GNUNET_TIME_absolute_get ();
1330 op_timeout = GNUNET_SCHEDULER_add_delayed (OP_TIMEOUT, 1271 op_timeout =
1331 &operation_timeout, 1272 GNUNET_SCHEDULER_add_delayed (OP_TIMEOUT, &operation_timeout, NULL);
1332 NULL);
1333 } 1273 }
1334 else if (benchmark_receive) /* -b: Benchmark receiving */ 1274 else if (benchmark_receive) /* -b: Benchmark receiving */
1335 { 1275 {
1336 struct GNUNET_MQ_MessageHandler handlers[] = { 1276 struct GNUNET_MQ_MessageHandler handlers[] =
1337 GNUNET_MQ_hd_var_size (dummy, 1277 {GNUNET_MQ_hd_var_size (dummy,
1338 GNUNET_MESSAGE_TYPE_DUMMY, 1278 GNUNET_MESSAGE_TYPE_DUMMY,
1339 struct GNUNET_MessageHeader, 1279 struct GNUNET_MessageHeader,
1340 NULL), 1280 NULL),
1341 GNUNET_MQ_handler_end () 1281 GNUNET_MQ_handler_end ()};
1342 };
1343 1282
1344 handle = GNUNET_TRANSPORT_core_connect (cfg, 1283 handle = GNUNET_TRANSPORT_core_connect (cfg,
1345 NULL, 1284 NULL,
1346 handlers, 1285 handlers,
1347 NULL, 1286 NULL,
1348 NULL, 1287 NULL,
1349 NULL, 1288 NULL,
1350 NULL); 1289 NULL);
1351 if (NULL == handle) 1290 if (NULL == handle)
1352 { 1291 {
1353 FPRINTF (stderr, 1292 FPRINTF (stderr, "%s", _ ("Failed to connect to transport service\n"));
1354 "%s",
1355 _("Failed to connect to transport service\n"));
1356 ret = 1; 1293 ret = 1;
1357 return; 1294 return;
1358 } 1295 }
1359 if (verbosity > 0) 1296 if (verbosity > 0)
1360 FPRINTF (stdout, 1297 FPRINTF (stdout, "%s", _ ("Starting to receive benchmark data\n"));
1361 "%s",
1362 _("Starting to receive benchmark data\n"));
1363 start_time = GNUNET_TIME_absolute_get (); 1298 start_time = GNUNET_TIME_absolute_get ();
1364
1365 } 1299 }
1366 else if (iterate_connections) /* -i: List information about peers once */ 1300 else if (iterate_connections) /* -i: List information about peers once */
1367 { 1301 {
@@ -1370,42 +1304,38 @@ run (void *cls,
1370 GNUNET_YES, 1304 GNUNET_YES,
1371 &process_peer_iteration_cb, 1305 &process_peer_iteration_cb,
1372 (void *) cfg); 1306 (void *) cfg);
1373 op_timeout = GNUNET_SCHEDULER_add_delayed (OP_TIMEOUT, 1307 op_timeout =
1374 &operation_timeout, 1308 GNUNET_SCHEDULER_add_delayed (OP_TIMEOUT, &operation_timeout, NULL);
1375 NULL);
1376 } 1309 }
1377 else if (monitor_connections) /* -m: List information about peers continuously */ 1310 else if (monitor_connections) /* -m: List information about peers continuously
1311 */
1378 { 1312 {
1379 monitored_peers = GNUNET_CONTAINER_multipeermap_create (10, 1313 monitored_peers = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO);
1380 GNUNET_NO);
1381 pic = GNUNET_TRANSPORT_monitor_peers (cfg, 1314 pic = GNUNET_TRANSPORT_monitor_peers (cfg,
1382 &pid, 1315 &pid,
1383 GNUNET_NO, 1316 GNUNET_NO,
1384 &process_peer_monitoring_cb, 1317 &process_peer_monitoring_cb,
1385 NULL); 1318 NULL);
1386 } 1319 }
1387 else if (monitor_plugins) /* -P: List information about plugins continuously */ 1320 else if (monitor_plugins) /* -P: List information about plugins continuously
1321 */
1388 { 1322 {
1389 monitored_plugins = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO); 1323 monitored_plugins = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO);
1390 pm = GNUNET_TRANSPORT_monitor_plugins (cfg, 1324 pm = GNUNET_TRANSPORT_monitor_plugins (cfg, &plugin_monitoring_cb, NULL);
1391 &plugin_monitoring_cb,
1392 NULL);
1393 } 1325 }
1394 else if (monitor_connects) /* -e : Monitor (dis)connect events continuously */ 1326 else if (monitor_connects) /* -e : Monitor (dis)connect events continuously */
1395 { 1327 {
1396 monitor_connect_counter = 0; 1328 monitor_connect_counter = 0;
1397 handle = GNUNET_TRANSPORT_core_connect (cfg, 1329 handle = GNUNET_TRANSPORT_core_connect (cfg,
1398 NULL, 1330 NULL,
1399 NULL, 1331 NULL,
1400 NULL, 1332 NULL,
1401 &monitor_notify_connect, 1333 &monitor_notify_connect,
1402 &monitor_notify_disconnect, 1334 &monitor_notify_disconnect,
1403 NULL); 1335 NULL);
1404 if (NULL == handle) 1336 if (NULL == handle)
1405 { 1337 {
1406 FPRINTF (stderr, 1338 FPRINTF (stderr, "%s", _ ("Failed to connect to transport service\n"));
1407 "%s",
1408 _("Failed to connect to transport service\n"));
1409 ret = 1; 1339 ret = 1;
1410 return; 1340 return;
1411 } 1341 }
@@ -1413,75 +1343,86 @@ run (void *cls,
1413 } 1343 }
1414 else 1344 else
1415 { 1345 {
1416 GNUNET_break(0); 1346 GNUNET_break (0);
1417 return; 1347 return;
1418 } 1348 }
1419 1349
1420 GNUNET_SCHEDULER_add_shutdown (&shutdown_task, 1350 GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL);
1421 NULL);
1422} 1351}
1423 1352
1424 1353
1425int 1354int
1426main (int argc, 1355main (int argc, char *const *argv)
1427 char * const *argv)
1428{ 1356{
1429 int res; 1357 int res;
1430 struct GNUNET_GETOPT_CommandLineOption options[] = { 1358 struct GNUNET_GETOPT_CommandLineOption options[] =
1431 GNUNET_GETOPT_option_flag ('a', 1359 {GNUNET_GETOPT_option_flag (
1432 "all", 1360 'a',
1433 gettext_noop ("print information for all peers (instead of only connected peers)"), 1361 "all",
1434 &iterate_all), 1362 gettext_noop (
1435 GNUNET_GETOPT_option_flag ('b', 1363 "print information for all peers (instead of only connected peers)"),
1436 "benchmark", 1364 &iterate_all),
1437 gettext_noop ("measure how fast we are receiving data from all peers (until CTRL-C)"), 1365 GNUNET_GETOPT_option_flag (
1438 &benchmark_receive), 1366 'b',
1439 GNUNET_GETOPT_option_flag ('D', 1367 "benchmark",
1440 "disconnect", 1368 gettext_noop (
1441 gettext_noop ("disconnect from a peer"), 1369 "measure how fast we are receiving data from all peers (until CTRL-C)"),
1442 &do_disconnect), 1370 &benchmark_receive),
1443 GNUNET_GETOPT_option_flag ('i', 1371 GNUNET_GETOPT_option_flag ('D',
1444 "information", 1372 "disconnect",
1445 gettext_noop ("provide information about all current connections (once)"), 1373 gettext_noop ("disconnect from a peer"),
1446 &iterate_connections), 1374 &do_disconnect),
1447 GNUNET_GETOPT_option_flag ('m', 1375 GNUNET_GETOPT_option_flag (
1448 "monitor", 1376 'i',
1449 gettext_noop ("provide information about all current connections (continuously)"), 1377 "information",
1450 &monitor_connections), 1378 gettext_noop (
1451 GNUNET_GETOPT_option_flag ('e', 1379 "provide information about all current connections (once)"),
1452 "events", 1380 &iterate_connections),
1453 gettext_noop ("provide information about all connects and disconnect events (continuously)"), 1381 GNUNET_GETOPT_option_flag (
1454 &monitor_connects), 1382 'm',
1455 GNUNET_GETOPT_option_flag ('n', 1383 "monitor",
1456 "numeric", 1384 gettext_noop (
1457 gettext_noop ("do not resolve hostnames"), 1385 "provide information about all current connections (continuously)"),
1458 &numeric), 1386 &monitor_connections),
1459 GNUNET_GETOPT_option_base32_auto ('p', 1387 GNUNET_GETOPT_option_flag (
1460 "peer", 1388 'e',
1461 "PEER", 1389 "events",
1462 gettext_noop ("peer identity"), 1390 gettext_noop (
1463 &pid), 1391 "provide information about all connects and disconnect events (continuously)"),
1464 GNUNET_GETOPT_option_flag ('P', 1392 &monitor_connects),
1465 "plugins", 1393 GNUNET_GETOPT_option_flag ('n',
1466 gettext_noop ("monitor plugin sessions"), 1394 "numeric",
1467 &monitor_plugins), 1395 gettext_noop ("do not resolve hostnames"),
1468 GNUNET_GETOPT_option_flag ('s', 1396 &numeric),
1469 "send", 1397 GNUNET_GETOPT_option_base32_auto ('p',
1470 gettext_noop 1398 "peer",
1471 ("send data for benchmarking to the other peer (until CTRL-C)"), 1399 "PEER",
1472 &benchmark_send), 1400 gettext_noop ("peer identity"),
1473 GNUNET_GETOPT_option_verbose (&verbosity), 1401 &pid),
1474 GNUNET_GETOPT_OPTION_END 1402 GNUNET_GETOPT_option_flag ('P',
1475 }; 1403 "plugins",
1404 gettext_noop ("monitor plugin sessions"),
1405 &monitor_plugins),
1406 GNUNET_GETOPT_option_flag (
1407 's',
1408 "send",
1409 gettext_noop (
1410 "send data for benchmarking to the other peer (until CTRL-C)"),
1411 &benchmark_send),
1412 GNUNET_GETOPT_option_verbose (&verbosity),
1413 GNUNET_GETOPT_OPTION_END};
1476 1414
1477 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) 1415 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
1478 return 2; 1416 return 2;
1479 1417
1480 res = GNUNET_PROGRAM_run (argc, argv, 1418 res =
1481 "gnunet-transport", 1419 GNUNET_PROGRAM_run (argc,
1482 gettext_noop ("Direct access to transport service."), 1420 argv,
1483 options, 1421 "gnunet-transport",
1484 &run, NULL); 1422 gettext_noop ("Direct access to transport service."),
1423 options,
1424 &run,
1425 NULL);
1485 GNUNET_free ((void *) argv); 1426 GNUNET_free ((void *) argv);
1486 if (GNUNET_OK == res) 1427 if (GNUNET_OK == res)
1487 return ret; 1428 return ret;