aboutsummaryrefslogtreecommitdiff
path: root/src/netsh.h
blob: e45de3852815b0c97ea224f674cdf466956d9824 (plain)
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
/*
        Copyright (C) 1993-2012 Hewlett-Packard Company
*/

/* libraried performance include file 				*/
/* the define NOPERFEXTERN tels us not to re-define all the 	*/

/* defines and defaults */
#define		HOSTNAMESIZE 	255
#define         PORTBUFSIZE     10
#define		DEFAULT_SIZE	32768
#define		HOST_NAME	"127.0.0.1"
#define		TEST_PORT	"12865"

/* output controlling variables                                         */
#define 	DEBUG 0		/* debugging level			*/
#define 	VERBOSITY 0	/* verbosity level			*/

/* the end-test conditions for the tests - either transactions, bytes,  */
/* or time. different vars used for clarity - space is cheap ;-)        */
#define 	TEST_TIME 10	/* test ends by time			*/
#define 	TEST_BYTES 0	/* test ends on byte count		*/
#define 	TEST_TRANS 0	/* test ends on tran count		*/

/* the alignment conditions for the tests				*/
#define 	LOC_RECV_ALIGN	4	/* alignment for local receives	*/
#define 	LOC_SEND_ALIGN	4	/* alignment for local sends	*/
#define 	REM_RECV_ALIGN	4	/* alignment for remote receive	*/
#define 	REM_SEND_ALIGN	4	/* alignment for remote sends	*/

/* which way are we going and what are we doing in this handbasket?-) */
#define NETPERF_XMIT 0x2
#define NETPERF_RECV 0x4

#define NETPERF_IS_RR(x) (((x & NETPERF_XMIT) && (x & NETPERF_RECV)) || \
			  (!((x & NETPERF_XMIT) || (x & NETPERF_RECV))))

#define NETPERF_RECV_ONLY(x) ((x & NETPERF_RECV) && !(x & NETPERF_XMIT))

#define NETPERF_XMIT_ONLY(x) ((x & NETPERF_XMIT) && !(x & NETPERF_RECV))

#define NETPERF_CC(x) (!(x & NETPERF_XMIT) && !(x & NETPERF_RECV))


/* misc defines for the hell of it					*/
#ifndef MAXLONG
#define 	MAXLONG  	4294967295UL
#endif /* MAXLONG */

#ifdef WANT_DCCP

/* include netinet/in.h to see if SOCK_DCCP and IPPROTO_DCCP are there */
#include <netinet/in.h>

#ifndef SOCK_DCCP
#define DCCP_WARNING
#define SOCK_DCCP 6
#endif

#ifndef IPPROTO_DCCP
#define DCCP_WARNING
#define IPPROTO_DCCP 33  /* defined by the IANA */
#endif

#ifndef SOL_DCCP
#define DCCP_WARNING
#define SOL_DCCP 269
#endif

#ifdef DCCP_WARNING
#warning This platform is missing one of sock_dccp ipproto_dccp or sol_dccp
#endif

#endif

#ifndef NETSH
extern char		*program; /* program invocation name		*/
extern char             *command_line;  /* how we were invoked          */

extern char  *passphrase;

/* stuff to say where this test is going                                */
extern char	host_name[HOSTNAMESIZE];/* remote host name or ip addr  */
extern char     local_host_name[HOSTNAMESIZE];
extern char	test_port[PORTBUFSIZE]; /* where is the test waiting    */
extern char     local_test_port[PORTBUFSIZE];
extern int      address_family;
extern int      local_address_family;
extern int      parse_address_family(char family_string[]);
extern int      parse_socket_type(char socket_string[]);
extern int      parse_protocol(char protocol_string[]);
extern int      parse_direction(char direction_string[]);
extern void     set_defaults();
extern void     scan_cmd_line(int argc, char *argv[]);
extern void     dump_globals();
extern void     break_args(char *s, char *arg1, char *arg2);
extern void     break_args_explicit(char *s, char *arg1, char *arg2);
extern void     break_args_explicit_sep(char *s, int sep, char *arg1, char *arg2);
extern void     print_netserver_usage();

/* output controlling variables                                         */
extern int
  debug,	    /* debugging level */
  print_headers,    /* do/don't print test headers */
  verbosity,	    /* verbosity level */
  keep_histogram,   /* do we keep a histogram of interesting times? */
  keep_statistics;  /* do we keep/calculate expensive statistics? */

/* the end-test conditions for the tests - either transactions, bytes,  */
/* or time. different vars used for clarity - space is cheap ;-)        */
extern int
  test_time,		/* test ends by time			*/
  test_len_ticks,
  test_bytes,		/* test ends on byte count		*/
  test_trans;		/* test ends on tran count		*/

/* wait time between control/data connection establishment and start
   of data traffic  */
extern int wait_time_secs;

/* the alignment conditions for the tests				*/
extern int
  local_recv_align,	/* alignment for local receives		*/
  local_send_align,	/* alignment for local sends		*/
  remote_recv_align,	/* alignment for remote receives	*/
  remote_send_align,	/* alignment for remote sends		*/
  local_send_offset,
  local_recv_offset,
  remote_send_offset,
  remote_recv_offset,
  remote_send_width,
  remote_recv_width;

/* hoist these above the #if to deal with either netperf or netserver
   configured for it */

extern	int          interval_usecs;
extern  int          interval_wate;
extern	int	     interval_burst;
extern  int          remote_interval_usecs;
extern  int          remote_interval_burst;


#ifdef DIRTY
extern int	rem_dirty_count;
extern int	rem_clean_count;
extern int	loc_dirty_count;
extern int	loc_clean_count;
#endif /* DIRTY */

/* stuff for confidence intervals */

extern int  confidence_level;
extern int  iteration_min;
extern int  iteration_max;
extern int  result_confidence_only;
extern double interval;
extern double interval_pct;

extern int cpu_binding_requested;

/* stuff to control the bufferspace "width" */
extern int	send_width;
extern int      recv_width;

/* control the socket priority */
extern int local_socket_prio;
extern int remote_socket_prio;

extern int local_socket_tos;
extern int remote_socket_tos;

/* address family */
extern int	af;

/* different options for other things */
extern int
  local_cpu_usage,
  remote_cpu_usage;

extern float
  local_cpu_rate,
  remote_cpu_rate;

extern int
  shell_num_cpus;

extern	char
  test_name[BUFSIZ];

extern char
  local_fill_file[BUFSIZ],
  remote_fill_file[32];

extern char *
  result_brand;

extern int
  no_control;

#ifdef WANT_DLPI

extern int
  loc_ppa,
  rem_ppa;

extern int
  dlpi_sap;

#endif /* WANT_DLPI */

#endif

extern int parse_ipqos(const char *cp);
extern const char * iptos2str(int iptos);