1 /*
2         Copyright (C) 1993-2012 Hewlett-Packard Company
3 */
4 
5 /* libraried performance include file 				*/
6 /* the define NOPERFEXTERN tels us not to re-define all the 	*/
7 
8 /* defines and defaults */
9 #define		HOSTNAMESIZE 	255
10 #define         PORTBUFSIZE     10
11 #define		DEFAULT_SIZE	32768
12 #define		HOST_NAME	"127.0.0.1"
13 #define		TEST_PORT	"12865"
14 
15 /* output controlling variables                                         */
16 #define 	DEBUG 0		/* debugging level			*/
17 #define 	VERBOSITY 0	/* verbosity level			*/
18 
19 /* the end-test conditions for the tests - either transactions, bytes,  */
20 /* or time. different vars used for clarity - space is cheap ;-)        */
21 #define 	TEST_TIME 10	/* test ends by time			*/
22 #define 	TEST_BYTES 0	/* test ends on byte count		*/
23 #define 	TEST_TRANS 0	/* test ends on tran count		*/
24 
25 /* the alignment conditions for the tests				*/
26 #define 	LOC_RECV_ALIGN	4	/* alignment for local receives	*/
27 #define 	LOC_SEND_ALIGN	4	/* alignment for local sends	*/
28 #define 	REM_RECV_ALIGN	4	/* alignment for remote receive	*/
29 #define 	REM_SEND_ALIGN	4	/* alignment for remote sends	*/
30 
31 /* which way are we going and what are we doing in this handbasket?-) */
32 #define NETPERF_XMIT 0x2
33 #define NETPERF_RECV 0x4
34 
35 #define NETPERF_IS_RR(x) (((x & NETPERF_XMIT) && (x & NETPERF_RECV)) || \
36 			  (!((x & NETPERF_XMIT) || (x & NETPERF_RECV))))
37 
38 #define NETPERF_RECV_ONLY(x) ((x & NETPERF_RECV) && !(x & NETPERF_XMIT))
39 
40 #define NETPERF_XMIT_ONLY(x) ((x & NETPERF_XMIT) && !(x & NETPERF_RECV))
41 
42 #define NETPERF_CC(x) (!(x & NETPERF_XMIT) && !(x & NETPERF_RECV))
43 
44 
45 /* misc defines for the hell of it					*/
46 #ifndef MAXLONG
47 #define 	MAXLONG  	4294967295UL
48 #endif /* MAXLONG */
49 
50 #ifdef WANT_DCCP
51 
52 /* include netinet/in.h to see if SOCK_DCCP and IPPROTO_DCCP are there */
53 #include <netinet/in.h>
54 
55 #ifndef SOCK_DCCP
56 #define DCCP_WARNING
57 #define SOCK_DCCP 6
58 #endif
59 
60 #ifndef IPPROTO_DCCP
61 #define DCCP_WARNING
62 #define IPPROTO_DCCP 33  /* defined by the IANA */
63 #endif
64 
65 #ifndef SOL_DCCP
66 #define DCCP_WARNING
67 #define SOL_DCCP 269
68 #endif
69 
70 #ifdef DCCP_WARNING
71 #warning This platform is missing one of sock_dccp ipproto_dccp or sol_dccp
72 #endif
73 
74 #endif
75 
76 #ifndef NETSH
77 extern char		*program; /* program invocation name		*/
78 extern char             *command_line;  /* how we were invoked          */
79 
80 extern char  *passphrase;
81 
82 /* stuff to say where this test is going                                */
83 extern char	host_name[HOSTNAMESIZE];/* remote host name or ip addr  */
84 extern char     local_host_name[HOSTNAMESIZE];
85 extern char	test_port[PORTBUFSIZE]; /* where is the test waiting    */
86 extern char     local_test_port[PORTBUFSIZE];
87 extern int      address_family;
88 extern int      local_address_family;
89 extern int      parse_address_family(char family_string[]);
90 extern int      parse_socket_type(char socket_string[]);
91 extern int      parse_protocol(char protocol_string[]);
92 extern int      parse_direction(char direction_string[]);
93 extern void     set_defaults();
94 extern void     scan_cmd_line(int argc, char *argv[]);
95 extern void     dump_globals();
96 extern void     break_args(char *s, char *arg1, char *arg2);
97 extern void     break_args_explicit(char *s, char *arg1, char *arg2);
98 extern void     break_args_explicit_sep(char *s, int sep, char *arg1, char *arg2);
99 extern void     print_netserver_usage();
100 
101 /* output controlling variables                                         */
102 extern int
103   debug,	    /* debugging level */
104   print_headers,    /* do/don't print test headers */
105   verbosity,	    /* verbosity level */
106   keep_histogram,   /* do we keep a histogram of interesting times? */
107   keep_statistics;  /* do we keep/calculate expensive statistics? */
108 
109 /* the end-test conditions for the tests - either transactions, bytes,  */
110 /* or time. different vars used for clarity - space is cheap ;-)        */
111 extern int
112   test_time,		/* test ends by time			*/
113   test_len_ticks,
114   test_bytes,		/* test ends on byte count		*/
115   test_trans;		/* test ends on tran count		*/
116 
117 /* wait time between control/data connection establishment and start
118    of data traffic  */
119 extern int wait_time_secs;
120 
121 /* the alignment conditions for the tests				*/
122 extern int
123   local_recv_align,	/* alignment for local receives		*/
124   local_send_align,	/* alignment for local sends		*/
125   remote_recv_align,	/* alignment for remote receives	*/
126   remote_send_align,	/* alignment for remote sends		*/
127   local_send_offset,
128   local_recv_offset,
129   remote_send_offset,
130   remote_recv_offset,
131   remote_send_width,
132   remote_recv_width;
133 
134 /* hoist these above the #if to deal with either netperf or netserver
135    configured for it */
136 
137 extern	int          interval_usecs;
138 extern  int          interval_wate;
139 extern	int	     interval_burst;
140 extern  int          remote_interval_usecs;
141 extern  int          remote_interval_burst;
142 
143 
144 #ifdef DIRTY
145 extern int	rem_dirty_count;
146 extern int	rem_clean_count;
147 extern int	loc_dirty_count;
148 extern int	loc_clean_count;
149 #endif /* DIRTY */
150 
151 /* stuff for confidence intervals */
152 
153 extern int  confidence_level;
154 extern int  iteration_min;
155 extern int  iteration_max;
156 extern int  result_confidence_only;
157 extern double interval;
158 extern double interval_pct;
159 
160 extern int cpu_binding_requested;
161 
162 /* stuff to control the bufferspace "width" */
163 extern int	send_width;
164 extern int      recv_width;
165 
166 /* control the socket priority */
167 extern int local_socket_prio;
168 extern int remote_socket_prio;
169 
170 extern int local_socket_tos;
171 extern int remote_socket_tos;
172 
173 /* address family */
174 extern int	af;
175 
176 /* different options for other things */
177 extern int
178   local_cpu_usage,
179   remote_cpu_usage;
180 
181 extern float
182   local_cpu_rate,
183   remote_cpu_rate;
184 
185 extern int
186   shell_num_cpus;
187 
188 extern	char
189   test_name[BUFSIZ];
190 
191 extern char
192   local_fill_file[BUFSIZ],
193   remote_fill_file[32];
194 
195 extern char *
196   result_brand;
197 
198 extern int
199   no_control;
200 
201 #ifdef WANT_DLPI
202 
203 extern int
204   loc_ppa,
205   rem_ppa;
206 
207 extern int
208   dlpi_sap;
209 
210 #endif /* WANT_DLPI */
211 
212 #endif
213 
214 extern int parse_ipqos(const char *cp);
215 extern const char * iptos2str(int iptos);
216 
217