Updated the man page and help string so they correspond with the code.
This entailed some re-ordering, so the diff is large.
This commit is contained in:
parent
0569f7d192
commit
17666b94d9
30
src/iperf3.1
30
src/iperf3.1
@ -30,17 +30,24 @@ set server port to listen on/connect to to \fIn\fR (default 5201)
|
||||
.BR -i ", " --interval " \fIn\fR"
|
||||
pause \fIn\fR seconds between periodic bandwidth reports
|
||||
.TP
|
||||
.BR -h ", " --help " "
|
||||
print a help synopsis
|
||||
.BR -V ", " --verbose " "
|
||||
give more detailed output
|
||||
.TP
|
||||
.BR -d ", " --debug " "
|
||||
debug mode
|
||||
.TP
|
||||
.BR -v ", " --version " "
|
||||
print version information and quit
|
||||
show version information and quit
|
||||
.TP
|
||||
.BR -h ", " --help " "
|
||||
show a help synopsis
|
||||
|
||||
|
||||
.SH "SERVER SPECIFIC OPTIONS"
|
||||
.TP
|
||||
.BR -s ", " --server " "
|
||||
run in server mode
|
||||
.TP
|
||||
|
||||
|
||||
.SH "CLIENT SPECIFIC OPTIONS"
|
||||
@ -57,10 +64,10 @@ set target bandwidth to \fIn\fR bits/sec (default 1 Mbit/sec). Requires UDP mode
|
||||
.BR -t ", " --time " \fIn\fR"
|
||||
time in seconds to transmit for (default 10 secs)
|
||||
.TP
|
||||
.BR -n ", " --num " \fIn\fR[KM]"
|
||||
.BR -n ", " --bytes " \fIn\fR[KM]"
|
||||
number of bytes to transmit (instead of -t)
|
||||
.TP
|
||||
.BR -l ", " --len " \fIn\fR[KM]"
|
||||
.BR -l ", " --length " \fIn\fR[KM]"
|
||||
set length read/write buffer to \fIn\fR (default 128 KB)
|
||||
.TP
|
||||
.BR -P ", " --parallel " \fIn\fR"
|
||||
@ -72,11 +79,20 @@ run in reverse mode (server sends, client receives)
|
||||
.BR -w ", " --window " \fIn\fR[KM]"
|
||||
TCP window size (socket buffer size)
|
||||
.TP
|
||||
.BR -M ", " --mss " \fIn\fR"
|
||||
.BR -B ", " --bind " \fIn\fR[KM]"
|
||||
bind to a specific interface or multicast address
|
||||
.TP
|
||||
.BR -M ", " --set-mss " \fIn\fR"
|
||||
set TCP maximum segment size (MTU - 40 bytes)
|
||||
.TP
|
||||
.BR -N ", " --nodelay " "
|
||||
.BR -N ", " --no-delay " "
|
||||
set TCP no delay, disabling Nagle's Algorithm
|
||||
.TP
|
||||
.BR -6 ", " --version6 " "
|
||||
use IPv6
|
||||
.TP
|
||||
.BR -S ", " --tos " \fIn\fR"
|
||||
set the IP 'type of service'
|
||||
|
||||
|
||||
.SH DIAGNOSTICS
|
||||
|
187
src/iperf_api.c
187
src/iperf_api.c
@ -59,15 +59,14 @@ static cJSON *JSON_read(int fd);
|
||||
void
|
||||
usage()
|
||||
{
|
||||
fputs(usage_short, stderr);
|
||||
fputs(usage_shortstr, stderr);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
usage_long()
|
||||
{
|
||||
fputs(usage_long1, stderr);
|
||||
fputs(usage_long2, stderr);
|
||||
fputs(usage_longstr, stderr);
|
||||
}
|
||||
|
||||
|
||||
@ -334,28 +333,29 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
|
||||
{
|
||||
static struct option longopts[] =
|
||||
{
|
||||
{"client", required_argument, NULL, 'c'},
|
||||
{"server", no_argument, NULL, 's'},
|
||||
{"time", required_argument, NULL, 't'},
|
||||
{"port", required_argument, NULL, 'p'},
|
||||
{"parallel", required_argument, NULL, 'P'},
|
||||
{"udp", no_argument, NULL, 'u'},
|
||||
{"bind", required_argument, NULL, 'B'},
|
||||
{"bandwidth", required_argument, NULL, 'b'},
|
||||
{"length", required_argument, NULL, 'l'},
|
||||
{"window", required_argument, NULL, 'w'},
|
||||
{"format", required_argument, NULL, 'f'},
|
||||
{"interval", required_argument, NULL, 'i'},
|
||||
{"bytes", required_argument, NULL, 'n'},
|
||||
{"NoDelay", no_argument, NULL, 'N'},
|
||||
{"Set-mss", required_argument, NULL, 'M'},
|
||||
{"version", no_argument, NULL, 'v'},
|
||||
{"daemon", no_argument, NULL, 'D'},
|
||||
{"verbose", no_argument, NULL, 'V'},
|
||||
{"debug", no_argument, NULL, 'd'},
|
||||
{"help", no_argument, NULL, 'h'},
|
||||
{"daemon", no_argument, NULL, 'D'},
|
||||
{"format", required_argument, NULL, 'f'},
|
||||
{"version", no_argument, NULL, 'v'},
|
||||
{"server", no_argument, NULL, 's'},
|
||||
{"client", required_argument, NULL, 'c'},
|
||||
{"udp", no_argument, NULL, 'u'},
|
||||
{"bandwidth", required_argument, NULL, 'b'},
|
||||
{"time", required_argument, NULL, 't'},
|
||||
{"bytes", required_argument, NULL, 'n'},
|
||||
{"length", required_argument, NULL, 'l'},
|
||||
{"parallel", required_argument, NULL, 'P'},
|
||||
{"reverse", no_argument, NULL, 'R'},
|
||||
{"window", required_argument, NULL, 'w'},
|
||||
{"bind", required_argument, NULL, 'B'},
|
||||
{"set-mss", required_argument, NULL, 'M'},
|
||||
{"no-delay", no_argument, NULL, 'N'},
|
||||
{"version6", no_argument, NULL, '6'},
|
||||
{"tos", required_argument, NULL, 'S'},
|
||||
{"help", no_argument, NULL, 'h'},
|
||||
|
||||
/* XXX: The following ifdef needs to be split up. linux-congestion is not necessarily supported
|
||||
* by systems that support tos.
|
||||
@ -370,28 +370,73 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
|
||||
int blksize;
|
||||
|
||||
blksize = 0;
|
||||
while ((ch = getopt_long(argc, argv, "c:p:st:uP:B:b:l:w:i:n:RS:Nvh6VdM:f:", longopts, NULL)) != -1) {
|
||||
while ((ch = getopt_long(argc, argv, "p:f:i:DVdvsc:ub:t:n:l:P:Rw:B:M:N6S:h", longopts, NULL)) != -1) {
|
||||
switch (ch) {
|
||||
case 'c':
|
||||
if (test->role == 's') {
|
||||
i_errno = IESERVCLIENT;
|
||||
return -1;
|
||||
} else {
|
||||
test->role = 'c';
|
||||
test->server_hostname = (char *) malloc(strlen(optarg)+1);
|
||||
strncpy(test->server_hostname, optarg, strlen(optarg)+1);
|
||||
}
|
||||
break;
|
||||
case 'p':
|
||||
test->server_port = atoi(optarg);
|
||||
break;
|
||||
case 'f':
|
||||
test->settings->unit_format = *optarg;
|
||||
break;
|
||||
case 'i':
|
||||
/* XXX: could potentially want separate stat collection and reporting intervals,
|
||||
but just set them to be the same for now */
|
||||
test->stats_interval = atof(optarg);
|
||||
test->reporter_interval = atof(optarg);
|
||||
if (test->stats_interval > MAX_INTERVAL) {
|
||||
i_errno = IEINTERVAL;
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case 'D':
|
||||
if (test->role == 'c') {
|
||||
i_errno = IESERVCLIENT;
|
||||
return -1;
|
||||
}
|
||||
test->daemon = 1;
|
||||
break;
|
||||
case 'V':
|
||||
test->verbose = 1;
|
||||
break;
|
||||
case 'd':
|
||||
test->debug = 1;
|
||||
break;
|
||||
case 'v':
|
||||
fputs(version, stdout);
|
||||
system("uname -a");
|
||||
exit(0);
|
||||
case 's':
|
||||
if (test->role == 'c') {
|
||||
i_errno = IESERVCLIENT;
|
||||
return -1;
|
||||
} else {
|
||||
test->role = 's';
|
||||
}
|
||||
test->role = 's';
|
||||
break;
|
||||
case 'c':
|
||||
if (test->role == 's') {
|
||||
i_errno = IESERVCLIENT;
|
||||
return -1;
|
||||
}
|
||||
test->role = 'c';
|
||||
test->server_hostname = (char *) malloc(strlen(optarg)+1);
|
||||
strncpy(test->server_hostname, optarg, strlen(optarg)+1);
|
||||
break;
|
||||
case 'u':
|
||||
if (test->role == 's') {
|
||||
warning("ignoring client only argument --udp (-u)");
|
||||
/* XXX: made a warning
|
||||
i_errno = IECLIENTONLY;
|
||||
return -1;
|
||||
*/
|
||||
}
|
||||
set_protocol(test, Pudp);
|
||||
break;
|
||||
case 'b':
|
||||
if (test->role == 's') {
|
||||
i_errno = IECLIENTONLY;
|
||||
return -1;
|
||||
}
|
||||
test->settings->rate = unit_atof(optarg);
|
||||
break;
|
||||
case 't':
|
||||
if (test->role == 's') {
|
||||
@ -404,15 +449,19 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case 'u':
|
||||
case 'n':
|
||||
if (test->role == 's') {
|
||||
warning("ignoring client only argument --udp (-u)");
|
||||
/* XXX: made a warning
|
||||
i_errno = IECLIENTONLY;
|
||||
return -1;
|
||||
*/
|
||||
}
|
||||
set_protocol(test, Pudp);
|
||||
test->settings->bytes = unit_atoi(optarg);
|
||||
break;
|
||||
case 'l':
|
||||
if (test->role == 's') {
|
||||
i_errno = IECLIENTONLY;
|
||||
return -1;
|
||||
}
|
||||
blksize = unit_atoi(optarg);
|
||||
break;
|
||||
case 'P':
|
||||
if (test->role == 's') {
|
||||
@ -425,23 +474,12 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case 'B':
|
||||
test->bind_address = (char *) malloc(strlen(optarg)+1);
|
||||
strncpy(test->bind_address, optarg, strlen(optarg)+1);
|
||||
break;
|
||||
case 'b':
|
||||
case 'R':
|
||||
if (test->role == 's') {
|
||||
i_errno = IECLIENTONLY;
|
||||
return -1;
|
||||
}
|
||||
test->settings->rate = unit_atof(optarg);
|
||||
break;
|
||||
case 'l':
|
||||
if (test->role == 's') {
|
||||
i_errno = IECLIENTONLY;
|
||||
return -1;
|
||||
}
|
||||
blksize = unit_atoi(optarg);
|
||||
test->reverse = 1;
|
||||
break;
|
||||
case 'w':
|
||||
// XXX: This is a socket buffer, not specific to TCP
|
||||
@ -455,29 +493,9 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case 'i':
|
||||
/* XXX: could potentially want separate stat collection and reporting intervals,
|
||||
but just set them to be the same for now */
|
||||
test->stats_interval = atof(optarg);
|
||||
test->reporter_interval = atof(optarg);
|
||||
if (test->stats_interval > MAX_INTERVAL) {
|
||||
i_errno = IEINTERVAL;
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case 'n':
|
||||
if (test->role == 's') {
|
||||
i_errno = IECLIENTONLY;
|
||||
return -1;
|
||||
}
|
||||
test->settings->bytes = unit_atoi(optarg);
|
||||
break;
|
||||
case 'N':
|
||||
if (test->role == 's') {
|
||||
i_errno = IECLIENTONLY;
|
||||
return -1;
|
||||
}
|
||||
test->no_delay = 1;
|
||||
case 'B':
|
||||
test->bind_address = (char *) malloc(strlen(optarg)+1);
|
||||
strncpy(test->bind_address, optarg, strlen(optarg)+1);
|
||||
break;
|
||||
case 'M':
|
||||
if (test->role == 's') {
|
||||
@ -490,24 +508,15 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case 'f':
|
||||
test->settings->unit_format = *optarg;
|
||||
break;
|
||||
case '6':
|
||||
test->settings->domain = AF_INET6;
|
||||
break;
|
||||
case 'V':
|
||||
test->verbose = 1;
|
||||
break;
|
||||
case 'd':
|
||||
test->debug = 1;
|
||||
break;
|
||||
case 'R':
|
||||
case 'N':
|
||||
if (test->role == 's') {
|
||||
i_errno = IECLIENTONLY;
|
||||
return -1;
|
||||
}
|
||||
test->reverse = 1;
|
||||
test->no_delay = 1;
|
||||
break;
|
||||
case '6':
|
||||
test->settings->domain = AF_INET6;
|
||||
break;
|
||||
case 'S':
|
||||
if (test->role == 's') {
|
||||
@ -517,10 +526,6 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
|
||||
// XXX: Checking for errors in strtol is not portable. Leave as is?
|
||||
test->settings->tos = strtol(optarg, NULL, 0);
|
||||
break;
|
||||
case 'v':
|
||||
fputs(version, stdout);
|
||||
system("uname -a");
|
||||
exit(0);
|
||||
case 'h':
|
||||
default:
|
||||
usage_long();
|
||||
|
64
src/locale.c
64
src/locale.c
@ -58,61 +58,47 @@
|
||||
* usage
|
||||
* ------------------------------------------------------------------- */
|
||||
|
||||
const char usage_short[] = "Usage: iperf [-s|-c host] [options]\n"
|
||||
const char usage_shortstr[] = "Usage: iperf [-s|-c host] [options]\n"
|
||||
"Try `iperf --help' for more information.\n";
|
||||
|
||||
const char usage_long1[] = "Usage: iperf [-s|-c host] [options]\n"
|
||||
const char usage_longstr[] = "Usage: iperf [-s|-c host] [options]\n"
|
||||
" iperf [-h|--help] [-v|--version]\n\n"
|
||||
"Client/Server:\n"
|
||||
"Server or Client:\n"
|
||||
" -p, --port # server port to listen on/connect to\n"
|
||||
" -f, --format [kmgKMG] format to report: Kbits, Mbits, KBytes, MBytes\n"
|
||||
" -i, --interval # seconds between periodic bandwidth reports\n"
|
||||
" -l, --len #[KMG] length of buffer to read or write (default 8 KB)\n"
|
||||
" -m, --print_mss print TCP maximum segment size (MTU - TCP/IP header)\n"
|
||||
" -p, --port # server port to listen on/connect to\n"
|
||||
" -u, --udp use UDP rather than TCP\n"
|
||||
" -w, --window #[KMG] TCP window size (socket buffer size)\n"
|
||||
" -M, --mss # set TCP maximum segment size (MTU - 40 bytes)\n"
|
||||
" -N, --nodelay set TCP no delay, disabling Nagle's Algorithm\n"
|
||||
" -T, --tcpinfo Output detailed TCP info\n"
|
||||
" -v, --version print version information and quit\n"
|
||||
" -V, --verbose more verbose output\n"
|
||||
" -d, --debug debug mode\n"
|
||||
" -v, --version print version information and quit\n"
|
||||
" -h, --help print this message and quit\n"
|
||||
"Server specific:\n"
|
||||
" -s, --server run in server mode\n"
|
||||
"Client specific:\n"
|
||||
" -c, --client <host> run in client mode, connecting to <host>\n"
|
||||
" -u, --udp use UDP rather than TCP\n"
|
||||
" -b, --bandwidth #[KMG] for UDP, bandwidth to send at in bits/sec\n"
|
||||
" (default 1 Mbit/sec, implies -u)\n"
|
||||
" -t, --time # time in seconds to transmit for (default 10 secs)\n"
|
||||
" -n, --num #[KMG] number of bytes to transmit (instead of -t)\n"
|
||||
" -l, --len #[KMG] length of buffer to read or write (default 8 KB)\n"
|
||||
" -P, --parallel # number of parallel client threads to run\n"
|
||||
" -R, --reverse run in reverse mode (server sends, client receives)\n"
|
||||
" -w, --window #[KMG] TCP window size (socket buffer size)\n"
|
||||
" -B, --bind <host> bind to a specific interface or multicast address\n"
|
||||
" -M, --set-mss # set TCP maximum segment size (MTU - 40 bytes)\n"
|
||||
" -N, --nodelay set TCP no delay, disabling Nagle's Algorithm\n"
|
||||
" -6, --version6 use IPv6\n"
|
||||
" -S, --tos N set the IP 'type of service'\n"
|
||||
|
||||
#ifdef NOT_YET_SUPPORTED /* still working on these */
|
||||
" -S, --tos N set IP 'Type of Service' bit\n"
|
||||
" -Z, --linux-congestion <algo> set TCP congestion control algorithm (Linux only)\n"
|
||||
" -D, --daemon run the server as a daemon\n"
|
||||
" -6, --IPv6Version Set the domain to IPv6\n"
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef OBSOLETE /* no current plan to support */
|
||||
" -o, --output <filename> output the report or error message to this specified file\n"
|
||||
" -B, --bind <host> bind to <host>, an interface or multicast address\n"
|
||||
" -C, --compatibility for use with older versions does not sent extra msgs\n"
|
||||
#ifdef WIN32
|
||||
" -R, --remove remove service in win32\n"
|
||||
|
||||
#endif
|
||||
#endif
|
||||
;
|
||||
|
||||
|
||||
const char usage_long2[] = "Client specific:\n"
|
||||
" -b, --bandwidth #[KMG] for UDP, bandwidth to send at in bits/sec\n"
|
||||
" (default 1 Mbit/sec, implies -u)\n"
|
||||
" -c, --client <host> run in client mode, connecting to <host>\n"
|
||||
" -n, --num #[KMG] number of bytes to transmit (instead of -t)\n"
|
||||
" -t, --time # time in seconds to transmit for (default 10 secs)\n"
|
||||
" -P, --parallel # number of parallel client threads to run\n"
|
||||
" -T, --tcpinfo Output detailed TCP info (Linux and FreeBSD only)\n\n"
|
||||
"Miscellaneous:\n"
|
||||
" -h, --help print this message and quit\n\n"
|
||||
"[KMG] Indicates options that support a K,M, or G suffix for kilo-, mega-, or giga-\n\n"
|
||||
"\n"
|
||||
"[KMG] indicates options that support a K/M/G suffix for kilo-, mega-, or giga-\n"
|
||||
"Report bugs to <iperf-users@lists.sourceforge.net>\n";
|
||||
|
||||
|
||||
#ifdef OBSOLETE /* from old iperf: no longer supported. Add some of these back someday */
|
||||
-d, --dualtest Do a bidirectional test simultaneously\n\
|
||||
-L, --listenport # port to recieve bidirectional tests back on\n\
|
||||
|
@ -10,9 +10,8 @@
|
||||
#ifndef IPERF_LOCALE_H
|
||||
#define IPERF_LOCALE_H
|
||||
|
||||
extern const char usage_short[];
|
||||
extern const char usage_long1[];
|
||||
extern const char usage_long2[];
|
||||
extern const char usage_shortstr[];
|
||||
extern const char usage_longstr[];
|
||||
extern const char version[];
|
||||
|
||||
extern const char seperator_line[];
|
||||
|
Loading…
Reference in New Issue
Block a user