documenting gnunet-transport a bit
authorChristian Grothoff <christian@grothoff.org>
Wed, 26 Oct 2011 21:00:53 +0000 (21:00 +0000)
committerChristian Grothoff <christian@grothoff.org>
Wed, 26 Oct 2011 21:00:53 +0000 (21:00 +0000)
doc/man/Makefile.am
doc/man/gnunet-directory.1
doc/man/gnunet-nat-server.1
doc/man/gnunet-transport.1 [new file with mode: 0644]
src/transport/gnunet-transport.c

index dcc60e6fbfd889838f0ff364cb6f2a9ee7ea1e87..20575204f599fe3d9118264de5def349ce8f8e7f 100644 (file)
@@ -8,6 +8,7 @@ man_MANS = \
   gnunet-publish.1 \
   gnunet-search.1 \
   gnunet-statistics.1 \
+  gnunet-transport.1 \
   gnunet-unindex.1 \
   gnunet-monkey.1
 
index 07732530a6e2e890d5d0b45050b01f4d4340c9fb..1c3e244f374ab76432ec6e96f5d9a19d71173201 100644 (file)
@@ -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 <https://gnunet.org/bugs/> or by sending electronic mail to <gnunet\-developers@gnu.org>
 .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)
index e8f47b75ca32ccb3e92910c5cede214409fc00b9..a35ad3b01aa0c5943280aed563432f815643fceb 100644 (file)
@@ -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 <https://gnunet.org/mantis/> or by sending electronic mail to <gnunet\-developers@gnu.org>
+Report bugs by using Mantis <https://gnunet.org/bugs/> or by sending electronic mail to <gnunet\-developers@gnu.org>
 
 .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 (file)
index 0000000..7443219
--- /dev/null
@@ -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 <https://gnunet.org/bugs/> or by sending electronic mail to <gnunet\-developers@gnu.org>
+.SH "SEE ALSO"
+\fBgnunet\-arm\fP(1)
index e8d1e3572014b895a683d74d2ec44315e9ee5948..bc78e3d0403fe0b3eac9532999c8bd0d3f26bde6 100644 (file)
 #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 ==