diff options
-rw-r--r-- | doc/man/Makefile.am | 1 | ||||
-rw-r--r-- | doc/man/gnunet-directory.1 | 4 | ||||
-rw-r--r-- | doc/man/gnunet-nat-server.1 | 4 | ||||
-rw-r--r-- | doc/man/gnunet-transport.1 | 44 | ||||
-rw-r--r-- | src/transport/gnunet-transport.c | 77 |
5 files changed, 110 insertions, 20 deletions
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 = \ | |||
8 | gnunet-publish.1 \ | 8 | gnunet-publish.1 \ |
9 | gnunet-search.1 \ | 9 | gnunet-search.1 \ |
10 | gnunet-statistics.1 \ | 10 | gnunet-statistics.1 \ |
11 | gnunet-transport.1 \ | ||
11 | gnunet-unindex.1 \ | 12 | gnunet-unindex.1 \ |
12 | gnunet-monkey.1 | 13 | gnunet-monkey.1 |
13 | 14 | ||
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 @@ | |||
1 | .TH gnunet-directory "1" "10 Dec 2009" "GNUnet" | 1 | .TH gnunet-directory "1" "26 Oct 2011" "GNUnet" |
2 | .SH NAME | 2 | .SH NAME |
3 | gnunet\-directory \- display directories | 3 | gnunet\-directory \- display directories |
4 | 4 | ||
@@ -32,4 +32,4 @@ GNUnet directories use the (unregistered) mimetype \fBapplication/gnunet\-direct | |||
32 | .SH "REPORTING BUGS" | 32 | .SH "REPORTING BUGS" |
33 | Report bugs by using mantis <https://gnunet.org/bugs/> or by sending electronic mail to <gnunet\-developers@gnu.org> | 33 | Report bugs by using mantis <https://gnunet.org/bugs/> or by sending electronic mail to <gnunet\-developers@gnu.org> |
34 | .SH "SEE ALSO" | 34 | .SH "SEE ALSO" |
35 | \fBgnunet\-gtk\fP(1), \fBgnunet\-publish\fP(1), \fBgnunet\-search\fP(1), \fBgnunet\-download\fP(1) | 35 | \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. | |||
28 | Use the configuration file FILENAME. | 28 | Use the configuration file FILENAME. |
29 | 29 | ||
30 | .SH BUGS | 30 | .SH BUGS |
31 | Report bugs by using Mantis <https://gnunet.org/mantis/> or by sending electronic mail to <gnunet\-developers@gnu.org> | 31 | Report bugs by using Mantis <https://gnunet.org/bugs/> or by sending electronic mail to <gnunet\-developers@gnu.org> |
32 | 32 | ||
33 | .SH SEE ALSO | 33 | .SH SEE ALSO |
34 | gnunet\-service\-transport(1) | 34 | gnunet\-transport(1) |
35 | 35 | ||
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 @@ | |||
1 | .TH gnunet\-transport "1" "26 Oct 2011" "GNUnet" | ||
2 | .SH NAME | ||
3 | gnunet\-transport \- measure and control the transport subsystem | ||
4 | |||
5 | .SH SYNOPSIS | ||
6 | .B gnunet\-transport | ||
7 | [\fIOPTIONS\fR] | ||
8 | .SH DESCRIPTION | ||
9 | .PP | ||
10 | |||
11 | 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. | ||
12 | |||
13 | .TP | ||
14 | \fB\-b\fR, \fB\-\-benchmark\fR | ||
15 | measure how fast we are receiving data (from all connections). On exit, the data rate will be reported. Runs until aborted with CTRL-C. | ||
16 | .TP | ||
17 | \fB\-c \fIFILENAME\fR, \fB\-\-config=FILENAME\fR | ||
18 | configuration file to use | ||
19 | .TP | ||
20 | \fB\-C \fIPEER\fR, \fB\-\-connect=PEER\fR | ||
21 | peer to connect to (and to use for sending if used in conjunction with \-s) | ||
22 | .TP | ||
23 | \fB\-h\fR, \fB\-\-help\fR | ||
24 | print help page | ||
25 | .TP | ||
26 | \fB\-L \fILOGLEVEL\fR, \fB\-\-loglevel=LOGLEVEL\fR | ||
27 | Change the loglevel. Possible values for LOGLEVEL are ERROR, WARNING, INFO and DEBUG. | ||
28 | .TP | ||
29 | \fB\-s\fR, \fB\-\-send\fR | ||
30 | 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. | ||
31 | .TP | ||
32 | \fB\-v\fR, \fB\-\-version\fR | ||
33 | print the version number | ||
34 | .TP | ||
35 | \fB\-V\fR, \fB\-\-verbose\fR | ||
36 | be verbose | ||
37 | |||
38 | .SH NOTES | ||
39 | |||
40 | |||
41 | .SH "REPORTING BUGS" | ||
42 | Report bugs by using mantis <https://gnunet.org/bugs/> or by sending electronic mail to <gnunet\-developers@gnu.org> | ||
43 | .SH "SEE ALSO" | ||
44 | \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 @@ | |||
32 | #include "gnunet_protocols.h" | 32 | #include "gnunet_protocols.h" |
33 | #include "gnunet_transport_service.h" | 33 | #include "gnunet_transport_service.h" |
34 | 34 | ||
35 | /** | ||
36 | * Which peer should we connect to? | ||
37 | */ | ||
35 | static char *cpid; | 38 | static char *cpid; |
36 | 39 | ||
40 | /** | ||
41 | * Handle to transport service. | ||
42 | */ | ||
37 | static struct GNUNET_TRANSPORT_Handle *handle; | 43 | static struct GNUNET_TRANSPORT_Handle *handle; |
38 | 44 | ||
45 | /** | ||
46 | * Option -s. | ||
47 | */ | ||
39 | static int benchmark_send; | 48 | static int benchmark_send; |
40 | 49 | ||
50 | /** | ||
51 | * Option -b. | ||
52 | */ | ||
41 | static int benchmark_receive; | 53 | static int benchmark_receive; |
42 | 54 | ||
55 | /** | ||
56 | * Global return value (0 success). | ||
57 | */ | ||
43 | static int ret; | 58 | static int ret; |
44 | 59 | ||
60 | /** | ||
61 | * Number of bytes of traffic we received so far. | ||
62 | */ | ||
45 | static unsigned long long traffic_received; | 63 | static unsigned long long traffic_received; |
46 | 64 | ||
65 | /** | ||
66 | * Number of bytes of traffic we sent so far. | ||
67 | */ | ||
47 | static unsigned long long traffic_sent; | 68 | static unsigned long long traffic_sent; |
48 | 69 | ||
70 | /** | ||
71 | * Starting time of transmitting/receiving data. | ||
72 | */ | ||
49 | static struct GNUNET_TIME_Absolute start_time; | 73 | static struct GNUNET_TIME_Absolute start_time; |
50 | 74 | ||
75 | /** | ||
76 | * Handle for current transmission request. | ||
77 | */ | ||
51 | static struct GNUNET_TRANSPORT_TransmitHandle *th; | 78 | static struct GNUNET_TRANSPORT_TransmitHandle *th; |
52 | 79 | ||
80 | /** | ||
81 | * Identity of the peer we transmit to / connect to. | ||
82 | * (equivalent to 'cpid' string). | ||
83 | */ | ||
53 | static struct GNUNET_PeerIdentity pid; | 84 | static struct GNUNET_PeerIdentity pid; |
54 | 85 | ||
86 | /** | ||
87 | * Task scheduled for cleanup / termination of the process. | ||
88 | */ | ||
55 | static GNUNET_SCHEDULER_TaskIdentifier end; | 89 | static GNUNET_SCHEDULER_TaskIdentifier end; |
56 | 90 | ||
91 | /** | ||
92 | * Selected level of verbosity. | ||
93 | */ | ||
94 | static int verbosity; | ||
95 | |||
96 | |||
57 | 97 | ||
58 | /** | 98 | /** |
59 | * Shutdown, print statistics. | 99 | * Shutdown, print statistics. |
@@ -74,7 +114,7 @@ do_disconnect (void *cls, | |||
74 | { | 114 | { |
75 | duration = GNUNET_TIME_absolute_get_duration (start_time); | 115 | duration = GNUNET_TIME_absolute_get_duration (start_time); |
76 | fprintf (stderr, | 116 | fprintf (stderr, |
77 | "Received %llu bytes/s (%llu bytes in %llu ms)\n", | 117 | _("Received %llu bytes/s (%llu bytes in %llu ms)\n"), |
78 | 1000 * traffic_received / (1+duration.rel_value), | 118 | 1000 * traffic_received / (1+duration.rel_value), |
79 | traffic_received, | 119 | traffic_received, |
80 | (unsigned long long) duration.rel_value); | 120 | (unsigned long long) duration.rel_value); |
@@ -83,7 +123,7 @@ do_disconnect (void *cls, | |||
83 | { | 123 | { |
84 | duration = GNUNET_TIME_absolute_get_duration (start_time); | 124 | duration = GNUNET_TIME_absolute_get_duration (start_time); |
85 | fprintf (stderr, | 125 | fprintf (stderr, |
86 | "Transmitted %llu bytes/s (%llu bytes in %llu ms)\n", | 126 | _("Transmitted %llu bytes/s (%llu bytes in %llu ms)\n"), |
87 | 1000 * traffic_sent / (1+duration.rel_value), | 127 | 1000 * traffic_sent / (1+duration.rel_value), |
88 | traffic_sent, | 128 | traffic_sent, |
89 | (unsigned long long) duration.rel_value); | 129 | (unsigned long long) duration.rel_value); |
@@ -120,10 +160,11 @@ transmit_data (void *cls, size_t size, | |||
120 | 0, | 160 | 0, |
121 | GNUNET_TIME_UNIT_FOREVER_REL, | 161 | GNUNET_TIME_UNIT_FOREVER_REL, |
122 | &transmit_data, NULL); | 162 | &transmit_data, NULL); |
123 | fprintf (stderr, | 163 | if (verbosity > 0) |
124 | "Transmitting %u bytes to %s\n", | 164 | fprintf (stderr, |
125 | (unsigned int) size, | 165 | _("Transmitting %u bytes to %s\n"), |
126 | GNUNET_i2s (&pid)); | 166 | (unsigned int) size, |
167 | GNUNET_i2s (&pid)); | ||
127 | return size; | 168 | return size; |
128 | } | 169 | } |
129 | 170 | ||
@@ -145,9 +186,10 @@ notify_connect (void *cls, | |||
145 | GNUNET_ATS_Information | 186 | GNUNET_ATS_Information |
146 | * ats, uint32_t ats_count) | 187 | * ats, uint32_t ats_count) |
147 | { | 188 | { |
148 | fprintf (stderr, | 189 | if (verbosity > 0) |
149 | "Connected to %s\n", | 190 | fprintf (stderr, |
150 | GNUNET_i2s (peer)); | 191 | _("Connected to %s\n"), |
192 | GNUNET_i2s (peer)); | ||
151 | if (0 != memcmp (&pid, | 193 | if (0 != memcmp (&pid, |
152 | peer, | 194 | peer, |
153 | sizeof (struct GNUNET_PeerIdentity))) | 195 | sizeof (struct GNUNET_PeerIdentity))) |
@@ -185,9 +227,10 @@ notify_disconnect (void *cls, | |||
185 | const struct | 227 | const struct |
186 | GNUNET_PeerIdentity * peer) | 228 | GNUNET_PeerIdentity * peer) |
187 | { | 229 | { |
188 | fprintf (stderr, | 230 | if (verbosity > 0) |
189 | "Disconnected from %s\n", | 231 | fprintf (stderr, |
190 | GNUNET_i2s (peer)); | 232 | _("Disconnected from %s\n"), |
233 | GNUNET_i2s (peer)); | ||
191 | if ( (0 == memcmp (&pid, | 234 | if ( (0 == memcmp (&pid, |
192 | peer, | 235 | peer, |
193 | sizeof (struct GNUNET_PeerIdentity))) && | 236 | sizeof (struct GNUNET_PeerIdentity))) && |
@@ -224,10 +267,11 @@ notify_receive (void *cls, | |||
224 | { | 267 | { |
225 | if (! benchmark_receive) | 268 | if (! benchmark_receive) |
226 | return; | 269 | return; |
227 | fprintf (stderr, | 270 | if (verbosity > 0) |
228 | "Received %u bytes from %s\n", | 271 | fprintf (stderr, |
229 | (unsigned int) ntohs (message->size), | 272 | _("Received %u bytes from %s\n"), |
230 | GNUNET_i2s (peer)); | 273 | (unsigned int) ntohs (message->size), |
274 | GNUNET_i2s (peer)); | ||
231 | if (traffic_received == 0) | 275 | if (traffic_received == 0) |
232 | start_time = GNUNET_TIME_absolute_get (); | 276 | start_time = GNUNET_TIME_absolute_get (); |
233 | traffic_received += ntohs (message->size); | 277 | traffic_received += ntohs (message->size); |
@@ -300,6 +344,7 @@ main (int argc, char *const *argv) | |||
300 | {'s', "send", NULL, | 344 | {'s', "send", NULL, |
301 | gettext_noop ("send data for benchmarking to the other peer (until CTRL-C)"), | 345 | gettext_noop ("send data for benchmarking to the other peer (until CTRL-C)"), |
302 | 0, &GNUNET_GETOPT_set_one, &benchmark_send}, | 346 | 0, &GNUNET_GETOPT_set_one, &benchmark_send}, |
347 | GNUNET_GETOPT_OPTION_VERBOSE(&verbosity), | ||
303 | GNUNET_GETOPT_OPTION_END | 348 | GNUNET_GETOPT_OPTION_END |
304 | }; | 349 | }; |
305 | return (GNUNET_OK == | 350 | return (GNUNET_OK == |