From: Christian Grothoff Date: Wed, 26 Oct 2011 21:00:53 +0000 (+0000) Subject: documenting gnunet-transport a bit X-Git-Tag: initial-import-from-subversion-38251~16205 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=8ff0618cd174a9270d9bad688bdc4da45984067b;p=oweals%2Fgnunet.git documenting gnunet-transport a bit --- diff --git a/doc/man/Makefile.am b/doc/man/Makefile.am index dcc60e6fb..20575204f 100644 --- a/doc/man/Makefile.am +++ b/doc/man/Makefile.am @@ -8,6 +8,7 @@ man_MANS = \ gnunet-publish.1 \ gnunet-search.1 \ gnunet-statistics.1 \ + gnunet-transport.1 \ gnunet-unindex.1 \ gnunet-monkey.1 diff --git a/doc/man/gnunet-directory.1 b/doc/man/gnunet-directory.1 index 07732530a..1c3e244f3 100644 --- a/doc/man/gnunet-directory.1 +++ b/doc/man/gnunet-directory.1 @@ -1,4 +1,4 @@ -.TH gnunet-directory "1" "10 Dec 2009" "GNUnet" +.TH gnunet-directory "1" "26 Oct 2011" "GNUnet" .SH NAME gnunet\-directory \- display directories @@ -32,4 +32,4 @@ GNUnet directories use the (unregistered) mimetype \fBapplication/gnunet\-direct .SH "REPORTING BUGS" Report bugs by using mantis or by sending electronic mail to .SH "SEE ALSO" -\fBgnunet\-gtk\fP(1), \fBgnunet\-publish\fP(1), \fBgnunet\-search\fP(1), \fBgnunet\-download\fP(1) +\fBgnunet\-fs\-gtk\fP(1), \fBgnunet\-publish\fP(1), \fBgnunet\-search\fP(1), \fBgnunet\-download\fP(1) diff --git a/doc/man/gnunet-nat-server.1 b/doc/man/gnunet-nat-server.1 index e8f47b75c..a35ad3b01 100644 --- a/doc/man/gnunet-nat-server.1 +++ b/doc/man/gnunet-nat-server.1 @@ -28,8 +28,8 @@ Note that gnunet\-nat\-server could be run via gnunet\-arm but typically is not. Use the configuration file FILENAME. .SH BUGS -Report bugs by using Mantis or by sending electronic mail to +Report bugs by using Mantis or by sending electronic mail to .SH SEE ALSO -gnunet\-service\-transport(1) +gnunet\-transport(1) diff --git a/doc/man/gnunet-transport.1 b/doc/man/gnunet-transport.1 new file mode 100644 index 000000000..7443219a3 --- /dev/null +++ b/doc/man/gnunet-transport.1 @@ -0,0 +1,44 @@ +.TH gnunet\-transport "1" "26 Oct 2011" "GNUnet" +.SH NAME +gnunet\-transport \- measure and control the transport subsystem + +.SH SYNOPSIS +.B gnunet\-transport +[\fIOPTIONS\fR] +.SH DESCRIPTION +.PP + +gnunet\-transport is a tool to access various functions of GNUnet's transport subsystem from the command\-line. Most of these are not expected to be useful for end-users. gnunet\-transport can be used to evaluate the performance of the transports, force a peer to connect to another peer (if possible). Other functions should be added in the near future. + +.TP +\fB\-b\fR, \fB\-\-benchmark\fR +measure how fast we are receiving data (from all connections). On exit, the data rate will be reported. Runs until aborted with CTRL-C. +.TP +\fB\-c \fIFILENAME\fR, \fB\-\-config=FILENAME\fR +configuration file to use +.TP +\fB\-C \fIPEER\fR, \fB\-\-connect=PEER\fR +peer to connect to (and to use for sending if used in conjunction with \-s) +.TP +\fB\-h\fR, \fB\-\-help\fR +print help page +.TP +\fB\-L \fILOGLEVEL\fR, \fB\-\-loglevel=LOGLEVEL\fR +Change the loglevel. Possible values for LOGLEVEL are ERROR, WARNING, INFO and DEBUG. +.TP +\fB\-s\fR, \fB\-\-send\fR +transmit (dummy) traffic as quickly as possible to the peer specified with the \-C option. The rate will still be limited by the quota(s) determined by the peers (ATS subsystem). Will run until CTRL\-C is pressed or until the connection to the other peer is disrupted. +.TP +\fB\-v\fR, \fB\-\-version\fR +print the version number +.TP +\fB\-V\fR, \fB\-\-verbose\fR +be verbose + +.SH NOTES + + +.SH "REPORTING BUGS" +Report bugs by using mantis or by sending electronic mail to +.SH "SEE ALSO" +\fBgnunet\-arm\fP(1) diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c index e8d1e3572..bc78e3d04 100644 --- a/src/transport/gnunet-transport.c +++ b/src/transport/gnunet-transport.c @@ -32,28 +32,68 @@ #include "gnunet_protocols.h" #include "gnunet_transport_service.h" +/** + * Which peer should we connect to? + */ static char *cpid; +/** + * Handle to transport service. + */ static struct GNUNET_TRANSPORT_Handle *handle; +/** + * Option -s. + */ static int benchmark_send; +/** + * Option -b. + */ static int benchmark_receive; +/** + * Global return value (0 success). + */ static int ret; +/** + * Number of bytes of traffic we received so far. + */ static unsigned long long traffic_received; +/** + * Number of bytes of traffic we sent so far. + */ static unsigned long long traffic_sent; +/** + * Starting time of transmitting/receiving data. + */ static struct GNUNET_TIME_Absolute start_time; +/** + * Handle for current transmission request. + */ static struct GNUNET_TRANSPORT_TransmitHandle *th; +/** + * Identity of the peer we transmit to / connect to. + * (equivalent to 'cpid' string). + */ static struct GNUNET_PeerIdentity pid; +/** + * Task scheduled for cleanup / termination of the process. + */ static GNUNET_SCHEDULER_TaskIdentifier end; +/** + * Selected level of verbosity. + */ +static int verbosity; + + /** * Shutdown, print statistics. @@ -74,7 +114,7 @@ do_disconnect (void *cls, { duration = GNUNET_TIME_absolute_get_duration (start_time); fprintf (stderr, - "Received %llu bytes/s (%llu bytes in %llu ms)\n", + _("Received %llu bytes/s (%llu bytes in %llu ms)\n"), 1000 * traffic_received / (1+duration.rel_value), traffic_received, (unsigned long long) duration.rel_value); @@ -83,7 +123,7 @@ do_disconnect (void *cls, { duration = GNUNET_TIME_absolute_get_duration (start_time); fprintf (stderr, - "Transmitted %llu bytes/s (%llu bytes in %llu ms)\n", + _("Transmitted %llu bytes/s (%llu bytes in %llu ms)\n"), 1000 * traffic_sent / (1+duration.rel_value), traffic_sent, (unsigned long long) duration.rel_value); @@ -120,10 +160,11 @@ transmit_data (void *cls, size_t size, 0, GNUNET_TIME_UNIT_FOREVER_REL, &transmit_data, NULL); - fprintf (stderr, - "Transmitting %u bytes to %s\n", - (unsigned int) size, - GNUNET_i2s (&pid)); + if (verbosity > 0) + fprintf (stderr, + _("Transmitting %u bytes to %s\n"), + (unsigned int) size, + GNUNET_i2s (&pid)); return size; } @@ -145,9 +186,10 @@ notify_connect (void *cls, GNUNET_ATS_Information * ats, uint32_t ats_count) { - fprintf (stderr, - "Connected to %s\n", - GNUNET_i2s (peer)); + if (verbosity > 0) + fprintf (stderr, + _("Connected to %s\n"), + GNUNET_i2s (peer)); if (0 != memcmp (&pid, peer, sizeof (struct GNUNET_PeerIdentity))) @@ -185,9 +227,10 @@ notify_disconnect (void *cls, const struct GNUNET_PeerIdentity * peer) { - fprintf (stderr, - "Disconnected from %s\n", - GNUNET_i2s (peer)); + if (verbosity > 0) + fprintf (stderr, + _("Disconnected from %s\n"), + GNUNET_i2s (peer)); if ( (0 == memcmp (&pid, peer, sizeof (struct GNUNET_PeerIdentity))) && @@ -224,10 +267,11 @@ notify_receive (void *cls, { if (! benchmark_receive) return; - fprintf (stderr, - "Received %u bytes from %s\n", - (unsigned int) ntohs (message->size), - GNUNET_i2s (peer)); + if (verbosity > 0) + fprintf (stderr, + _("Received %u bytes from %s\n"), + (unsigned int) ntohs (message->size), + GNUNET_i2s (peer)); if (traffic_received == 0) start_time = GNUNET_TIME_absolute_get (); traffic_received += ntohs (message->size); @@ -300,6 +344,7 @@ main (int argc, char *const *argv) {'s', "send", NULL, gettext_noop ("send data for benchmarking to the other peer (until CTRL-C)"), 0, &GNUNET_GETOPT_set_one, &benchmark_send}, + GNUNET_GETOPT_OPTION_VERBOSE(&verbosity), GNUNET_GETOPT_OPTION_END }; return (GNUNET_OK ==