1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251
|
/*
Copyright (C) 1993,1994,1995 Hewlett-Packard Company
ALL RIGHTS RESERVED.
The enclosed software and documention includes copyrighted works of
Hewlett-Packard Co. For as long as you comply with the following
limitations, you are hereby authorized to (i) use, reproduce, and
modify the software and documentation, and to (ii) distribute the
software and documentation, including modifications, for
non-commercial purposes only.
1. The enclosed software and documentation is made available at no
charge in order to advance the general development of
high-performance networking products.
2. You may not delete any copyright notices contained in the
software or documentation. All hard copies, and copies in
source code or object code form, of the software or
documentation (including modifications) must contain at least
one of the copyright notices.
3. The enclosed software and documentation has not been subjected
to testing and quality control and is not a Hewlett-Packard Co.
product. At a future time, Hewlett-Packard Co. may or may not
offer a version of the software and documentation as a product.
4. THE SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS".
HEWLETT-PACKARD COMPANY DOES NOT WARRANT THAT THE USE,
REPRODUCTION, MODIFICATION OR DISTRIBUTION OF THE SOFTWARE OR
DOCUMENTATION WILL NOT INFRINGE A THIRD PARTY'S INTELLECTUAL
PROPERTY RIGHTS. HP DOES NOT WARRANT THAT THE SOFTWARE OR
DOCUMENTATION IS ERROR FREE. HP DISCLAIMS ALL WARRANTIES,
EXPRESS AND IMPLIED, WITH REGARD TO THE SOFTWARE AND THE
DOCUMENTATION. HP SPECIFICALLY DISCLAIMS ALL WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
5. HEWLETT-PACKARD COMPANY WILL NOT IN ANY EVENT BE LIABLE FOR ANY
DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
(INCLUDING LOST PROFITS) RELATED TO ANY USE, REPRODUCTION,
MODIFICATION, OR DISTRIBUTION OF THE SOFTWARE OR DOCUMENTATION.
*/
char netperf_id[]="\
@(#)netperf.c (c) Copyright 1993, 1994 Hewlett-Packard Company. Version 2.1";
#include <stdio.h>
#include <stdlib.h>
#ifdef WIN32
#include <windows.h>
#include <winsock.h>
#endif /* WIN32 */
#include "netsh.h"
#include "netlib.h"
#include "nettest_bsd.h"
#ifdef DO_UNIX
#include "nettest_unix.h"
#endif /* DO_UNIX */
#ifdef DO_FORE
#include "nettest_fore.h"
#endif /* DO_FORE */
#ifdef DO_HIPPI
#include "nettest_hippi.h"
#endif /* DO_HIPPI */
#ifdef DO_XTI
#include "nettest_xti.h"
#endif /* DO_XTI */
#ifdef DO_DLPI
#include "nettest_dlpi.h"
#endif /* DO_DLPI */
#ifdef DO_IPV6
#include "nettest_ipv6.h"
#endif /* DO_IPV6 */
/* this file contains the main for the netperf program. all the other */
/* routines can be found in the file netsh.c */
int
main(argc,argv)
int argc;
char *argv[];
{
#ifdef WIN32
WSADATA wsa_data ;
/* Initialise the wsock lib ( version 1.1 ) */
if ( WSAStartup(0x0101,&wsa_data) == SOCKET_ERROR ){
printf("WSAStartup() fauled : %d\n",GetLastError()) ;
return 1 ;
}
#endif /* WIN32 */
netlib_init();
set_defaults();
scan_cmd_line(argc,argv);
if (debug) {
dump_globals();
install_signal_catchers();
}
if (debug) {
printf("remotehost is %s and port %d\n",host_name,test_port);
fflush(stdout);
}
establish_control(host_name,test_port);
if (strcmp(test_name,"TCP_STREAM") == 0) {
send_tcp_stream(host_name);
}
else if (strcmp(test_name,"TCP_RR") == 0) {
send_tcp_rr(host_name);
}
else if (strcmp(test_name,"TCP_CRR") == 0) {
send_tcp_conn_rr(host_name);
}
else if (strcmp(test_name,"TCP_CC") == 0) {
send_tcp_cc(host_name);
}
#ifdef DO_1644
else if (strcmp(test_name,"TCP_TRR") == 0) {
send_tcp_tran_rr(host_name);
}
#endif /* DO_1644 */
#ifdef DO_NBRR
else if (strcmp(test_name,"TCP_NBRR") == 0) {
send_tcp_nbrr(host_name);
}
#endif /* DO_NBRR */
else if (strcmp(test_name,"UDP_STREAM") == 0) {
send_udp_stream(host_name);
}
else if (strcmp(test_name,"UDP_RR") == 0) {
send_udp_rr(host_name);
}
else if (strcmp(test_name,"LOC_CPU") == 0) {
loc_cpu_rate();
}
else if (strcmp(test_name,"REM_CPU") == 0) {
rem_cpu_rate();
}
#ifdef DO_DLPI
else if (strcmp(test_name,"DLCO_RR") == 0) {
send_dlpi_co_rr();
}
else if (strcmp(test_name,"DLCL_RR") == 0) {
send_dlpi_cl_rr();
}
else if (strcmp(test_name,"DLCO_STREAM") == 0) {
send_dlpi_co_stream();
}
else if (strcmp(test_name,"DLCL_STREAM") == 0) {
send_dlpi_cl_stream();
}
#endif /* DO_DLPI */
#ifdef DO_UNIX
else if (strcmp(test_name,"STREAM_RR") == 0) {
send_stream_rr();
}
else if (strcmp(test_name,"DG_RR") == 0) {
send_dg_rr();
}
else if (strcmp(test_name,"STREAM_STREAM") == 0) {
send_stream_stream();
}
else if (strcmp(test_name,"DG_STREAM") == 0) {
send_dg_stream();
}
#endif /* DO_UNIX */
#ifdef DO_FORE
else if (strcmp(test_name,"FORE_STREAM") == 0) {
send_fore_stream(host_name);
}
else if (strcmp(test_name,"FORE_RR") == 0) {
send_fore_rr(host_name);
}
#endif /* DO_FORE */
#ifdef DO_HIPPI
else if (strcmp(test_name,"HIPPI_STREAM") == 0) {
send_hippi_stream(host_name);
}
else if (strcmp(test_name,"HIPPI_RR") == 0) {
send_hippi_rr(host_name);
}
#endif /* DO_HIPPI */
#ifdef DO_XTI
else if (strcmp(test_name,"XTI_TCP_STREAM") == 0) {
send_xti_tcp_stream(host_name);
}
else if (strcmp(test_name,"XTI_TCP_RR") == 0) {
send_xti_tcp_rr(host_name);
}
else if (strcmp(test_name,"XTI_UDP_STREAM") == 0) {
send_xti_udp_stream(host_name);
}
else if (strcmp(test_name,"XTI_UDP_RR") == 0) {
send_xti_udp_rr(host_name);
}
#endif /* DO_XTI */
#ifdef DO_LWP
else if (strcmp(test_name,"LWPSTR_STREAM") == 0) {
send_lwpstr_stream(host_name);
}
else if (strcmp(test_name,"LWPSTR_RR") == 0) {
send_lwpstr_rr(host_name);
}
else if (strcmp(test_name,"LWPDG_STREAM") == 0) {
send_lwpdg_stream(host_name);
}
else if (strcmp(test_name,"LWPDG_RR") == 0) {
send_lwpdg_rr(host_name);
}
#endif /* DO_LWP */
#ifdef DO_IPV6
else if (strcmp(test_name,"TCPIPV6_STREAM") == 0) {
send_tcpipv6_stream(host_name);
}
else if (strcmp(test_name,"TCPIPV6_RR") == 0) {
send_tcpipv6_rr(host_name);
}
else if (strcmp(test_name,"TCPIPV6_CRR") == 0) {
send_tcpipv6_rr(host_name);
}
else if (strcmp(test_name,"UDPIPV6_STREAM") == 0) {
send_udpipv6_stream(host_name);
}
else if (strcmp(test_name,"UDPIPV6_RR") == 0) {
send_udpipv6_rr(host_name);
}
#endif /* DO_IPV6 */
else {
printf("The test you requested is unknown to this netperf.\n");
printf("Please verify that you have the correct test name, \n");
printf("and that test family has been compiled into this netperf.\n");
exit(1);
}
shutdown_control();
return(0);
}
|