2 This file is part of GNUnet.
3 Copyright (C) 2011-2014 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 * @file src/transport/gnunet-transport.c
23 * @brief Tool to help configure, measure and control the transport subsystem.
24 * @author Christian Grothoff
25 * @author Nathan Evans
27 * This utility can be used to test if a transport mechanism for
28 * GNUnet is properly configured.
31 #include "gnunet_util_lib.h"
32 #include "gnunet_resolver_service.h"
33 #include "gnunet_protocols.h"
34 #include "gnunet_transport_service.h"
35 #include "gnunet_nat_lib.h"
38 * How long do we wait for the NAT test to report success?
39 * Should match NAT_SERVER_TIMEOUT in 'nat_test.c'.
41 #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 20)
44 * Timeout for a name resolution
46 #define RESOLUTION_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
49 * Timeout for an operations
51 #define OP_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
55 * Context to store name resolutions for valiation
57 struct ValidationResolutionContext
62 struct ValidationResolutionContext *next;
67 struct ValidationResolutionContext *prev;
72 struct GNUNET_HELLO_Address *addrcp;
75 * Time of last validation
77 struct GNUNET_TIME_Absolute last_validation;
80 * Address is valid until
82 struct GNUNET_TIME_Absolute valid_until;
85 * Time of next validation
87 struct GNUNET_TIME_Absolute next_validation;
90 * state of validation process
92 enum GNUNET_TRANSPORT_ValidationState state;
95 * Tranport conversion handle
97 struct GNUNET_TRANSPORT_AddressToStringContext *asc;
105 * was the entry printed
111 * Struct to store information about peers in monitor mode
118 enum GNUNET_TRANSPORT_PeerState state;
123 struct GNUNET_TIME_Absolute state_timeout;
126 * The address to convert
128 struct GNUNET_HELLO_Address *address;
132 * Context to store name resolutions for valiation
134 struct PeerResolutionContext
139 struct PeerResolutionContext *next;
144 struct PeerResolutionContext *prev;
149 struct GNUNET_PeerIdentity id;
154 struct GNUNET_HELLO_Address *addrcp;
157 * transport conversiion context
159 struct GNUNET_TRANSPORT_AddressToStringContext *asc;
164 enum GNUNET_TRANSPORT_PeerState state;
169 struct GNUNET_TIME_Absolute state_timeout;
177 * was the entry printed
184 * Context for a plugin test.
191 struct TestContext *prev;
196 struct TestContext *next;
199 * Handle to the active NAT test.
201 struct GNUNET_NAT_Test *tst;
204 * Task identifier for the timeout.
206 struct GNUNET_SCHEDULER_Task * tsk;
209 * Name of plugin under test.
216 unsigned long long bnd_port;
221 unsigned long long adv_port;
232 * NAT returned success
234 NAT_TEST_SUCCESS = GNUNET_OK,
237 * NAT returned failure
239 NAT_TEST_FAIL = GNUNET_NO,
242 * NAT returned failure while running test
244 NAT_TEST_INTERNAL_FAIL = GNUNET_SYSERR,
247 * We could not start the test
249 NAT_TEST_FAILED_TO_START = 2,
252 * We had a timeout while running the test
259 * Benchmarking block size in KB
264 * Which peer should we connect to?
269 * Handle to transport service.
271 static struct GNUNET_TRANSPORT_Handle *handle;
274 * Configuration handle
276 static struct GNUNET_CONFIGURATION_Handle *cfg;
281 struct GNUNET_TRANSPORT_TryConnectHandle *tc_handle;
284 * Try disconnect handle
286 struct GNUNET_TRANSPORT_TryDisconnectHandle *td_handle;
291 static int benchmark_send;
296 static int benchmark_receive;
301 static int benchmark_receive;
306 static int iterate_connections;
311 static int iterate_validation;
316 static int iterate_all;
321 static int test_configuration;
326 static int monitor_connects;
331 static int monitor_connections;
336 static int monitor_validation;
341 static int monitor_plugins;
346 static int try_connect;
351 static int try_disconnect;
359 * Global return value (0 success).
364 * Current number of connections in monitor mode
366 static int monitor_connect_counter;
369 * Number of bytes of traffic we received so far.
371 static unsigned long long traffic_received;
374 * Number of bytes of traffic we sent so far.
376 static unsigned long long traffic_sent;
379 * Starting time of transmitting/receiving data.
381 static struct GNUNET_TIME_Absolute start_time;
384 * Handle for current transmission request.
386 static struct GNUNET_TRANSPORT_TransmitHandle *th;
389 * Map storing information about monitored peers
391 static struct GNUNET_CONTAINER_MultiPeerMap *monitored_peers;
394 * Map storing information about monitored plugins's sessions.
396 static struct GNUNET_CONTAINER_MultiPeerMap *monitored_plugins;
399 * Handle if we are monitoring peers at the transport level.
401 static struct GNUNET_TRANSPORT_PeerMonitoringContext *pic;
404 * Handle if we are monitoring transport validation activity.
406 static struct GNUNET_TRANSPORT_ValidationMonitoringContext *vic;
409 * Handle if we are monitoring plugin session activity.
411 static struct GNUNET_TRANSPORT_PluginMonitor *pm;
414 * Identity of the peer we transmit to / connect to.
415 * (equivalent to 'cpid' string).
417 static struct GNUNET_PeerIdentity pid;
420 * Task scheduled for cleanup / termination of the process.
422 static struct GNUNET_SCHEDULER_Task * end;
425 * Task for operation timeout
427 static struct GNUNET_SCHEDULER_Task * op_timeout;
430 * Selected level of verbosity.
432 static int verbosity;
435 * Resolver process handle.
437 struct GNUNET_OS_Process *resolver;
440 * Number of address resolutions pending
442 static unsigned int address_resolutions;
445 * Address resolutions pending in progress
447 static unsigned int address_resolution_in_progress;
450 * DLL for NAT Test Contexts: head
452 struct TestContext *head;
455 * DLL for NAT Test Contexts: tail
457 struct TestContext *tail;
460 * DLL: head of validation resolution entries
462 static struct ValidationResolutionContext *vc_head;
465 * DLL: tail of validation resolution entries
467 static struct ValidationResolutionContext *vc_tail;
470 * DLL: head of resolution entries
472 static struct PeerResolutionContext *rc_head;
475 * DLL: head of resolution entries
477 static struct PeerResolutionContext *rc_tail;
481 * Function called to release data stored in the #monitored_peers map.
484 * @param key the peer identity
485 * @param value a `struct MonitoredPeer` to release
486 * @return #GNUNET_OK (continue to iterate)
489 destroy_it (void *cls,
490 const struct GNUNET_PeerIdentity *key,
493 struct MonitoredPeer *m = value;
495 GNUNET_assert (GNUNET_OK ==
496 GNUNET_CONTAINER_multipeermap_remove (monitored_peers,
499 GNUNET_free_non_null (m->address);
506 * Task run in monitor mode when the user presses CTRL-C to abort.
507 * Stops monitoring activity.
510 * @param tc scheduler context
513 shutdown_task (void *cls,
514 const struct GNUNET_SCHEDULER_TaskContext *tc)
516 struct GNUNET_TIME_Relative duration;
517 struct ValidationResolutionContext *cur;
518 struct ValidationResolutionContext *next;
521 if (NULL != op_timeout)
523 GNUNET_SCHEDULER_cancel (op_timeout);
526 if (NULL != tc_handle)
528 GNUNET_TRANSPORT_try_connect_cancel (tc_handle);
533 GNUNET_TRANSPORT_monitor_peers_cancel (pic);
538 GNUNET_TRANSPORT_monitor_validation_entries_cancel (vic);
543 GNUNET_TRANSPORT_monitor_plugins_cancel (pm);
548 for (cur = next; NULL != cur; cur = next)
552 GNUNET_TRANSPORT_address_to_string_cancel (cur->asc);
553 GNUNET_CONTAINER_DLL_remove (vc_head, vc_tail, cur);
554 GNUNET_free (cur->transport);
555 GNUNET_HELLO_address_free (cur->addrcp);
561 GNUNET_TRANSPORT_notify_transmit_ready_cancel (th);
566 GNUNET_TRANSPORT_disconnect (handle);
571 duration = GNUNET_TIME_absolute_get_duration (start_time);
573 _("Transmitted %llu bytes/s (%llu bytes in %s)\n"),
574 1000LL * 1000LL * traffic_sent / (1 + duration.rel_value_us),
576 GNUNET_STRINGS_relative_time_to_string (duration, GNUNET_YES));
578 if (benchmark_receive)
580 duration = GNUNET_TIME_absolute_get_duration (start_time);
582 _("Received %llu bytes/s (%llu bytes in %s)\n"),
583 1000LL * 1000LL * traffic_received / (1 + duration.rel_value_us),
585 GNUNET_STRINGS_relative_time_to_string (duration, GNUNET_YES));
588 if (NULL != monitored_peers)
590 GNUNET_CONTAINER_multipeermap_iterate (monitored_peers, &destroy_it, NULL);
591 GNUNET_CONTAINER_multipeermap_destroy (monitored_peers);
592 monitored_peers = NULL;
594 if (NULL != monitored_plugins)
597 GNUNET_CONTAINER_multipeermap_size (monitored_plugins));
598 GNUNET_CONTAINER_multipeermap_destroy (monitored_plugins);
599 monitored_plugins = NULL;
605 operation_timeout (void *cls,
606 const struct GNUNET_SCHEDULER_TaskContext *tc)
608 struct PeerResolutionContext *cur;
609 struct PeerResolutionContext *next;
611 if ((try_connect) || (benchmark_send) || (benchmark_receive))
614 _("Failed to connect to `%s'\n"),
615 GNUNET_i2s_full (&pid));
617 GNUNET_SCHEDULER_cancel (end);
618 end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
622 if (iterate_connections)
625 while (NULL != (cur = next))
629 _("Failed to resolve address for peer `%s'\n"),
630 GNUNET_i2s (&cur->addrcp->peer));
632 GNUNET_CONTAINER_DLL_remove(rc_head, rc_tail, cur);
633 GNUNET_TRANSPORT_address_to_string_cancel (cur->asc);
634 GNUNET_free(cur->transport);
635 GNUNET_free(cur->addrcp);
641 _("Failed to list connections, timeout occured\n"));
643 GNUNET_SCHEDULER_cancel (end);
644 end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
656 * Display the result of the test.
658 * @param tc test context
659 * @param result #GNUNET_YES on success
662 display_test_result (struct TestContext *tc,
663 enum TestResult result)
668 _("Configuration for plugin `%s' did not work!\n"),
671 case NAT_TEST_SUCCESS:
673 _("Configuration for plugin `%s' did work!\n"),
676 case NAT_TEST_INTERNAL_FAIL:
678 _("Internal NAT error while running test for plugin `%s'\n"),
681 case NAT_TEST_FAILED_TO_START:
683 _("Failed to start NAT test for plugin `%s'\n"),
686 case NAT_TEST_TIMEOUT:
688 _("Timeout while waiting for result of NAT test for plugin `%s'\n"),
693 _("Configuration for plugin `%s' did not work!\n"),
699 GNUNET_SCHEDULER_cancel (tc->tsk);
704 GNUNET_NAT_test_stop (tc->tst);
708 GNUNET_CONTAINER_DLL_remove (head, tail, tc);
709 GNUNET_free (tc->name);
712 if ((NULL == head) && (NULL != resolver))
714 GNUNET_break (0 == GNUNET_OS_process_kill (resolver,
716 GNUNET_OS_process_destroy (resolver);
724 * Function called by NAT to report the outcome of the nat-test.
725 * Clean up and update GUI.
727 * @param cls test context
728 * @param result status code
731 result_callback (void *cls,
732 enum GNUNET_NAT_StatusCode result)
734 struct TestContext *tc = cls;
736 display_test_result (tc, result);
741 * Resolve address we got a validation state for to a string.
743 * @param address the address itself
744 * @param numeric #GNUNET_YES to disable DNS, #GNUNET_NO to try reverse lookup
745 * @param last_validation when was the address validated last
746 * @param valid_until until when is the address valid
747 * @param next_validation when will we try to revalidate the address next
748 * @param state where are we in the validation state machine
751 resolve_validation_address (const struct GNUNET_HELLO_Address *address,
753 struct GNUNET_TIME_Absolute last_validation,
754 struct GNUNET_TIME_Absolute valid_until,
755 struct GNUNET_TIME_Absolute next_validation,
756 enum GNUNET_TRANSPORT_ValidationState state);
760 * Function to call with a textual representation of an address. This
761 * function will be called several times with different possible
762 * textual representations, and a last time with @a address being NULL
763 * to signal the end of the iteration. Note that @a address NULL
764 * always is the last call, regardless of the value in @a res.
767 * @param address NULL on end of iteration,
768 * otherwise 0-terminated printable UTF-8 string,
769 * in particular an empty string if @a res is #GNUNET_NO
770 * @param res result of the address to string conversion:
771 * if #GNUNET_OK: conversion successful
772 * if #GNUNET_NO: address was invalid (or not supported)
773 * if #GNUNET_SYSERR: communication error (IPC error)
776 process_validation_string (void *cls,
780 struct ValidationResolutionContext *vc = cls;
787 if (GNUNET_SYSERR == res)
790 "Failed to convert address for peer `%s' plugin `%s' length %u to string \n",
791 GNUNET_i2s (&vc->addrcp->peer),
792 vc->addrcp->transport_name,
793 (unsigned int) vc->addrcp->address_length);
795 if (GNUNET_TIME_UNIT_ZERO_ABS.abs_value_us == vc->valid_until.abs_value_us)
796 s_valid = GNUNET_strdup ("never");
798 s_valid = GNUNET_strdup (GNUNET_STRINGS_absolute_time_to_string (vc->valid_until));
800 if (GNUNET_TIME_UNIT_ZERO_ABS.abs_value_us == vc->last_validation.abs_value_us)
801 s_last = GNUNET_strdup ("never");
803 s_last = GNUNET_strdup (GNUNET_STRINGS_absolute_time_to_string (vc->last_validation));
805 if (GNUNET_TIME_UNIT_ZERO_ABS.abs_value_us == vc->next_validation.abs_value_us)
806 s_next = GNUNET_strdup ("never");
808 s_next = GNUNET_strdup (GNUNET_STRINGS_absolute_time_to_string (vc->next_validation));
811 _("Peer `%s' %s %s\n\t%s%s\n\t%s%s\n\t%s%s\n"),
812 GNUNET_i2s (&vc->addrcp->peer),
813 (GNUNET_OK == res) ? address : "<invalid address>",
814 (monitor_validation) ? GNUNET_TRANSPORT_vs2s (vc->state) : "",
815 "Valid until : ", s_valid,
816 "Last validation: ",s_last,
817 "Next validation: ", s_next);
818 GNUNET_free (s_valid);
819 GNUNET_free (s_last);
820 GNUNET_free (s_next);
821 vc->printed = GNUNET_YES;
824 /* last call, we are done */
825 GNUNET_assert (address_resolutions > 0);
826 address_resolutions--;
827 if ( (GNUNET_SYSERR == res) &&
828 (GNUNET_NO == vc->printed))
830 if (numeric == GNUNET_NO)
832 /* Failed to resolve address, try numeric lookup
833 (note: this should be unnecessary, as
834 transport should fallback to numeric lookup
835 internally if DNS takes too long anyway) */
836 resolve_validation_address (vc->addrcp,
846 _("Peer `%s' %s `%s' \n"),
847 GNUNET_i2s (&vc->addrcp->peer),
848 "<unable to resolve address>",
849 GNUNET_TRANSPORT_vs2s (vc->state));
852 GNUNET_free (vc->transport);
853 GNUNET_free (vc->addrcp);
854 GNUNET_CONTAINER_DLL_remove (vc_head, vc_tail, vc);
856 if ((0 == address_resolutions) && (iterate_validation))
860 GNUNET_SCHEDULER_cancel (end);
863 if (NULL != op_timeout)
865 GNUNET_SCHEDULER_cancel (op_timeout);
869 end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
875 * Resolve address we got a validation state for to a string.
877 * @param address the address itself
878 * @param numeric #GNUNET_YES to disable DNS, #GNUNET_NO to try reverse lookup
879 * @param last_validation when was the address validated last
880 * @param valid_until until when is the address valid
881 * @param next_validation when will we try to revalidate the address next
882 * @param state where are we in the validation state machine
885 resolve_validation_address (const struct GNUNET_HELLO_Address *address,
887 struct GNUNET_TIME_Absolute last_validation,
888 struct GNUNET_TIME_Absolute valid_until,
889 struct GNUNET_TIME_Absolute next_validation,
890 enum GNUNET_TRANSPORT_ValidationState state)
892 struct ValidationResolutionContext *vc;
894 vc = GNUNET_new (struct ValidationResolutionContext);
895 GNUNET_assert(NULL != vc);
896 GNUNET_CONTAINER_DLL_insert(vc_head, vc_tail, vc);
897 address_resolutions++;
899 vc->transport = GNUNET_strdup(address->transport_name);
900 vc->addrcp = GNUNET_HELLO_address_copy (address);
901 vc->printed = GNUNET_NO;
903 vc->last_validation = last_validation;
904 vc->valid_until = valid_until;
905 vc->next_validation = next_validation;
907 /* Resolve address to string */
908 vc->asc = GNUNET_TRANSPORT_address_to_string (cfg,
912 &process_validation_string, vc);
917 * Resolve address we got a validation state for to a string.
920 * @param address the address itself
921 * @param last_validation when was the address validated last
922 * @param valid_until until when is the address valid
923 * @param next_validation when will we try to revalidate the address next
924 * @param state where are we in the validation state machine
927 process_validation_cb (void *cls,
928 const struct GNUNET_HELLO_Address *address,
929 struct GNUNET_TIME_Absolute last_validation,
930 struct GNUNET_TIME_Absolute valid_until,
931 struct GNUNET_TIME_Absolute next_validation,
932 enum GNUNET_TRANSPORT_ValidationState state)
936 if (monitor_validation)
940 _("Monitor disconnected from transport service. Reconnecting.\n"));
947 GNUNET_SCHEDULER_cancel (end);
948 end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
953 /* invalid response */
956 GNUNET_SCHEDULER_cancel (end);
957 end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
960 resolve_validation_address (address,
972 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
973 "Running test for plugin `%s' using bind port %u and advertised port %u \n",
975 (uint16_t) head->bnd_port,
976 (uint16_t) head->adv_port);
978 head->tst = GNUNET_NAT_test_start (cfg,
979 (0 == strcasecmp (head->name, "udp")) ? GNUNET_NO : GNUNET_YES,
980 (uint16_t) head->bnd_port,
981 (uint16_t) head->adv_port,
983 &result_callback, head);
988 * Test our plugin's configuration (NAT traversal, etc.).
990 * @param cfg configuration to test
993 do_test_configuration (const struct GNUNET_CONFIGURATION_Handle *cfg)
997 unsigned long long bnd_port;
998 unsigned long long adv_port;
999 struct TestContext *tc;
1003 != GNUNET_CONFIGURATION_get_value_string (cfg, "transport", "plugins",
1006 FPRINTF (stderr, "%s", _
1007 ("No transport plugins configured, peer will never communicate\n"));
1012 for (tok = strtok (plugins, " "); tok != NULL ; tok = strtok (NULL, " "))
1014 char section[12 + strlen (tok)];
1015 GNUNET_snprintf (section, sizeof(section), "transport-%s", tok);
1017 != GNUNET_CONFIGURATION_get_value_number (cfg, section, "PORT",
1021 _("No port configured for plugin `%s', cannot test it\n"), tok);
1024 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg, section,
1025 "ADVERTISED_PORT", &adv_port))
1026 adv_port = bnd_port;
1028 tc = GNUNET_new (struct TestContext);
1029 tc->name = GNUNET_strdup (tok);
1030 tc->adv_port = adv_port;
1031 tc->bnd_port = bnd_port;
1032 GNUNET_CONTAINER_DLL_insert_tail (head, tail, tc);
1034 GNUNET_free(plugins);
1036 if ((NULL != head) && (NULL == resolver))
1038 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-resolver");
1039 resolver = GNUNET_OS_start_process (GNUNET_YES,
1040 GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
1043 "gnunet-service-resolver", NULL);
1044 if (NULL == resolver)
1046 FPRINTF (stderr, _("Failed to start resolver!\n"));
1050 GNUNET_free(binary);
1051 GNUNET_RESOLVER_connect (cfg);
1058 * Function called to notify a client about the socket
1059 * begin ready to queue more data. @a buf will be
1060 * NULL and @a size zero if the socket was closed for
1061 * writing in the meantime.
1063 * @param cls closure
1064 * @param size number of bytes available in @a buf
1065 * @param buf where the callee should write the message
1066 * @return number of bytes written to @a buf
1069 transmit_data (void *cls,
1073 struct GNUNET_MessageHeader *m = buf;
1075 if ((NULL == buf) || (0 == size))
1081 GNUNET_assert(size >= sizeof(struct GNUNET_MessageHeader));
1082 GNUNET_assert(size < GNUNET_SERVER_MAX_MESSAGE_SIZE);
1083 m->size = ntohs (size);
1084 m->type = ntohs (GNUNET_MESSAGE_TYPE_DUMMY);
1085 memset (&m[1], 52, size - sizeof(struct GNUNET_MessageHeader));
1086 traffic_sent += size;
1087 th = GNUNET_TRANSPORT_notify_transmit_ready (handle, &pid,
1089 GNUNET_TIME_UNIT_FOREVER_REL,
1090 &transmit_data, NULL);
1092 FPRINTF (stdout, _("Transmitting %u bytes to %s\n"), (unsigned int) size,
1099 * Function called to notify transport users that another
1100 * peer connected to us.
1102 * @param cls closure
1103 * @param peer the peer that connected
1106 notify_connect (void *cls,
1107 const struct GNUNET_PeerIdentity *peer)
1109 if (0 != memcmp (&pid, peer, sizeof(struct GNUNET_PeerIdentity)))
1114 /* all done, terminate instantly */
1115 FPRINTF (stdout, _("Successfully connected to `%s'\n"),
1116 GNUNET_i2s_full (peer));
1119 if (NULL != op_timeout)
1121 GNUNET_SCHEDULER_cancel (op_timeout);
1126 GNUNET_SCHEDULER_cancel (end);
1127 end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
1132 if (NULL != op_timeout)
1134 GNUNET_SCHEDULER_cancel (op_timeout);
1139 _("Successfully connected to `%s', starting to send benchmark data in %u Kb blocks\n"),
1140 GNUNET_i2s (&pid), BLOCKSIZE);
1141 start_time = GNUNET_TIME_absolute_get ();
1143 th = GNUNET_TRANSPORT_notify_transmit_ready (handle, peer,
1145 GNUNET_TIME_UNIT_FOREVER_REL,
1156 * Function called to notify transport users that another
1157 * peer disconnected from us.
1159 * @param cls closure
1160 * @param peer the peer that disconnected
1163 notify_disconnect (void *cls,
1164 const struct GNUNET_PeerIdentity *peer)
1166 if (0 != memcmp (&pid, peer, sizeof(struct GNUNET_PeerIdentity)))
1171 /* all done, terminate instantly */
1172 FPRINTF (stdout, _("Successfully disconnected from `%s'\n"),
1173 GNUNET_i2s_full (peer));
1176 if (NULL != op_timeout)
1178 GNUNET_SCHEDULER_cancel (op_timeout);
1183 GNUNET_SCHEDULER_cancel (end);
1184 end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
1190 GNUNET_TRANSPORT_notify_transmit_ready_cancel (th);
1195 FPRINTF (stdout, _("Disconnected from peer `%s' while benchmarking\n"),
1198 GNUNET_SCHEDULER_cancel (end);
1205 * Function called to notify transport users that another
1206 * peer connected to us.
1208 * @param cls closure
1209 * @param peer the peer that connected
1212 monitor_notify_connect (void *cls,
1213 const struct GNUNET_PeerIdentity *peer)
1215 monitor_connect_counter++;
1216 struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
1217 const char *now_str = GNUNET_STRINGS_absolute_time_to_string (now);
1220 _("%24s: %-17s %4s (%u connections in total)\n"),
1224 monitor_connect_counter);
1229 * Function called to notify transport users that another
1230 * peer disconnected from us.
1232 * @param cls closure
1233 * @param peer the peer that disconnected
1236 monitor_notify_disconnect (void *cls,
1237 const struct GNUNET_PeerIdentity *peer)
1239 struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
1240 const char *now_str = GNUNET_STRINGS_absolute_time_to_string (now);
1242 GNUNET_assert(monitor_connect_counter > 0);
1243 monitor_connect_counter--;
1246 _("%24s: %-17s %4s (%u connections in total)\n"),
1248 _("Disconnected from"),
1250 monitor_connect_counter);
1255 * Function called by the transport for each received message.
1257 * @param cls closure
1258 * @param peer (claimed) identity of the other peer
1259 * @param message the message
1262 notify_receive (void *cls,
1263 const struct GNUNET_PeerIdentity *peer,
1264 const struct GNUNET_MessageHeader *message)
1266 if (benchmark_receive)
1268 if (GNUNET_MESSAGE_TYPE_DUMMY != ntohs (message->type))
1272 _("Received %u bytes from %s\n"),
1273 (unsigned int) ntohs (message->size),
1276 if (traffic_received == 0)
1277 start_time = GNUNET_TIME_absolute_get ();
1278 traffic_received += ntohs (message->size);
1285 resolve_peer_address (const struct GNUNET_PeerIdentity *id,
1286 const struct GNUNET_HELLO_Address *address,
1288 enum GNUNET_TRANSPORT_PeerState state,
1289 struct GNUNET_TIME_Absolute state_timeout);
1293 print_info (const struct GNUNET_PeerIdentity *id,
1294 const char *transport,
1296 enum GNUNET_TRANSPORT_PeerState state,
1297 struct GNUNET_TIME_Absolute state_timeout)
1300 if ( ((GNUNET_YES == iterate_connections) && (GNUNET_YES == iterate_all)) ||
1301 (GNUNET_YES == monitor_connections))
1304 _("Peer `%s': %s %s in state `%s' until %s\n"),
1306 (NULL == transport) ? "<none>" : transport,
1307 (NULL == transport) ? "<none>" : addr,
1308 GNUNET_TRANSPORT_ps2s (state),
1309 GNUNET_STRINGS_absolute_time_to_string (state_timeout));
1311 else if ( (GNUNET_YES == iterate_connections) &&
1312 (GNUNET_TRANSPORT_is_connected(state)))
1314 /* Only connected peers, skip state */
1316 _("Peer `%s': %s %s\n"),
1325 * Function called with a textual representation of an address. This
1326 * function will be called several times with different possible
1327 * textual representations, and a last time with @a address being NULL
1328 * to signal the end of the iteration. Note that @a address NULL
1329 * always is the last call, regardless of the value in @a res.
1331 * @param cls closure
1332 * @param address NULL on end of iteration,
1333 * otherwise 0-terminated printable UTF-8 string,
1334 * in particular an empty string if @a res is #GNUNET_NO
1335 * @param res result of the address to string conversion:
1336 * if #GNUNET_OK: conversion successful
1337 * if #GNUNET_NO: address was invalid (or not supported)
1338 * if #GNUNET_SYSERR: communication error (IPC error)
1341 process_peer_string (void *cls,
1342 const char *address,
1345 struct PeerResolutionContext *rc = cls;
1347 if (NULL != address)
1349 if (GNUNET_SYSERR == res)
1352 "Failed to convert address for peer `%s' plugin `%s' length %u to string \n",
1353 GNUNET_i2s (&rc->id),
1354 rc->addrcp->transport_name,
1355 (unsigned int) rc->addrcp->address_length);
1356 print_info (&rc->id,
1361 rc->printed = GNUNET_YES;
1364 if (GNUNET_OK == res)
1366 print_info (&rc->id,
1371 rc->printed = GNUNET_YES;
1372 return; /* Wait for done call */
1374 /* GNUNET_NO == res: ignore, was simply not supported */
1377 /* NULL == address, last call, we are done */
1379 GNUNET_assert (address_resolutions > 0);
1380 address_resolutions--;
1381 if (GNUNET_NO == rc->printed)
1383 if (numeric == GNUNET_NO)
1385 /* Failed to resolve address, try numeric lookup
1386 (note: this should not be needed, as transport
1387 should fallback to numeric conversion if DNS takes
1389 resolve_peer_address (&rc->id,
1397 print_info (&rc->id,
1404 GNUNET_free (rc->transport);
1405 GNUNET_free (rc->addrcp);
1406 GNUNET_CONTAINER_DLL_remove (rc_head, rc_tail, rc);
1408 if ((0 == address_resolutions) && (iterate_connections))
1412 GNUNET_SCHEDULER_cancel (end);
1415 if (NULL != op_timeout)
1417 GNUNET_SCHEDULER_cancel (op_timeout);
1421 end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
1427 resolve_peer_address (const struct GNUNET_PeerIdentity *id,
1428 const struct GNUNET_HELLO_Address *address,
1430 enum GNUNET_TRANSPORT_PeerState state,
1431 struct GNUNET_TIME_Absolute state_timeout)
1433 struct PeerResolutionContext *rc;
1435 rc = GNUNET_new (struct PeerResolutionContext);
1436 GNUNET_assert(NULL != rc);
1437 GNUNET_CONTAINER_DLL_insert(rc_head, rc_tail, rc);
1438 address_resolutions++;
1441 rc->transport = GNUNET_strdup(address->transport_name);
1442 rc->addrcp = GNUNET_HELLO_address_copy (address);
1443 rc->printed = GNUNET_NO;
1445 rc->state_timeout = state_timeout;
1446 /* Resolve address to string */
1447 rc->asc = GNUNET_TRANSPORT_address_to_string (cfg,
1451 &process_peer_string, rc);
1456 * Function called with information about a peers during a one shot iteration
1458 * @param cls closure
1459 * @param peer identity of the peer, NULL for final callback when operation done
1460 * @param address binary address used to communicate with this peer,
1461 * NULL on disconnect or when done
1462 * @param state current state this peer is in
1463 * @param state_timeout time out for the current state
1466 process_peer_iteration_cb (void *cls,
1467 const struct GNUNET_PeerIdentity *peer,
1468 const struct GNUNET_HELLO_Address *address,
1469 enum GNUNET_TRANSPORT_PeerState state,
1470 struct GNUNET_TIME_Absolute state_timeout)
1475 address_resolution_in_progress = GNUNET_NO;
1478 GNUNET_SCHEDULER_cancel (end);
1479 end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
1483 if ( (GNUNET_NO == iterate_all) &&
1484 (GNUNET_NO == GNUNET_TRANSPORT_is_connected(state)))
1485 return; /* Display only connected peers */
1487 if (NULL != op_timeout)
1488 GNUNET_SCHEDULER_cancel (op_timeout);
1489 op_timeout = GNUNET_SCHEDULER_add_delayed (OP_TIMEOUT,
1493 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1494 "Received address for peer `%s': %s\n",
1496 address->transport_name);
1498 if (NULL != address)
1499 resolve_peer_address (peer, address, numeric, state, state_timeout);
1501 print_info (peer, NULL, NULL, state, state_timeout);
1506 * Context for address resolution by #plugin_monitoring_cb().
1508 struct PluginMonitorAddress
1512 * Ongoing resolution request.
1514 struct GNUNET_TRANSPORT_AddressToStringContext *asc;
1517 * Resolved address as string.
1524 * Function called with a textual representation of an address. This
1525 * function will be called several times with different possible
1526 * textual representations, and a last time with @a address being NULL
1527 * to signal the end of the iteration. Note that @a address NULL
1528 * always is the last call, regardless of the value in @a res.
1530 * @param cls closure
1531 * @param address NULL on end of iteration,
1532 * otherwise 0-terminated printable UTF-8 string,
1533 * in particular an empty string if @a res is #GNUNET_NO
1534 * @param res result of the address to string conversion:
1535 * if #GNUNET_OK: conversion successful
1536 * if #GNUNET_NO: address was invalid (or not supported)
1537 * if #GNUNET_SYSERR: communication error (IPC error)
1540 address_cb (void *cls,
1541 const char *address,
1544 struct PluginMonitorAddress *addr = cls;
1546 if (NULL == address)
1551 if (NULL != addr->str)
1553 addr->str = GNUNET_strdup (address);
1558 * Function called by the plugin with information about the
1559 * current sessions managed by the plugin (for monitoring).
1561 * @param cls closure (NULL)
1562 * @param session session handle this information is about,
1563 * NULL to indicate that we are "in sync" (initial
1564 * iteration complete)
1565 * @param session_ctx storage location where the application
1566 * can store data; will point to NULL on #GNUNET_TRANSPORT_SS_INIT,
1567 * and must be reset to NULL on #GNUNET_TRANSPORT_SS_DONE
1568 * @param info information about the state of the session,
1569 * NULL if @a session is also NULL and we are
1570 * merely signalling that the initial iteration is over;
1571 * NULL with @a session being non-NULL if the monitor
1572 * was being cancelled while sessions were active
1575 plugin_monitoring_cb (void *cls,
1576 struct GNUNET_TRANSPORT_PluginSession *session,
1578 const struct GNUNET_TRANSPORT_SessionInfo *info)
1581 struct PluginMonitorAddress *addr;
1583 if ( (NULL == info) &&
1585 return; /* in sync with transport service */
1586 addr = *session_ctx;
1591 if (NULL != addr->asc)
1593 GNUNET_TRANSPORT_address_to_string_cancel (addr->asc);
1596 GNUNET_free_non_null (addr->str);
1598 *session_ctx = NULL;
1600 return; /* shutdown */
1602 if ( (NULL != cpid) &&
1603 (0 != memcmp (&info->address->peer,
1605 sizeof (struct GNUNET_PeerIdentity))) )
1606 return; /* filtered */
1609 addr = GNUNET_new (struct PluginMonitorAddress);
1610 addr->asc = GNUNET_TRANSPORT_address_to_string (cfg,
1613 GNUNET_TIME_UNIT_FOREVER_REL,
1616 *session_ctx = addr;
1618 switch (info->state)
1620 case GNUNET_TRANSPORT_SS_INIT:
1623 case GNUNET_TRANSPORT_SS_HANDSHAKE:
1624 state = "HANDSHAKE";
1626 case GNUNET_TRANSPORT_SS_UP:
1629 case GNUNET_TRANSPORT_SS_UPDATE:
1632 case GNUNET_TRANSPORT_SS_DONE:
1640 "%s: %s %s (# %u/%u b) blocked until %s timeout in %s [%s]\n",
1641 GNUNET_i2s (&info->address->peer),
1643 (info->is_inbound == GNUNET_YES) ? "<-" : ((info->is_inbound == GNUNET_NO) ? "->" : "<>"),
1644 info->num_msg_pending,
1645 info->num_bytes_pending,
1646 GNUNET_STRINGS_absolute_time_to_string (info->receive_delay),
1647 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (info->session_timeout),
1650 if (GNUNET_TRANSPORT_SS_DONE == info->state)
1652 if (NULL != addr->asc)
1654 GNUNET_TRANSPORT_address_to_string_cancel (addr->asc);
1657 GNUNET_free_non_null (addr->str);
1659 *session_ctx = NULL;
1665 * Function called with information about a peers
1667 * @param cls closure
1668 * @param peer identity of the peer, NULL for final callback when operation done
1669 * @param address binary address used to communicate with this peer,
1670 * NULL on disconnect or when done
1671 * @param state current state this peer is in
1672 * @param state_timeout time out for the current state
1676 process_peer_monitoring_cb (void *cls,
1677 const struct GNUNET_PeerIdentity *peer,
1678 const struct GNUNET_HELLO_Address *address,
1679 enum GNUNET_TRANSPORT_PeerState state,
1680 struct GNUNET_TIME_Absolute state_timeout)
1682 struct MonitoredPeer *m;
1688 _("Monitor disconnected from transport service. Reconnecting.\n"));
1692 if (NULL != op_timeout)
1693 GNUNET_SCHEDULER_cancel (op_timeout);
1694 op_timeout = GNUNET_SCHEDULER_add_delayed (OP_TIMEOUT,
1698 if (NULL == (m = GNUNET_CONTAINER_multipeermap_get (monitored_peers, peer)))
1700 m = GNUNET_new (struct MonitoredPeer);
1701 GNUNET_CONTAINER_multipeermap_put (monitored_peers, peer,
1702 m, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
1706 if ( (m->state == state) &&
1707 (m->state_timeout.abs_value_us == state_timeout.abs_value_us) &&
1708 ((NULL == address) && (NULL == m->address)))
1710 return; /* No real change */
1712 if ( (m->state == state) && ((NULL != address) && (NULL != m->address)) &&
1713 (0 == GNUNET_HELLO_address_cmp(m->address, address)))
1714 return; /* No real change */
1717 if (NULL != m->address)
1719 GNUNET_free (m->address);
1722 if (NULL != address)
1723 m->address = GNUNET_HELLO_address_copy (address);
1725 m->state_timeout = state_timeout;
1727 if (NULL != address)
1728 resolve_peer_address (peer,
1743 * Function called with our result of trying to connect to a peer
1744 * using the transport service. Will retry 10 times, and if we still
1745 * fail to connect terminate with an error message.
1748 * @param result #GNUNET_OK if we connected to the service
1751 try_connect_cb (void *cls,
1754 static int retries = 0;
1757 if (GNUNET_OK == result)
1762 tc_handle = GNUNET_TRANSPORT_try_connect (handle,
1770 _("Failed to send connect request to transport service\n"));
1772 GNUNET_SCHEDULER_cancel (end);
1774 end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
1779 * Function called with our result of trying to disconnect a peer
1780 * using the transport service. Will retry 10 times, and if we still
1781 * fail to disconnect, terminate with an error message.
1784 * @param result #GNUNET_OK if we connected to the service
1787 try_disconnect_cb (void *cls,
1790 static int retries = 0;
1793 if (GNUNET_OK == result)
1798 td_handle = GNUNET_TRANSPORT_try_disconnect (handle,
1804 FPRINTF (stderr, "%s",
1805 _("Failed to send disconnect request to transport service\n"));
1807 GNUNET_SCHEDULER_cancel (end);
1809 end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
1814 * Function called with the result of the check if the 'transport'
1815 * service is running.
1817 * @param cls closure with our configuration
1818 * @param result #GNUNET_YES if transport is running
1821 testservice_task (void *cls,
1827 if (GNUNET_YES != result)
1829 FPRINTF (stderr, _("Service `%s' is not running\n"), "transport");
1835 != GNUNET_CRYPTO_eddsa_public_key_from_string (cpid, strlen (cpid),
1838 FPRINTF (stderr, _("Failed to parse peer identity `%s'\n"), cpid);
1842 counter = benchmark_send + benchmark_receive + iterate_connections
1843 + monitor_connections + monitor_connects + try_connect + try_disconnect +
1844 + iterate_validation + monitor_validation + monitor_plugins;
1849 _("Multiple operations given. Please choose only one operation: %s, %s, %s, %s, %s, %s %s\n"),
1850 "connect", "benchmark send", "benchmark receive", "information",
1851 "monitor", "events", "plugins");
1857 _("No operation given. Please choose one operation: %s, %s, %s, %s, %s, %s, %s\n"),
1858 "connect", "benchmark send", "benchmark receive", "information",
1859 "monitor", "events", "plugins");
1863 if (try_connect) /* -C: Connect to peer */
1867 FPRINTF (stderr, _("Option `%s' makes no sense without option `%s'.\n"),
1872 handle = GNUNET_TRANSPORT_connect (cfg, NULL, NULL, ¬ify_receive,
1873 ¬ify_connect, ¬ify_disconnect);
1876 FPRINTF (stderr, "%s", _("Failed to connect to transport service\n"));
1880 tc_handle = GNUNET_TRANSPORT_try_connect (handle, &pid, try_connect_cb,
1882 if (NULL == tc_handle)
1884 FPRINTF (stderr, "%s",
1885 _("Failed to send request to transport service\n"));
1889 op_timeout = GNUNET_SCHEDULER_add_delayed (OP_TIMEOUT, &operation_timeout,
1893 else if (try_disconnect) /* -D: Disconnect from peer */
1897 FPRINTF (stderr, _("Option `%s' makes no sense without option `%s'.\n"),
1902 handle = GNUNET_TRANSPORT_connect (cfg, NULL, NULL, ¬ify_receive,
1903 ¬ify_connect, ¬ify_disconnect);
1906 FPRINTF (stderr, "%s", _("Failed to connect to transport service\n"));
1910 td_handle = GNUNET_TRANSPORT_try_disconnect (handle, &pid,
1913 if (NULL == td_handle)
1915 FPRINTF (stderr, "%s",
1916 _("Failed to send request to transport service\n"));
1920 op_timeout = GNUNET_SCHEDULER_add_delayed (OP_TIMEOUT, &operation_timeout,
1924 else if (benchmark_send) /* -s: Benchmark sending */
1928 FPRINTF (stderr, _("Option `%s' makes no sense without option `%s'.\n"),
1933 handle = GNUNET_TRANSPORT_connect (cfg, NULL, NULL,
1936 ¬ify_disconnect);
1939 FPRINTF (stderr, "%s", _("Failed to connect to transport service\n"));
1943 tc_handle = GNUNET_TRANSPORT_try_connect (handle,
1947 if (NULL == tc_handle)
1949 FPRINTF (stderr, "%s",
1950 _("Failed to send request to transport service\n"));
1954 start_time = GNUNET_TIME_absolute_get ();
1955 op_timeout = GNUNET_SCHEDULER_add_delayed (OP_TIMEOUT,
1959 else if (benchmark_receive) /* -b: Benchmark receiving */
1961 handle = GNUNET_TRANSPORT_connect (cfg, NULL, NULL, ¬ify_receive, NULL,
1965 FPRINTF (stderr, "%s", _("Failed to connect to transport service\n"));
1970 FPRINTF (stdout, "%s", _("Starting to receive benchmark data\n"));
1971 start_time = GNUNET_TIME_absolute_get ();
1974 else if (iterate_connections) /* -i: List information about peers once */
1976 address_resolution_in_progress = GNUNET_YES;
1977 pic = GNUNET_TRANSPORT_monitor_peers (cfg, (NULL == cpid) ? NULL : &pid,
1978 GNUNET_YES, TIMEOUT, &process_peer_iteration_cb, (void *) cfg);
1979 op_timeout = GNUNET_SCHEDULER_add_delayed (OP_TIMEOUT, &operation_timeout,
1982 else if (monitor_connections) /* -m: List information about peers continuously */
1984 monitored_peers = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO);
1985 address_resolution_in_progress = GNUNET_YES;
1986 pic = GNUNET_TRANSPORT_monitor_peers (cfg, (NULL == cpid) ? NULL : &pid,
1988 &process_peer_monitoring_cb, (void *) cfg);
1990 else if (monitor_plugins) /* -P: List information about plugins continuously */
1992 monitored_plugins = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO);
1993 pm = GNUNET_TRANSPORT_monitor_plugins (cfg,
1994 &plugin_monitoring_cb,
1997 else if (iterate_validation) /* -d: Print information about validations */
1999 vic = GNUNET_TRANSPORT_monitor_validation_entries (cfg,
2000 (NULL == cpid) ? NULL : &pid,
2001 GNUNET_YES, TIMEOUT,
2002 &process_validation_cb, (void *) cfg);
2004 else if (monitor_validation) /* -f: Print information about validations continuously */
2006 vic = GNUNET_TRANSPORT_monitor_validation_entries (cfg,
2007 (NULL == cpid) ? NULL : &pid,
2009 &process_validation_cb, (void *) cfg);
2011 else if (monitor_connects) /* -e : Monitor (dis)connect events continuously */
2013 monitor_connect_counter = 0;
2014 handle = GNUNET_TRANSPORT_connect (cfg, NULL, NULL, NULL,
2015 &monitor_notify_connect,
2016 &monitor_notify_disconnect);
2021 _("Failed to connect to transport service\n"));
2033 end = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
2040 * Main function that will be run by the scheduler.
2042 * @param cls closure
2043 * @param args remaining command-line arguments
2044 * @param cfgfile name of the configuration file used (for saving, can be NULL!)
2045 * @param mycfg configuration
2050 const char *cfgfile,
2051 const struct GNUNET_CONFIGURATION_Handle *mycfg)
2053 cfg = (struct GNUNET_CONFIGURATION_Handle *) mycfg;
2054 if (test_configuration)
2056 do_test_configuration (cfg);
2059 GNUNET_CLIENT_service_test ("transport", cfg, GNUNET_TIME_UNIT_SECONDS,
2060 &testservice_task, (void *) cfg);
2064 main (int argc, char * const *argv)
2067 static const struct GNUNET_GETOPT_CommandLineOption options[] = {
2069 gettext_noop ("print information for all peers (instead of only connected peers)"),
2070 0, &GNUNET_GETOPT_set_one, &iterate_all },
2071 { 'b', "benchmark", NULL,
2072 gettext_noop ("measure how fast we are receiving data from all peers (until CTRL-C)"),
2073 0, &GNUNET_GETOPT_set_one, &benchmark_receive },
2075 NULL, gettext_noop ("connect to a peer"), 0,
2076 &GNUNET_GETOPT_set_one, &try_connect },
2077 { 'D', "disconnect",
2078 NULL, gettext_noop ("disconnect to a peer"), 0,
2079 &GNUNET_GETOPT_set_one, &try_disconnect },
2080 { 'd', "validation", NULL,
2081 gettext_noop ("print information for all pending validations "),
2082 0, &GNUNET_GETOPT_set_one, &iterate_validation },
2083 { 'f', "monitorvalidation", NULL,
2084 gettext_noop ("print information for all pending validations continuously"),
2085 0, &GNUNET_GETOPT_set_one, &monitor_validation },
2086 { 'i', "information", NULL,
2087 gettext_noop ("provide information about all current connections (once)"),
2088 0, &GNUNET_GETOPT_set_one, &iterate_connections },
2089 { 'm', "monitor", NULL,
2090 gettext_noop ("provide information about all current connections (continuously)"),
2091 0, &GNUNET_GETOPT_set_one, &monitor_connections },
2092 { 'e', "events", NULL,
2093 gettext_noop ("provide information about all connects and disconnect events (continuously)"),
2094 0, &GNUNET_GETOPT_set_one, &monitor_connects },
2096 NULL, gettext_noop ("do not resolve hostnames"), 0,
2097 &GNUNET_GETOPT_set_one, &numeric },
2098 { 'p', "peer", "PEER",
2099 gettext_noop ("peer identity"), 1, &GNUNET_GETOPT_set_string,
2101 { 'P', "plugins", NULL,
2102 gettext_noop ("monitor plugin sessions"), 0, &GNUNET_GETOPT_set_one,
2104 { 's', "send", NULL, gettext_noop
2105 ("send data for benchmarking to the other peer (until CTRL-C)"), 0,
2106 &GNUNET_GETOPT_set_one, &benchmark_send },
2107 { 't', "test", NULL,
2108 gettext_noop ("test transport configuration (involves external server)"),
2109 0, &GNUNET_GETOPT_set_one, &test_configuration },
2110 GNUNET_GETOPT_OPTION_VERBOSE (&verbosity),
2111 GNUNET_GETOPT_OPTION_END
2114 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
2117 res = GNUNET_PROGRAM_run (argc, argv,
2119 gettext_noop ("Direct access to transport service."),
2122 GNUNET_free((void *) argv);
2123 if (GNUNET_OK == res)
2128 /* end of gnunet-transport.c */