]> sjero.net Git - iperf/blob - src/Locale.c
d6fb1f8b413c7a0bc79432f0490ad43dfc7000a9
[iperf] / src / Locale.c
1
2 /*--------------------------------------------------------------- 
3  * Copyright (c) 1999,2000,2001,2002,2003                              
4  * The Board of Trustees of the University of Illinois            
5  * All Rights Reserved.                                           
6  *--------------------------------------------------------------- 
7  * Permission is hereby granted, free of charge, to any person    
8  * obtaining a copy of this software (Iperf) and associated       
9  * documentation files (the "Software"), to deal in the Software  
10  * without restriction, including without limitation the          
11  * rights to use, copy, modify, merge, publish, distribute,        
12  * sublicense, and/or sell copies of the Software, and to permit     
13  * persons to whom the Software is furnished to do
14  * so, subject to the following conditions: 
15  *
16  *     
17  * Redistributions of source code must retain the above 
18  * copyright notice, this list of conditions and 
19  * the following disclaimers. 
20  *
21  *     
22  * Redistributions in binary form must reproduce the above 
23  * copyright notice, this list of conditions and the following 
24  * disclaimers in the documentation and/or other materials 
25  * provided with the distribution. 
26  * 
27  *     
28  * Neither the names of the University of Illinois, NCSA, 
29  * nor the names of its contributors may be used to endorse 
30  * or promote products derived from this Software without
31  * specific prior written permission. 
32  * 
33  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
34  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 
35  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
36  * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTIBUTORS OR COPYRIGHT 
37  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 
38  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 
39  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE
40  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
41  * ________________________________________________________________
42  * National Laboratory for Applied Network Research 
43  * National Center for Supercomputing Applications 
44  * University of Illinois at Urbana-Champaign 
45  * http://www.ncsa.uiuc.edu
46  * ________________________________________________________________ 
47  *
48  * Locale.c
49  * by Ajay Tirumala <tirumala@ncsa.uiuc.edu>
50  * & Mark Gates <mgates@nlanr.net>
51  * -------------------------------------------------------------------
52  * Strings and other stuff that is locale specific.
53  * ------------------------------------------------------------------- */
54 #include "version.h"
55 #ifdef HAVE_CONFIG_H
56 #include "config.h"
57 #else
58 #ifdef WIN32
59 #include "config.win32.h"
60 #endif
61 #endif
62
63 #ifdef __cplusplus
64 extern "C" {
65 #endif
66 /* -------------------------------------------------------------------
67  * usage
68  * ------------------------------------------------------------------- */
69
70 const char usage_short[] = "\
71 Usage: %s [-s|-c host] [options]\n\
72 Try `%s --help' for more information.\n";
73
74 #ifdef WIN32
75 const char usage_long1[] = "\
76 Usage: iperf [-s|-c host] [options]\n\
77        iperf [-h|--help] [-v|--version]\n\
78 \n\
79 Client/Server:\n\
80   -f, --format    [kmKM]   format to report: Kbits, Mbits, KBytes, MBytes\n\
81   -i, --interval  #        seconds between periodic bandwidth reports\n\
82   -l, --len       #[KM]    length of buffer to read or write (default 8 KB)\n\
83   -m, --print_mss          print TCP maximum segment size (MTU - TCP/IP header)\n\
84   -o, --output    <filename> output the report or error message to this specified file\n\
85   -p, --port      #        server port to listen on/connect to\n\
86   -u, --udp                use UDP rather than TCP\n\
87   -w, --window    #[KM]    TCP window size (socket buffer size)\n\
88   -B, --bind      <host>   bind to <host>, an interface or multicast address\n\
89   -C, --compatibility      for use with older versions does not sent extra msgs\n\
90   -M, --mss       #        set TCP maximum segment size (MTU - 40 bytes)\n\
91   -N, --nodelay            set TCP no delay, disabling Nagle's Algorithm\n\
92   -V, --IPv6Version        Set the domain to IPv6\n\
93 \n\
94 Server specific:\n\
95   -s, --server             run in server mode\n\
96   -U, --single_udp         run in single threaded UDP mode\n\
97   -D, --daemon             run the server as a daemon\n\
98   -R, --remove             remove service in win32\n";
99
100 const char usage_long2[] = "\
101 \n\
102 Client specific:\n\
103   -b, --bandwidth #[KM]    for UDP, bandwidth to send at in bits/sec\n\
104                            (default 1 Mbit/sec, implies -u)\n\
105   -c, --client    <host>   run in client mode, connecting to <host>\n\
106   -d, --dualtest           Do a bidirectional test simultaneously\n\
107   -n, --num       #[KM]    number of bytes to transmit (instead of -t)\n\
108   -r, --tradeoff           Do a bidirectional test individually\n\
109   -t, --time      #        time in seconds to transmit for (default 10 secs)\n\
110   -F, --fileinput <name>   input the data to be transmitted from a file\n\
111   -I, --stdin              input the data to be transmitted from stdin\n\
112   -L, --listenport #       port to recieve bidirectional tests back on\n\
113   -P, --parallel  #        number of parallel client threads to run\n\
114   -T, --ttl       #        time-to-live, for multicast (default 1)\n\
115 \n\
116 Miscellaneous:\n\
117   -h, --help               print this message and quit\n\
118   -v, --version            print version information and quit\n\
119 \n\
120 [KM] Indicates options that support a K or M suffix for kilo- or mega-\n\
121 \n\
122 The TCP window size option can be set by the environment variable\n\
123 TCP_WINDOW_SIZE. Most other options can be set by an environment variable\n\
124 IPERF_<long option name>, such as IPERF_BANDWIDTH.\n\
125 \n\
126 Report bugs to <dast@nlanr.net>\n";
127
128 #else
129 const char usage_long[] = "\
130 Usage: iperf [-s|-c host] [options]\n\
131        iperf [-h|--help] [-v|--version]\n\
132 \n\
133 Client/Server:\n\
134   -f, --format    [kmKM]   format to report: Kbits, Mbits, KBytes, MBytes\n\
135   -i, --interval  #        seconds between periodic bandwidth reports\n\
136   -l, --len       #[KM]    length of buffer to read or write (default 8 KB)\n\
137   -m, --print_mss          print TCP maximum segment size (MTU - TCP/IP header)\n\
138   -p, --port      #        server port to listen on/connect to\n\
139   -u, --udp                use UDP rather than TCP\n\
140   -w, --window    #[KM]    TCP window size (socket buffer size)\n\
141   -B, --bind      <host>   bind to <host>, an interface or multicast address\n\
142   -C, --compatibility      for use with older versions does not sent extra msgs\n\
143   -M, --mss       #        set TCP maximum segment size (MTU - 40 bytes)\n\
144   -N, --nodelay            set TCP no delay, disabling Nagle's Algorithm\n\
145   -V, --IPv6Version        Set the domain to IPv6\n\
146 \n\
147 Server specific:\n\
148   -s, --server             run in server mode\n\
149   -U, --single_udp         run in single threaded UDP mode\n\
150   -D, --daemon             run the server as a daemon\n\
151 \n\
152 Client specific:\n\
153   -b, --bandwidth #[KM]    for UDP, bandwidth to send at in bits/sec\n\
154                            (default 1 Mbit/sec, implies -u)\n\
155   -c, --client    <host>   run in client mode, connecting to <host>\n\
156   -d, --dualtest           Do a bidirectional test simultaneously\n\
157   -n, --num       #[KM]    number of bytes to transmit (instead of -t)\n\
158   -r, --tradeoff           Do a bidirectional test individually\n\
159   -t, --time      #        time in seconds to transmit for (default 10 secs)\n\
160   -F, --fileinput <name>   input the data to be transmitted from a file\n\
161   -I, --stdin              input the data to be transmitted from stdin\n\
162   -L, --listenport #       port to recieve bidirectional tests back on\n\
163   -P, --parallel  #        number of parallel client threads to run\n\
164   -T, --ttl       #        time-to-live, for multicast (default 1)\n\
165 \n\
166 Miscellaneous:\n\
167   -h, --help               print this message and quit\n\
168   -v, --version            print version information and quit\n\
169 \n\
170 [KM] Indicates options that support a K or M suffix for kilo- or mega-\n\
171 \n\
172 The TCP window size option can be set by the environment variable\n\
173 TCP_WINDOW_SIZE. Most other options can be set by an environment variable\n\
174 IPERF_<long option name>, such as IPERF_BANDWIDTH.\n\
175 \n\
176 Report bugs to <dast@nlanr.net>\n";
177 #endif
178
179 // include a description of the threading in the version
180 #if   defined( HAVE_POSIX_THREAD )
181     #define IPERF_THREADS "pthreads"
182 #elif defined( HAVE_WIN32_THREAD )
183     #define IPERF_THREADS "win32 threads"
184 #else
185     #define IPERF_THREADS "single threaded"
186 #endif
187
188 const char version[] =
189 "iperf version " IPERF_VERSION " (" IPERF_VERSION_DATE ") " IPERF_THREADS "\n";
190
191 /* -------------------------------------------------------------------
192  * settings
193  * ------------------------------------------------------------------- */
194
195 const char seperator_line[] =
196 "------------------------------------------------------------\n";
197
198 const char server_port[] =
199 "Server listening on %s port %d\n";
200
201 const char client_port[] =
202 "Client connecting to %s, %s port %d\n";
203
204 const char bind_address[] =
205 "Binding to local address %s\n";
206
207 const char multicast_ttl[] =
208 "Setting multicast TTL to %d\n";
209
210 const char join_multicast[] =
211 "Joining multicast group  %s\n";
212
213 const char client_datagram_size[] =
214 "Sending %d byte datagrams\n";
215
216 const char server_datagram_size[] =
217 "Receiving %d byte datagrams\n";
218
219 const char tcp_window_size[] =
220 "TCP window size";
221
222 const char udp_buffer_size[] =
223 "UDP buffer size";
224
225 const char window_default[] =
226 "(default)";
227
228 const char wait_server_threads[] =
229 "Waiting for server threads to complete. Interrupt again to force quit.\n";
230
231 /* -------------------------------------------------------------------
232  * reports
233  * ------------------------------------------------------------------- */
234
235 const char report_read_lengths[] =
236 "[%3d] Read lengths occurring in more than 5%% of reads:\n";
237
238 const char report_read_length_times[] =
239 "[%3d] %5d bytes read %5d times (%.3g%%)\n";
240
241 const char report_bw_header[] =
242 "[ ID] Interval       Transfer     Bandwidth\n";
243
244 const char report_bw_format[] =
245 "[%3d] %4.1f-%4.1f sec  %ss  %ss/sec\n";
246
247 const char report_sum_bw_format[] =
248 "[SUM] %4.1f-%4.1f sec  %ss  %ss/sec\n";
249
250 const char report_bw_jitter_loss_header[] =
251 "[ ID] Interval       Transfer     Bandwidth       Jitter   Lost/Total \
252 Datagrams\n";
253
254 const char report_bw_jitter_loss_format[] =
255 "[%3d] %4.1f-%4.1f sec  %ss  %ss/sec  %5.3f ms %4d/%5d (%.2g%%)\n";
256
257 const char report_sum_bw_jitter_loss_format[] =
258 "[SUM] %4.1f-%4.1f sec  %ss  %ss/sec  %5.3f ms %4d/%5d (%.2g%%)\n";
259
260 const char report_outoforder[] =
261 "[%3d] %4.1f-%4.1f sec  %d datagrams received out-of-order\n";
262
263 const char report_sum_outoforder[] =
264 "[SUM] %4.1f-%4.1f sec  %d datagrams received out-of-order\n";
265
266 const char report_peer[] =
267 "[%3d] local %s port %u connected with %s port %u\n";
268
269 const char report_mss_unsupported[] =
270 "[%3d] MSS and MTU size unknown (TCP_MAXSEG not supported by OS?)\n";
271
272 const char report_mss[] =
273 "[%3d] MSS size %d bytes (MTU %d bytes, %s)\n";
274
275 const char report_datagrams[] =
276 "[%3d] Sent %d datagrams\n";
277
278 const char report_sum_datagrams[] =
279 "[SUM] Sent %d datagrams\n";
280
281 const char server_reporting[] =
282 "[%3d] Server Report:\n";
283
284 const char reportCSV_peer[] =
285 "%s,%u,%s,%u";
286
287 #ifdef HAVE_QUAD_SUPPORT
288 #ifdef HAVE_PRINTF_QD
289 const char reportCSV_bw_format[] =
290 "%s,%s,%d,%.1f-%.1f,%qd,%qd\n";
291
292 const char reportCSV_bw_jitter_loss_format[] =
293 "%s,%s,%d,%.1f-%.1f,%qd,%qd,%.3f,%d,%d,%.3f,%d\n";
294 #else // HAVE_PRINTF_QD
295 const char reportCSV_bw_format[] =
296 "%s,%s,%d,%.1f-%.1f,%lld,%lld\n";
297
298 const char reportCSV_bw_jitter_loss_format[] =
299 "%s,%s,%d,%.1f-%.1f,%lld,%lld,%.3f,%d,%d,%.3f,%d\n";
300 #endif // HAVE_PRINTF_QD
301 #else // HAVE_QUAD_SUPPORT
302 #ifdef WIN32
303 const char reportCSV_bw_format[] =
304 "%s,%s,%d,%.1f-%.1f,%I64d,%I64d\n";
305
306 const char reportCSV_bw_jitter_loss_format[] =
307 "%s,%s,%d,%.1f-%.1f,%I64d,%I64d,%.3f,%d,%d,%.3f,%d\n";
308 #else
309 const char reportCSV_bw_format[] =
310 "%s,%s,%d,%.1f-%.1f,%d,%d\n";
311
312 const char reportCSV_bw_jitter_loss_format[] =
313 "%s,%s,%d,%.1f-%.1f,%d,%d,%.3f,%d,%d,%.3f,%d\n";
314 #endif //WIN32
315 #endif //HAVE_QUAD_SUPPORT
316 /* -------------------------------------------------------------------
317  * warnings
318  * ------------------------------------------------------------------- */
319
320 const char warn_window_requested[] =
321 " (WARNING: requested %s)";
322
323 const char warn_window_small[] = "\
324 WARNING: TCP window size set to %d bytes. A small window size\n\
325 will give poor performance. See the Iperf documentation.\n";
326
327 const char warn_delay_large[] =
328 "WARNING: delay too large, reducing from %.1f to 1.0 seconds.\n";
329
330 const char warn_no_pathmtu[] =
331 "WARNING: Path MTU Discovery may not be enabled.\n";
332
333 const char warn_no_ack[]=
334 "[%3d] WARNING: did not receive ack of last datagram after %d tries.\n";
335
336 const char warn_ack_failed[]=
337 "[%3d] WARNING: ack of last datagram failed after %d tries.\n";
338
339 const char warn_fileopen_failed[]=
340 "WARNING: Unable to open file stream for transfer\n\
341 Using default data stream. \n";
342
343 const char unable_to_change_win[]=
344 "WARNING: Unable to change the window size\n";
345
346 const char opt_estimate[]=
347 "Optimal Estimate\n";
348
349 const char report_interval_small[] =
350 "WARNING: interval too small, increasing from %3.2f to 0.5 seconds.\n";
351
352 const char warn_invalid_server_option[] =
353 "WARNING: option -%c is not valid for server mode\n";
354
355 const char warn_invalid_client_option[] =
356 "WARNING: option -%c is not valid for client mode\n";
357
358 const char warn_invalid_compatibility_option[] =
359 "WARNING: option -%c is not valid in compatibility mode\n";
360
361 const char warn_implied_udp[] =
362 "WARNING: option -%c implies udp testing\n";
363
364 const char warn_implied_compatibility[] =
365 "WARNING: option -%c has implied compatibility mode\n";
366
367 const char warn_buffer_too_small[] =
368 "WARNING: the UDP buffer was increased to %d for proper operation\n";
369
370 const char warn_invalid_single_threaded[] =
371 "WARNING: option -%c is not valid in single threaded versions\n";
372
373 const char warn_invalid_report_style[] =
374 "WARNING: unknown reporting style \"%s\", switching to default\n";
375
376 const char warn_invalid_report[] =
377 "WARNING: unknown reporting type \"%c\"\n";
378
379 #ifdef __cplusplus
380 } /* end extern "C" */
381 #endif