--- /dev/null
+.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)
#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.
{
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);
{
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);
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;
}
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)))
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))) &&
{
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);
{'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 ==