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"));
945 GNUNET_SCHEDULER_cancel (end);
946 end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
949 resolve_validation_address (address,
961 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
962 "Running test for plugin `%s' using bind port %u and advertised port %u \n",
964 (uint16_t) head->bnd_port,
965 (uint16_t) head->adv_port);
967 head->tst = GNUNET_NAT_test_start (cfg,
968 (0 == strcasecmp (head->name, "udp")) ? GNUNET_NO : GNUNET_YES,
969 (uint16_t) head->bnd_port,
970 (uint16_t) head->adv_port,
972 &result_callback, head);
977 * Test our plugin's configuration (NAT traversal, etc.).
979 * @param cfg configuration to test
982 do_test_configuration (const struct GNUNET_CONFIGURATION_Handle *cfg)
986 unsigned long long bnd_port;
987 unsigned long long adv_port;
988 struct TestContext *tc;
992 != GNUNET_CONFIGURATION_get_value_string (cfg, "transport", "plugins",
995 FPRINTF (stderr, "%s", _
996 ("No transport plugins configured, peer will never communicate\n"));
1001 for (tok = strtok (plugins, " "); tok != NULL ; tok = strtok (NULL, " "))
1003 char section[12 + strlen (tok)];
1004 GNUNET_snprintf (section, sizeof(section), "transport-%s", tok);
1006 != GNUNET_CONFIGURATION_get_value_number (cfg, section, "PORT",
1010 _("No port configured for plugin `%s', cannot test it\n"), tok);
1013 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg, section,
1014 "ADVERTISED_PORT", &adv_port))
1015 adv_port = bnd_port;
1017 tc = GNUNET_new (struct TestContext);
1018 tc->name = GNUNET_strdup (tok);
1019 tc->adv_port = adv_port;
1020 tc->bnd_port = bnd_port;
1021 GNUNET_CONTAINER_DLL_insert_tail (head, tail, tc);
1023 GNUNET_free(plugins);
1025 if ((NULL != head) && (NULL == resolver))
1027 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-resolver");
1028 resolver = GNUNET_OS_start_process (GNUNET_YES,
1029 GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
1032 "gnunet-service-resolver", NULL);
1033 if (NULL == resolver)
1035 FPRINTF (stderr, _("Failed to start resolver!\n"));
1039 GNUNET_free(binary);
1040 GNUNET_RESOLVER_connect (cfg);
1047 * Function called to notify a client about the socket
1048 * begin ready to queue more data. @a buf will be
1049 * NULL and @a size zero if the socket was closed for
1050 * writing in the meantime.
1052 * @param cls closure
1053 * @param size number of bytes available in @a buf
1054 * @param buf where the callee should write the message
1055 * @return number of bytes written to @a buf
1058 transmit_data (void *cls,
1062 struct GNUNET_MessageHeader *m = buf;
1064 if ((NULL == buf) || (0 == size))
1070 GNUNET_assert(size >= sizeof(struct GNUNET_MessageHeader));
1071 GNUNET_assert(size < GNUNET_SERVER_MAX_MESSAGE_SIZE);
1072 m->size = ntohs (size);
1073 m->type = ntohs (GNUNET_MESSAGE_TYPE_DUMMY);
1074 memset (&m[1], 52, size - sizeof(struct GNUNET_MessageHeader));
1075 traffic_sent += size;
1076 th = GNUNET_TRANSPORT_notify_transmit_ready (handle, &pid,
1078 GNUNET_TIME_UNIT_FOREVER_REL,
1079 &transmit_data, NULL);
1081 FPRINTF (stdout, _("Transmitting %u bytes to %s\n"), (unsigned int) size,
1088 * Function called to notify transport users that another
1089 * peer connected to us.
1091 * @param cls closure
1092 * @param peer the peer that connected
1095 notify_connect (void *cls,
1096 const struct GNUNET_PeerIdentity *peer)
1098 if (0 != memcmp (&pid, peer, sizeof(struct GNUNET_PeerIdentity)))
1103 /* all done, terminate instantly */
1104 FPRINTF (stdout, _("Successfully connected to `%s'\n"),
1105 GNUNET_i2s_full (peer));
1108 if (NULL != op_timeout)
1110 GNUNET_SCHEDULER_cancel (op_timeout);
1115 GNUNET_SCHEDULER_cancel (end);
1116 end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
1121 if (NULL != op_timeout)
1123 GNUNET_SCHEDULER_cancel (op_timeout);
1128 _("Successfully connected to `%s', starting to send benchmark data in %u Kb blocks\n"),
1129 GNUNET_i2s (&pid), BLOCKSIZE);
1130 start_time = GNUNET_TIME_absolute_get ();
1132 th = GNUNET_TRANSPORT_notify_transmit_ready (handle, peer,
1134 GNUNET_TIME_UNIT_FOREVER_REL,
1145 * Function called to notify transport users that another
1146 * peer disconnected from us.
1148 * @param cls closure
1149 * @param peer the peer that disconnected
1152 notify_disconnect (void *cls,
1153 const struct GNUNET_PeerIdentity *peer)
1155 if (0 != memcmp (&pid, peer, sizeof(struct GNUNET_PeerIdentity)))
1160 /* all done, terminate instantly */
1161 FPRINTF (stdout, _("Successfully disconnected from `%s'\n"),
1162 GNUNET_i2s_full (peer));
1165 if (NULL != op_timeout)
1167 GNUNET_SCHEDULER_cancel (op_timeout);
1172 GNUNET_SCHEDULER_cancel (end);
1173 end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
1179 GNUNET_TRANSPORT_notify_transmit_ready_cancel (th);
1184 FPRINTF (stdout, _("Disconnected from peer `%s' while benchmarking\n"),
1187 GNUNET_SCHEDULER_cancel (end);
1194 * Function called to notify transport users that another
1195 * peer connected to us.
1197 * @param cls closure
1198 * @param peer the peer that connected
1201 monitor_notify_connect (void *cls,
1202 const struct GNUNET_PeerIdentity *peer)
1204 monitor_connect_counter++;
1205 struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
1206 const char *now_str = GNUNET_STRINGS_absolute_time_to_string (now);
1209 _("%24s: %-17s %4s (%u connections in total)\n"),
1213 monitor_connect_counter);
1218 * Function called to notify transport users that another
1219 * peer disconnected from us.
1221 * @param cls closure
1222 * @param peer the peer that disconnected
1225 monitor_notify_disconnect (void *cls,
1226 const struct GNUNET_PeerIdentity *peer)
1228 struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
1229 const char *now_str = GNUNET_STRINGS_absolute_time_to_string (now);
1231 GNUNET_assert(monitor_connect_counter > 0);
1232 monitor_connect_counter--;
1235 _("%24s: %-17s %4s (%u connections in total)\n"),
1237 _("Disconnected from"),
1239 monitor_connect_counter);
1244 * Function called by the transport for each received message.
1246 * @param cls closure
1247 * @param peer (claimed) identity of the other peer
1248 * @param message the message
1251 notify_receive (void *cls,
1252 const struct GNUNET_PeerIdentity *peer,
1253 const struct GNUNET_MessageHeader *message)
1255 if (benchmark_receive)
1257 if (GNUNET_MESSAGE_TYPE_DUMMY != ntohs (message->type))
1261 _("Received %u bytes from %s\n"),
1262 (unsigned int) ntohs (message->size),
1265 if (traffic_received == 0)
1266 start_time = GNUNET_TIME_absolute_get ();
1267 traffic_received += ntohs (message->size);
1274 resolve_peer_address (const struct GNUNET_PeerIdentity *id,
1275 const struct GNUNET_HELLO_Address *address,
1277 enum GNUNET_TRANSPORT_PeerState state,
1278 struct GNUNET_TIME_Absolute state_timeout);
1282 print_info (const struct GNUNET_PeerIdentity *id,
1283 const char *transport,
1285 enum GNUNET_TRANSPORT_PeerState state,
1286 struct GNUNET_TIME_Absolute state_timeout)
1289 if ( ((GNUNET_YES == iterate_connections) && (GNUNET_YES == iterate_all)) ||
1290 (GNUNET_YES == monitor_connections))
1293 _("Peer `%s': %s %s in state `%s' until %s\n"),
1295 (NULL == transport) ? "<none>" : transport,
1296 (NULL == transport) ? "<none>" : addr,
1297 GNUNET_TRANSPORT_ps2s (state),
1298 GNUNET_STRINGS_absolute_time_to_string (state_timeout));
1300 else if ( (GNUNET_YES == iterate_connections) &&
1301 (GNUNET_TRANSPORT_is_connected(state)))
1303 /* Only connected peers, skip state */
1305 _("Peer `%s': %s %s\n"),
1314 * Function called with a textual representation of an address. This
1315 * function will be called several times with different possible
1316 * textual representations, and a last time with @a address being NULL
1317 * to signal the end of the iteration. Note that @a address NULL
1318 * always is the last call, regardless of the value in @a res.
1320 * @param cls closure
1321 * @param address NULL on end of iteration,
1322 * otherwise 0-terminated printable UTF-8 string,
1323 * in particular an empty string if @a res is #GNUNET_NO
1324 * @param res result of the address to string conversion:
1325 * if #GNUNET_OK: conversion successful
1326 * if #GNUNET_NO: address was invalid (or not supported)
1327 * if #GNUNET_SYSERR: communication error (IPC error)
1330 process_peer_string (void *cls,
1331 const char *address,
1334 struct PeerResolutionContext *rc = cls;
1336 if (NULL != address)
1338 if (GNUNET_SYSERR == res)
1341 "Failed to convert address for peer `%s' plugin `%s' length %u to string \n",
1342 GNUNET_i2s (&rc->id),
1343 rc->addrcp->transport_name,
1344 (unsigned int) rc->addrcp->address_length);
1345 print_info (&rc->id,
1350 rc->printed = GNUNET_YES;
1353 if (GNUNET_OK == res)
1355 print_info (&rc->id,
1360 rc->printed = GNUNET_YES;
1361 return; /* Wait for done call */
1363 /* GNUNET_NO == res: ignore, was simply not supported */
1366 /* NULL == address, last call, we are done */
1368 GNUNET_assert (address_resolutions > 0);
1369 address_resolutions--;
1370 if (GNUNET_NO == rc->printed)
1372 if (numeric == GNUNET_NO)
1374 /* Failed to resolve address, try numeric lookup
1375 (note: this should not be needed, as transport
1376 should fallback to numeric conversion if DNS takes
1378 resolve_peer_address (&rc->id,
1386 print_info (&rc->id,
1393 GNUNET_free (rc->transport);
1394 GNUNET_free (rc->addrcp);
1395 GNUNET_CONTAINER_DLL_remove (rc_head, rc_tail, rc);
1397 if ((0 == address_resolutions) && (iterate_connections))
1401 GNUNET_SCHEDULER_cancel (end);
1404 if (NULL != op_timeout)
1406 GNUNET_SCHEDULER_cancel (op_timeout);
1410 end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
1416 resolve_peer_address (const struct GNUNET_PeerIdentity *id,
1417 const struct GNUNET_HELLO_Address *address,
1419 enum GNUNET_TRANSPORT_PeerState state,
1420 struct GNUNET_TIME_Absolute state_timeout)
1422 struct PeerResolutionContext *rc;
1424 rc = GNUNET_new (struct PeerResolutionContext);
1425 GNUNET_assert(NULL != rc);
1426 GNUNET_CONTAINER_DLL_insert(rc_head, rc_tail, rc);
1427 address_resolutions++;
1430 rc->transport = GNUNET_strdup(address->transport_name);
1431 rc->addrcp = GNUNET_HELLO_address_copy (address);
1432 rc->printed = GNUNET_NO;
1434 rc->state_timeout = state_timeout;
1435 /* Resolve address to string */
1436 rc->asc = GNUNET_TRANSPORT_address_to_string (cfg,
1440 &process_peer_string, rc);
1445 * Function called with information about a peers during a one shot iteration
1447 * @param cls closure
1448 * @param peer identity of the peer, NULL for final callback when operation done
1449 * @param address binary address used to communicate with this peer,
1450 * NULL on disconnect or when done
1451 * @param state current state this peer is in
1452 * @param state_timeout time out for the current state
1455 process_peer_iteration_cb (void *cls,
1456 const struct GNUNET_PeerIdentity *peer,
1457 const struct GNUNET_HELLO_Address *address,
1458 enum GNUNET_TRANSPORT_PeerState state,
1459 struct GNUNET_TIME_Absolute state_timeout)
1464 address_resolution_in_progress = GNUNET_NO;
1467 GNUNET_SCHEDULER_cancel (end);
1468 end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
1472 if ( (GNUNET_NO == iterate_all) &&
1473 (GNUNET_NO == GNUNET_TRANSPORT_is_connected(state)))
1474 return; /* Display only connected peers */
1476 if (NULL != op_timeout)
1477 GNUNET_SCHEDULER_cancel (op_timeout);
1478 op_timeout = GNUNET_SCHEDULER_add_delayed (OP_TIMEOUT,
1482 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1483 "Received address for peer `%s': %s\n",
1485 address->transport_name);
1487 if (NULL != address)
1488 resolve_peer_address (peer, address, numeric, state, state_timeout);
1490 print_info (peer, NULL, NULL, state, state_timeout);
1495 * Context for address resolution by #plugin_monitoring_cb().
1497 struct PluginMonitorAddress
1501 * Ongoing resolution request.
1503 struct GNUNET_TRANSPORT_AddressToStringContext *asc;
1506 * Resolved address as string.
1513 * Function called with a textual representation of an address. This
1514 * function will be called several times with different possible
1515 * textual representations, and a last time with @a address being NULL
1516 * to signal the end of the iteration. Note that @a address NULL
1517 * always is the last call, regardless of the value in @a res.
1519 * @param cls closure
1520 * @param address NULL on end of iteration,
1521 * otherwise 0-terminated printable UTF-8 string,
1522 * in particular an empty string if @a res is #GNUNET_NO
1523 * @param res result of the address to string conversion:
1524 * if #GNUNET_OK: conversion successful
1525 * if #GNUNET_NO: address was invalid (or not supported)
1526 * if #GNUNET_SYSERR: communication error (IPC error)
1529 address_cb (void *cls,
1530 const char *address,
1533 struct PluginMonitorAddress *addr = cls;
1535 if (NULL == address)
1540 if (NULL != addr->str)
1542 addr->str = GNUNET_strdup (address);
1547 * Function called by the plugin with information about the
1548 * current sessions managed by the plugin (for monitoring).
1550 * @param cls closure (NULL)
1551 * @param session session handle this information is about,
1552 * NULL to indicate that we are "in sync" (initial
1553 * iteration complete)
1554 * @param session_ctx storage location where the application
1555 * can store data; will point to NULL on #GNUNET_TRANSPORT_SS_INIT,
1556 * and must be reset to NULL on #GNUNET_TRANSPORT_SS_DONE
1557 * @param info information about the state of the session,
1558 * NULL if @a session is also NULL and we are
1559 * merely signalling that the initial iteration is over;
1560 * NULL with @a session being non-NULL if the monitor
1561 * was being cancelled while sessions were active
1564 plugin_monitoring_cb (void *cls,
1565 struct GNUNET_TRANSPORT_PluginSession *session,
1567 const struct GNUNET_TRANSPORT_SessionInfo *info)
1570 struct PluginMonitorAddress *addr;
1572 if ( (NULL == info) &&
1574 return; /* in sync with transport service */
1575 addr = *session_ctx;
1580 if (NULL != addr->asc)
1582 GNUNET_TRANSPORT_address_to_string_cancel (addr->asc);
1585 GNUNET_free_non_null (addr->str);
1587 *session_ctx = NULL;
1589 return; /* shutdown */
1591 if ( (NULL != cpid) &&
1592 (0 != memcmp (&info->address->peer,
1594 sizeof (struct GNUNET_PeerIdentity))) )
1595 return; /* filtered */
1598 addr = GNUNET_new (struct PluginMonitorAddress);
1599 addr->asc = GNUNET_TRANSPORT_address_to_string (cfg,
1602 GNUNET_TIME_UNIT_FOREVER_REL,
1605 *session_ctx = addr;
1607 switch (info->state)
1609 case GNUNET_TRANSPORT_SS_INIT:
1612 case GNUNET_TRANSPORT_SS_HANDSHAKE:
1613 state = "HANDSHAKE";
1615 case GNUNET_TRANSPORT_SS_UP:
1618 case GNUNET_TRANSPORT_SS_UPDATE:
1621 case GNUNET_TRANSPORT_SS_DONE:
1629 "%s: %s %s (# %u/%u b) blocked until %s timeout in %s [%s]\n",
1630 GNUNET_i2s (&info->address->peer),
1632 (info->is_inbound == GNUNET_YES) ? "<-" : ((info->is_inbound == GNUNET_NO) ? "->" : "<>"),
1633 info->num_msg_pending,
1634 info->num_bytes_pending,
1635 GNUNET_STRINGS_absolute_time_to_string (info->receive_delay),
1636 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (info->session_timeout),
1639 if (GNUNET_TRANSPORT_SS_DONE == info->state)
1641 if (NULL != addr->asc)
1643 GNUNET_TRANSPORT_address_to_string_cancel (addr->asc);
1646 GNUNET_free_non_null (addr->str);
1648 *session_ctx = NULL;
1654 * Function called with information about a peers
1656 * @param cls closure
1657 * @param peer identity of the peer, NULL for final callback when operation done
1658 * @param address binary address used to communicate with this peer,
1659 * NULL on disconnect or when done
1660 * @param state current state this peer is in
1661 * @param state_timeout time out for the current state
1665 process_peer_monitoring_cb (void *cls,
1666 const struct GNUNET_PeerIdentity *peer,
1667 const struct GNUNET_HELLO_Address *address,
1668 enum GNUNET_TRANSPORT_PeerState state,
1669 struct GNUNET_TIME_Absolute state_timeout)
1671 struct MonitoredPeer *m;
1677 _("Monitor disconnected from transport service. Reconnecting.\n"));
1681 if (NULL != op_timeout)
1682 GNUNET_SCHEDULER_cancel (op_timeout);
1683 op_timeout = GNUNET_SCHEDULER_add_delayed (OP_TIMEOUT,
1687 if (NULL == (m = GNUNET_CONTAINER_multipeermap_get (monitored_peers, peer)))
1689 m = GNUNET_new (struct MonitoredPeer);
1690 GNUNET_CONTAINER_multipeermap_put (monitored_peers, peer,
1691 m, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
1695 if ( (m->state == state) &&
1696 (m->state_timeout.abs_value_us == state_timeout.abs_value_us) &&
1697 ((NULL == address) && (NULL == m->address)))
1699 return; /* No real change */
1701 if ( (m->state == state) && ((NULL != address) && (NULL != m->address)) &&
1702 (0 == GNUNET_HELLO_address_cmp(m->address, address)))
1703 return; /* No real change */
1706 if (NULL != m->address)
1708 GNUNET_free (m->address);
1711 if (NULL != address)
1712 m->address = GNUNET_HELLO_address_copy (address);
1714 m->state_timeout = state_timeout;
1716 if (NULL != address)
1717 resolve_peer_address (peer,
1732 * Function called with our result of trying to connect to a peer
1733 * using the transport service. Will retry 10 times, and if we still
1734 * fail to connect terminate with an error message.
1737 * @param result #GNUNET_OK if we connected to the service
1740 try_connect_cb (void *cls,
1743 static int retries = 0;
1746 if (GNUNET_OK == result)
1751 tc_handle = GNUNET_TRANSPORT_try_connect (handle,
1759 _("Failed to send connect request to transport service\n"));
1761 GNUNET_SCHEDULER_cancel (end);
1763 end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
1768 * Function called with our result of trying to disconnect a peer
1769 * using the transport service. Will retry 10 times, and if we still
1770 * fail to disconnect, terminate with an error message.
1773 * @param result #GNUNET_OK if we connected to the service
1776 try_disconnect_cb (void *cls,
1779 static int retries = 0;
1782 if (GNUNET_OK == result)
1787 td_handle = GNUNET_TRANSPORT_try_disconnect (handle,
1793 FPRINTF (stderr, "%s",
1794 _("Failed to send disconnect request to transport service\n"));
1796 GNUNET_SCHEDULER_cancel (end);
1798 end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
1803 * Function called with the result of the check if the 'transport'
1804 * service is running.
1806 * @param cls closure with our configuration
1807 * @param result #GNUNET_YES if transport is running
1810 testservice_task (void *cls,
1816 if (GNUNET_YES != result)
1818 FPRINTF (stderr, _("Service `%s' is not running\n"), "transport");
1824 != GNUNET_CRYPTO_eddsa_public_key_from_string (cpid, strlen (cpid),
1827 FPRINTF (stderr, _("Failed to parse peer identity `%s'\n"), cpid);
1831 counter = benchmark_send + benchmark_receive + iterate_connections
1832 + monitor_connections + monitor_connects + try_connect + try_disconnect +
1833 + iterate_validation + monitor_validation + monitor_plugins;
1838 _("Multiple operations given. Please choose only one operation: %s, %s, %s, %s, %s, %s %s\n"),
1839 "connect", "benchmark send", "benchmark receive", "information",
1840 "monitor", "events", "plugins");
1846 _("No operation given. Please choose one operation: %s, %s, %s, %s, %s, %s, %s\n"),
1847 "connect", "benchmark send", "benchmark receive", "information",
1848 "monitor", "events", "plugins");
1852 if (try_connect) /* -C: Connect to peer */
1856 FPRINTF (stderr, _("Option `%s' makes no sense without option `%s'.\n"),
1861 handle = GNUNET_TRANSPORT_connect (cfg, NULL, NULL, ¬ify_receive,
1862 ¬ify_connect, ¬ify_disconnect);
1865 FPRINTF (stderr, "%s", _("Failed to connect to transport service\n"));
1869 tc_handle = GNUNET_TRANSPORT_try_connect (handle, &pid, try_connect_cb,
1871 if (NULL == tc_handle)
1873 FPRINTF (stderr, "%s",
1874 _("Failed to send request to transport service\n"));
1878 op_timeout = GNUNET_SCHEDULER_add_delayed (OP_TIMEOUT, &operation_timeout,
1882 else if (try_disconnect) /* -D: Disconnect from peer */
1886 FPRINTF (stderr, _("Option `%s' makes no sense without option `%s'.\n"),
1891 handle = GNUNET_TRANSPORT_connect (cfg, NULL, NULL, ¬ify_receive,
1892 ¬ify_connect, ¬ify_disconnect);
1895 FPRINTF (stderr, "%s", _("Failed to connect to transport service\n"));
1899 td_handle = GNUNET_TRANSPORT_try_disconnect (handle, &pid,
1902 if (NULL == td_handle)
1904 FPRINTF (stderr, "%s",
1905 _("Failed to send request to transport service\n"));
1909 op_timeout = GNUNET_SCHEDULER_add_delayed (OP_TIMEOUT, &operation_timeout,
1913 else if (benchmark_send) /* -s: Benchmark sending */
1917 FPRINTF (stderr, _("Option `%s' makes no sense without option `%s'.\n"),
1922 handle = GNUNET_TRANSPORT_connect (cfg, NULL, NULL,
1925 ¬ify_disconnect);
1928 FPRINTF (stderr, "%s", _("Failed to connect to transport service\n"));
1932 tc_handle = GNUNET_TRANSPORT_try_connect (handle,
1936 if (NULL == tc_handle)
1938 FPRINTF (stderr, "%s",
1939 _("Failed to send request to transport service\n"));
1943 start_time = GNUNET_TIME_absolute_get ();
1944 op_timeout = GNUNET_SCHEDULER_add_delayed (OP_TIMEOUT,
1948 else if (benchmark_receive) /* -b: Benchmark receiving */
1950 handle = GNUNET_TRANSPORT_connect (cfg, NULL, NULL, ¬ify_receive, NULL,
1954 FPRINTF (stderr, "%s", _("Failed to connect to transport service\n"));
1959 FPRINTF (stdout, "%s", _("Starting to receive benchmark data\n"));
1960 start_time = GNUNET_TIME_absolute_get ();
1963 else if (iterate_connections) /* -i: List information about peers once */
1965 address_resolution_in_progress = GNUNET_YES;
1966 pic = GNUNET_TRANSPORT_monitor_peers (cfg, (NULL == cpid) ? NULL : &pid,
1967 GNUNET_YES, TIMEOUT, &process_peer_iteration_cb, (void *) cfg);
1968 op_timeout = GNUNET_SCHEDULER_add_delayed (OP_TIMEOUT, &operation_timeout,
1971 else if (monitor_connections) /* -m: List information about peers continuously */
1973 monitored_peers = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO);
1974 address_resolution_in_progress = GNUNET_YES;
1975 pic = GNUNET_TRANSPORT_monitor_peers (cfg, (NULL == cpid) ? NULL : &pid,
1977 &process_peer_monitoring_cb, (void *) cfg);
1979 else if (monitor_plugins) /* -P: List information about plugins continuously */
1981 monitored_plugins = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO);
1982 pm = GNUNET_TRANSPORT_monitor_plugins (cfg,
1983 &plugin_monitoring_cb,
1986 else if (iterate_validation) /* -d: Print information about validations */
1988 vic = GNUNET_TRANSPORT_monitor_validation_entries (cfg,
1989 (NULL == cpid) ? NULL : &pid,
1990 GNUNET_YES, TIMEOUT,
1991 &process_validation_cb, (void *) cfg);
1993 else if (monitor_validation) /* -f: Print information about validations continuously */
1995 vic = GNUNET_TRANSPORT_monitor_validation_entries (cfg,
1996 (NULL == cpid) ? NULL : &pid,
1998 &process_validation_cb, (void *) cfg);
2000 else if (monitor_connects) /* -e : Monitor (dis)connect events continuously */
2002 monitor_connect_counter = 0;
2003 handle = GNUNET_TRANSPORT_connect (cfg, NULL, NULL, NULL,
2004 &monitor_notify_connect,
2005 &monitor_notify_disconnect);
2010 _("Failed to connect to transport service\n"));
2022 end = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
2029 * Main function that will be run by the scheduler.
2031 * @param cls closure
2032 * @param args remaining command-line arguments
2033 * @param cfgfile name of the configuration file used (for saving, can be NULL!)
2034 * @param mycfg configuration
2039 const char *cfgfile,
2040 const struct GNUNET_CONFIGURATION_Handle *mycfg)
2042 cfg = (struct GNUNET_CONFIGURATION_Handle *) mycfg;
2043 if (test_configuration)
2045 do_test_configuration (cfg);
2048 GNUNET_CLIENT_service_test ("transport", cfg, GNUNET_TIME_UNIT_SECONDS,
2049 &testservice_task, (void *) cfg);
2053 main (int argc, char * const *argv)
2056 static const struct GNUNET_GETOPT_CommandLineOption options[] = {
2058 gettext_noop ("print information for all peers (instead of only connected peers)"),
2059 0, &GNUNET_GETOPT_set_one, &iterate_all },
2060 { 'b', "benchmark", NULL,
2061 gettext_noop ("measure how fast we are receiving data from all peers (until CTRL-C)"),
2062 0, &GNUNET_GETOPT_set_one, &benchmark_receive },
2064 NULL, gettext_noop ("connect to a peer"), 0,
2065 &GNUNET_GETOPT_set_one, &try_connect },
2066 { 'D', "disconnect",
2067 NULL, gettext_noop ("disconnect to a peer"), 0,
2068 &GNUNET_GETOPT_set_one, &try_disconnect },
2069 { 'd', "validation", NULL,
2070 gettext_noop ("print information for all pending validations "),
2071 0, &GNUNET_GETOPT_set_one, &iterate_validation },
2072 { 'f', "monitorvalidation", NULL,
2073 gettext_noop ("print information for all pending validations continuously"),
2074 0, &GNUNET_GETOPT_set_one, &monitor_validation },
2075 { 'i', "information", NULL,
2076 gettext_noop ("provide information about all current connections (once)"),
2077 0, &GNUNET_GETOPT_set_one, &iterate_connections },
2078 { 'm', "monitor", NULL,
2079 gettext_noop ("provide information about all current connections (continuously)"),
2080 0, &GNUNET_GETOPT_set_one, &monitor_connections },
2081 { 'e', "events", NULL,
2082 gettext_noop ("provide information about all connects and disconnect events (continuously)"),
2083 0, &GNUNET_GETOPT_set_one, &monitor_connects },
2085 NULL, gettext_noop ("do not resolve hostnames"), 0,
2086 &GNUNET_GETOPT_set_one, &numeric },
2087 { 'p', "peer", "PEER",
2088 gettext_noop ("peer identity"), 1, &GNUNET_GETOPT_set_string,
2090 { 'P', "plugins", NULL,
2091 gettext_noop ("monitor plugin sessions"), 0, &GNUNET_GETOPT_set_one,
2093 { 's', "send", NULL, gettext_noop
2094 ("send data for benchmarking to the other peer (until CTRL-C)"), 0,
2095 &GNUNET_GETOPT_set_one, &benchmark_send },
2096 { 't', "test", NULL,
2097 gettext_noop ("test transport configuration (involves external server)"),
2098 0, &GNUNET_GETOPT_set_one, &test_configuration },
2099 GNUNET_GETOPT_OPTION_VERBOSE (&verbosity),
2100 GNUNET_GETOPT_OPTION_END
2103 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
2106 res = GNUNET_PROGRAM_run (argc, argv,
2108 gettext_noop ("Direct access to transport service."),
2111 GNUNET_free((void *) argv);
2112 if (GNUNET_OK == res)
2117 /* end of gnunet-transport.c */