Annotation of embedaddon/iperf/src/iperf_locale.c, revision 1.1
1.1 ! misho 1: /*---------------------------------------------------------------
! 2: * iperf, Copyright (c) 2014, 2016, The Regents of the University of
! 3: * California, through Lawrence Berkeley National Laboratory (subject
! 4: * to receipt of any required approvals from the U.S. Dept. of
! 5: * Energy). All rights reserved.
! 6: *
! 7: * If you have questions about your rights to use or distribute this
! 8: * software, please contact Berkeley Lab's Technology Transfer
! 9: * Department at TTD@lbl.gov.
! 10: *
! 11: * NOTICE. This software is owned by the U.S. Department of Energy.
! 12: * As such, the U.S. Government has been granted for itself and others
! 13: * acting on its behalf a paid-up, nonexclusive, irrevocable,
! 14: * worldwide license in the Software to reproduce, prepare derivative
! 15: * works, and perform publicly and display publicly. Beginning five
! 16: * (5) years after the date permission to assert copyright is obtained
! 17: * from the U.S. Department of Energy, and subject to any subsequent
! 18: * five (5) year renewals, the U.S. Government is granted for itself
! 19: * and others acting on its behalf a paid-up, nonexclusive,
! 20: * irrevocable, worldwide license in the Software to reproduce,
! 21: * prepare derivative works, distribute copies to the public, perform
! 22: * publicly and display publicly, and to permit others to do so.
! 23: *
! 24: * This code is distributed under a BSD style license, see the LICENSE
! 25: * file for complete information.
! 26: *
! 27: * Based on code that is:
! 28: *
! 29: * Copyright (c) 1999,2000,2001,2002,2003
! 30: * The Board of Trustees of the University of Illinois
! 31: * All Rights Reserved.
! 32: *---------------------------------------------------------------
! 33: * Permission is hereby granted, free of charge, to any person
! 34: * obtaining a copy of this software (Iperf) and associated
! 35: * documentation files (the "Software"), to deal in the Software
! 36: * without restriction, including without limitation the
! 37: * rights to use, copy, modify, merge, publish, distribute,
! 38: * sublicense, and/or sell copies of the Software, and to permit
! 39: * persons to whom the Software is furnished to do
! 40: * so, subject to the following conditions:
! 41: *
! 42: *
! 43: * Redistributions of source code must retain the above
! 44: * copyright notice, this list of conditions and
! 45: * the following disclaimers.
! 46: *
! 47: *
! 48: * Redistributions in binary form must reproduce the above
! 49: * copyright notice, this list of conditions and the following
! 50: * disclaimers in the documentation and/or other materials
! 51: * provided with the distribution.
! 52: *
! 53: *
! 54: * Neither the names of the University of Illinois, NCSA,
! 55: * nor the names of its contributors may be used to endorse
! 56: * or promote products derived from this Software without
! 57: * specific prior written permission.
! 58: *
! 59: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
! 60: * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
! 61: * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
! 62: * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTIBUTORS OR COPYRIGHT
! 63: * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
! 64: * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
! 65: * ARISING FROM, OUT OF OR IN CONNECTION WITH THE
! 66: * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
! 67: * ________________________________________________________________
! 68: * National Laboratory for Applied Network Research
! 69: * National Center for Supercomputing Applications
! 70: * University of Illinois at Urbana-Champaign
! 71: * http://www.ncsa.uiuc.edu
! 72: * ________________________________________________________________
! 73: *
! 74: * Locale.c
! 75: * by Ajay Tirumala <tirumala@ncsa.uiuc.edu>
! 76: * & Mark Gates <mgates@nlanr.net>
! 77: * -------------------------------------------------------------------
! 78: * Strings and other stuff that is locale specific.
! 79: * ------------------------------------------------------------------- */
! 80: #include "iperf_config.h"
! 81:
! 82: #include "version.h"
! 83:
! 84: #ifdef __cplusplus
! 85: extern "C"
! 86: {
! 87: #endif
! 88:
! 89:
! 90: /* -------------------------------------------------------------------
! 91: * usage
! 92: * ------------------------------------------------------------------- */
! 93:
! 94: const char usage_shortstr[] = "Usage: iperf [-s|-c host] [options]\n"
! 95: "Try `iperf --help' for more information.\n";
! 96:
! 97: const char usage_longstr[] = "Usage: iperf [-s|-c host] [options]\n"
! 98: " iperf [-h|--help] [-v|--version]\n\n"
! 99: "Server or Client:\n"
! 100: " -p, --port # server port to listen on/connect to\n"
! 101: " -f, --format [kmgKMG] format to report: Kbits, Mbits, KBytes, MBytes\n"
! 102: " -i, --interval # seconds between periodic bandwidth reports\n"
! 103: " -F, --file name xmit/recv the specified file\n"
! 104: #if defined(HAVE_CPU_AFFINITY)
! 105: " -A, --affinity n/n,m set CPU affinity\n"
! 106: #endif /* HAVE_CPU_AFFINITY */
! 107: " -B, --bind <host> bind to a specific interface\n"
! 108: " -V, --verbose more detailed output\n"
! 109: " -J, --json output in JSON format\n"
! 110: " --logfile f send output to a log file\n"
! 111: " -d, --debug emit debugging output\n"
! 112: " -v, --version show version information and quit\n"
! 113: " -h, --help show this message and quit\n"
! 114: "Server specific:\n"
! 115: " -s, --server run in server mode\n"
! 116: " -D, --daemon run the server as a daemon\n"
! 117: " -I, --pidfile file write PID file\n"
! 118: " -1, --one-off handle one client connection then exit\n"
! 119: "Client specific:\n"
! 120: " -c, --client <host> run in client mode, connecting to <host>\n"
! 121: #if defined(HAVE_SCTP)
! 122: " --sctp use SCTP rather than TCP\n"
! 123: " -X, --xbind <name> bind SCTP association to links\n"
! 124: " --nstreams # number of SCTP streams\n"
! 125: #endif /* HAVE_SCTP */
! 126: " -u, --udp use UDP rather than TCP\n"
! 127: " -b, --bandwidth #[KMG][/#] target bandwidth in bits/sec (0 for unlimited)\n"
! 128: " (default %d Mbit/sec for UDP, unlimited for TCP)\n"
! 129: " (optional slash and packet count for burst mode)\n"
! 130: " -t, --time # time in seconds to transmit for (default %d secs)\n"
! 131: " -n, --bytes #[KMG] number of bytes to transmit (instead of -t)\n"
! 132: " -k, --blockcount #[KMG] number of blocks (packets) to transmit (instead of -t or -n)\n"
! 133: " -l, --len #[KMG] length of buffer to read or write\n"
! 134: " (default %d KB for TCP, %d KB for UDP)\n"
! 135: " --cport <port> bind to a specific client port (TCP and UDP, default: ephemeral port)\n"
! 136: " -P, --parallel # number of parallel client streams to run\n"
! 137: " -R, --reverse run in reverse mode (server sends, client receives)\n"
! 138: " -w, --window #[KMG] set window size / socket buffer size\n"
! 139: #if defined(HAVE_TCP_CONGESTION)
! 140: " -C, --congestion <algo> set TCP congestion control algorithm (Linux and FreeBSD only)\n"
! 141: #endif /* HAVE_TCP_CONGESTION */
! 142: " -M, --set-mss # set TCP/SCTP maximum segment size (MTU - 40 bytes)\n"
! 143: " -N, --no-delay set TCP/SCTP no delay, disabling Nagle's Algorithm\n"
! 144: " -4, --version4 only use IPv4\n"
! 145: " -6, --version6 only use IPv6\n"
! 146: " -S, --tos N set the IP 'type of service'\n"
! 147: #if defined(HAVE_FLOWLABEL)
! 148: " -L, --flowlabel N set the IPv6 flow label (only supported on Linux)\n"
! 149: #endif /* HAVE_FLOWLABEL */
! 150: " -Z, --zerocopy use a 'zero copy' method of sending data\n"
! 151: " -O, --omit N omit the first n seconds\n"
! 152: " -T, --title str prefix every output line with this string\n"
! 153: " --get-server-output get results from server\n"
! 154: " --udp-counters-64bit use 64-bit counters in UDP test packets\n"
! 155: #if defined(HAVE_SO_MAX_PACING_RATE)
! 156: " --no-fq-socket-pacing disable fair-queuing based socket pacing\n"
! 157: " (Linux only)\n"
! 158: #endif
! 159:
! 160: #ifdef NOT_YET_SUPPORTED /* still working on these */
! 161: #endif
! 162:
! 163: "\n"
! 164: "[KMG] indicates options that support a K/M/G suffix for kilo-, mega-, or giga-\n"
! 165: "\n"
! 166: #ifdef PACKAGE_URL
! 167: "iperf3 homepage at: " PACKAGE_URL "\n"
! 168: #endif /* PACKAGE_URL */
! 169: #ifdef PACKAGE_BUGREPORT
! 170: "Report bugs to: " PACKAGE_BUGREPORT "\n"
! 171: #endif /* PACKAGE_BUGREPORT */
! 172: ;
! 173:
! 174: #ifdef OBSOLETE /* from old iperf: no longer supported. Add some of these back someday */
! 175: "-d, --dualtest Do a bidirectional test simultaneously\n"
! 176: "-L, --listenport # port to recieve bidirectional tests back on\n"
! 177: "-I, --stdin input the data to be transmitted from stdin\n"
! 178: "-F, --fileinput <name> input the data to be transmitted from a file\n"
! 179: "-r, --tradeoff Do a bidirectional test individually\n"
! 180: "-T, --ttl # time-to-live, for multicast (default 1)\n"
! 181: "-x, --reportexclude [CDMSV] exclude C(connection) D(data) M(multicast) S(settings) V(server) reports\n"
! 182: "-y, --reportstyle C report as a Comma-Separated Values\n"
! 183: #endif
! 184:
! 185: const char version[] = PACKAGE_STRING;
! 186:
! 187: /* -------------------------------------------------------------------
! 188: * settings
! 189: * ------------------------------------------------------------------- */
! 190:
! 191: const char seperator_line[] =
! 192: "------------------------------------------------------------\n";
! 193:
! 194: const char server_port[] =
! 195: "Server listening on %s port %d\n";
! 196:
! 197: const char client_port[] =
! 198: "Client connecting to %s, %s port %d\n";
! 199:
! 200: const char bind_address[] =
! 201: "Binding to local address %s\n";
! 202:
! 203: const char bind_port[] =
! 204: "Binding to local port %s\n";
! 205:
! 206: const char multicast_ttl[] =
! 207: "Setting multicast TTL to %d\n";
! 208:
! 209: const char join_multicast[] =
! 210: "Joining multicast group %s\n";
! 211:
! 212: const char client_datagram_size[] =
! 213: "Sending %d byte datagrams\n";
! 214:
! 215: const char server_datagram_size[] =
! 216: "Receiving %d byte datagrams\n";
! 217:
! 218: const char tcp_window_size[] =
! 219: "TCP window size";
! 220:
! 221: const char udp_buffer_size[] =
! 222: "UDP buffer size";
! 223:
! 224: const char window_default[] =
! 225: "(default)";
! 226:
! 227: const char wait_server_threads[] =
! 228: "Waiting for server threads to complete. Interrupt again to force quit.\n";
! 229:
! 230: const char test_start_time[] =
! 231: "Starting Test: protocol: %s, %d streams, %d byte blocks, omitting %d seconds, %d second test\n";
! 232:
! 233: const char test_start_bytes[] =
! 234: "Starting Test: protocol: %s, %d streams, %d byte blocks, omitting %d seconds, %llu bytes to send\n";
! 235:
! 236: const char test_start_blocks[] =
! 237: "Starting Test: protocol: %s, %d streams, %d byte blocks, omitting %d seconds, %d blocks to send\n";
! 238:
! 239:
! 240: /* -------------------------------------------------------------------
! 241: * reports
! 242: * ------------------------------------------------------------------- */
! 243:
! 244: const char report_time[] =
! 245: "Time: %s\n";
! 246:
! 247: const char report_connecting[] =
! 248: "Connecting to host %s, port %d\n";
! 249:
! 250: const char report_reverse[] =
! 251: "Reverse mode, remote host %s is sending\n";
! 252:
! 253: const char report_accepted[] =
! 254: "Accepted connection from %s, port %d\n";
! 255:
! 256: const char report_cookie[] =
! 257: " Cookie: %s\n";
! 258:
! 259: const char report_connected[] =
! 260: "[%3d] local %s port %d connected to %s port %d\n";
! 261:
! 262: const char report_window[] =
! 263: "TCP window size: %s\n";
! 264:
! 265: const char report_autotune[] =
! 266: "Using TCP Autotuning\n";
! 267:
! 268: const char report_omit_done[] =
! 269: "Finished omit period, starting real test\n";
! 270:
! 271: const char report_diskfile[] =
! 272: " Sent %s / %s (%d%%) of %s\n";
! 273:
! 274: const char report_done[] =
! 275: "iperf Done.\n";
! 276:
! 277: const char report_read_lengths[] =
! 278: "[%3d] Read lengths occurring in more than 5%% of reads:\n";
! 279:
! 280: const char report_read_length_times[] =
! 281: "[%3d] %5d bytes read %5d times (%.3g%%)\n";
! 282:
! 283: const char report_bw_header[] =
! 284: "[ ID] Interval Transfer Bandwidth\n";
! 285:
! 286: const char report_bw_retrans_header[] =
! 287: "[ ID] Interval Transfer Bandwidth Retr\n";
! 288:
! 289: const char report_bw_retrans_cwnd_header[] =
! 290: "[ ID] Interval Transfer Bandwidth Retr Cwnd\n";
! 291:
! 292: const char report_bw_udp_header[] =
! 293: "[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams\n";
! 294:
! 295: const char report_bw_udp_sender_header[] =
! 296: "[ ID] Interval Transfer Bandwidth Total Datagrams\n";
! 297:
! 298: const char report_bw_format[] =
! 299: "[%3d] %6.2f-%-6.2f sec %ss %ss/sec %s\n";
! 300:
! 301: const char report_bw_retrans_format[] =
! 302: "[%3d] %6.2f-%-6.2f sec %ss %ss/sec %3u %s\n";
! 303:
! 304: const char report_bw_retrans_cwnd_format[] =
! 305: "[%3d] %6.2f-%-6.2f sec %ss %ss/sec %3u %ss %s\n";
! 306:
! 307: const char report_bw_udp_format[] =
! 308: "[%3d] %6.2f-%-6.2f sec %ss %ss/sec %5.3f ms %d/%d (%.2g%%) %s\n";
! 309:
! 310: const char report_bw_udp_sender_format[] =
! 311: "[%3d] %6.2f-%-6.2f sec %ss %ss/sec %d %s\n";
! 312:
! 313: const char report_summary[] =
! 314: "Test Complete. Summary Results:\n";
! 315:
! 316: const char report_sum_bw_format[] =
! 317: "[SUM] %6.2f-%-6.2f sec %ss %ss/sec %s\n";
! 318:
! 319: const char report_sum_bw_retrans_format[] =
! 320: "[SUM] %6.2f-%-6.2f sec %ss %ss/sec %3d %s\n";
! 321:
! 322: const char report_sum_bw_udp_format[] =
! 323: "[SUM] %6.2f-%-6.2f sec %ss %ss/sec %5.3f ms %d/%d (%.2g%%) %s\n";
! 324:
! 325: const char report_sum_bw_udp_sender_format[] =
! 326: "[SUM] %6.2f-%-6.2f sec %ss %ss/sec %d %s\n";
! 327:
! 328: const char report_omitted[] = "(omitted)";
! 329:
! 330: const char report_bw_separator[] =
! 331: "- - - - - - - - - - - - - - - - - - - - - - - - -\n";
! 332:
! 333: const char report_outoforder[] =
! 334: "[%3d] %4.1f-%4.1f sec %d datagrams received out-of-order\n";
! 335:
! 336: const char report_sum_outoforder[] =
! 337: "[SUM] %4.1f-%4.1f sec %d datagrams received out-of-order\n";
! 338:
! 339: const char report_peer[] =
! 340: "[%3d] local %s port %u connected with %s port %u\n";
! 341:
! 342: const char report_mss_unsupported[] =
! 343: "[%3d] MSS and MTU size unknown (TCP_MAXSEG not supported by OS?)\n";
! 344:
! 345: const char report_mss[] =
! 346: "[%3d] MSS size %d bytes (MTU %d bytes, %s)\n";
! 347:
! 348: const char report_datagrams[] =
! 349: "[%3d] Sent %d datagrams\n";
! 350:
! 351: const char report_sum_datagrams[] =
! 352: "[SUM] Sent %d datagrams\n";
! 353:
! 354: const char server_reporting[] =
! 355: "[%3d] Server Report:\n";
! 356:
! 357: const char reportCSV_peer[] =
! 358: "%s,%u,%s,%u";
! 359:
! 360: const char report_cpu[] =
! 361: "CPU Utilization: %s/%s %.1f%% (%.1f%%u/%.1f%%s), %s/%s %.1f%% (%.1f%%u/%.1f%%s)\n";
! 362:
! 363: const char report_local[] = "local";
! 364: const char report_remote[] = "remote";
! 365: const char report_sender[] = "sender";
! 366: const char report_receiver[] = "receiver";
! 367:
! 368: #if defined(linux)
! 369: const char report_tcpInfo[] =
! 370: "event=TCP_Info CWND=%u SND_SSTHRESH=%u RCV_SSTHRESH=%u UNACKED=%u SACK=%u LOST=%u RETRANS=%u FACK=%u RTT=%u REORDERING=%u\n";
! 371: #endif
! 372: #if defined(__FreeBSD__)
! 373: const char report_tcpInfo[] =
! 374: "event=TCP_Info CWND=%u RCV_WIND=%u SND_SSTHRESH=%u RTT=%u\n";
! 375: #endif
! 376: #if defined(__NetBSD__)
! 377: const char report_tcpInfo[] =
! 378: "event=TCP_Info CWND=%u RCV_WIND=%u SND_SSTHRESH=%u RTT=%u\n";
! 379: #endif
! 380:
! 381:
! 382: #ifdef HAVE_QUAD_SUPPORT
! 383: #ifdef HAVE_PRINTF_QD
! 384: const char reportCSV_bw_format[] =
! 385: "%s,%s,%d,%.1f-%.1f,%qd,%qd\n";
! 386:
! 387: const char reportCSV_bw_udp_format[] =
! 388: "%s,%s,%d,%.1f-%.1f,%qd,%qd,%.3f,%d,%d,%.3f,%d\n";
! 389: #else // HAVE_PRINTF_QD
! 390: const char reportCSV_bw_format[] =
! 391: "%s,%s,%d,%.1f-%.1f,%lld,%lld\n";
! 392:
! 393: const char reportCSV_bw_udp_format[] =
! 394: "%s,%s,%d,%.1f-%.1f,%lld,%lld,%.3f,%d,%d,%.3f,%d\n";
! 395: #endif // HAVE_PRINTF_QD
! 396: #else // HAVE_QUAD_SUPPORT
! 397: #ifdef WIN32
! 398: const char reportCSV_bw_format[] =
! 399: "%s,%s,%d,%.1f-%.1f,%I64d,%I64d\n";
! 400:
! 401: const char reportCSV_bw_udp_format[] =
! 402: "%s,%s,%d,%.1f-%.1f,%I64d,%I64d,%.3f,%d,%d,%.3f,%d\n";
! 403: #else
! 404: const char reportCSV_bw_format[] =
! 405: "%s,%s,%d,%.1f-%.1f,%d,%d\n";
! 406:
! 407: const char reportCSV_bw_udp_format[] =
! 408: "%s,%s,%d,%.1f-%.1f,%d,%d,%.3f,%d,%d,%.3f,%d\n";
! 409: #endif //WIN32
! 410: #endif //HAVE_QUAD_SUPPORT
! 411: /* -------------------------------------------------------------------
! 412: * warnings
! 413: * ------------------------------------------------------------------- */
! 414:
! 415: const char warn_window_requested[] =
! 416: " (WARNING: requested %s)";
! 417:
! 418: const char warn_window_small[] =
! 419: "WARNING: TCP window size set to %d bytes. A small window size\n\
! 420: will give poor performance. See the Iperf documentation.\n";
! 421:
! 422: const char warn_delay_large[] =
! 423: "WARNING: delay too large, reducing from %.1f to 1.0 seconds.\n";
! 424:
! 425: const char warn_no_pathmtu[] =
! 426: "WARNING: Path MTU Discovery may not be enabled.\n";
! 427:
! 428: const char warn_no_ack[]=
! 429: "[%3d] WARNING: did not receive ack of last datagram after %d tries.\n";
! 430:
! 431: const char warn_ack_failed[]=
! 432: "[%3d] WARNING: ack of last datagram failed after %d tries.\n";
! 433:
! 434: const char warn_fileopen_failed[]=
! 435: "WARNING: Unable to open file stream for transfer\n\
! 436: Using default data stream. \n";
! 437:
! 438: const char unable_to_change_win[]=
! 439: "WARNING: Unable to change the window size\n";
! 440:
! 441: const char opt_estimate[]=
! 442: "Optimal Estimate\n";
! 443:
! 444: const char report_interval_small[] =
! 445: "WARNING: interval too small, increasing from %3.2f to 0.5 seconds.\n";
! 446:
! 447: const char warn_invalid_server_option[] =
! 448: "WARNING: option -%c is not valid for server mode\n";
! 449:
! 450: const char warn_invalid_client_option[] =
! 451: "WARNING: option -%c is not valid for client mode\n";
! 452:
! 453: const char warn_invalid_compatibility_option[] =
! 454: "WARNING: option -%c is not valid in compatibility mode\n";
! 455:
! 456: const char warn_implied_udp[] =
! 457: "WARNING: option -%c implies udp testing\n";
! 458:
! 459: const char warn_implied_compatibility[] =
! 460: "WARNING: option -%c has implied compatibility mode\n";
! 461:
! 462: const char warn_buffer_too_small[] =
! 463: "WARNING: the UDP buffer was increased to %d for proper operation\n";
! 464:
! 465: const char warn_invalid_single_threaded[] =
! 466: "WARNING: option -%c is not valid in single threaded versions\n";
! 467:
! 468: const char warn_invalid_report_style[] =
! 469: "WARNING: unknown reporting style \"%s\", switching to default\n";
! 470:
! 471: const char warn_invalid_report[] =
! 472: "WARNING: unknown reporting type \"%c\", ignored\n valid options are:\n\t exclude: C(connection) D(data) M(multicast) S(settings) V(server) report\n\n";
! 473:
! 474: #ifdef __cplusplus
! 475: } /* end extern "C" */
! 476: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>