Flowgrind
Advanced TCP traffic generator
flowgrind.h
Go to the documentation of this file.
1 
6 /*
7  * Copyright (C) 2013-2014 Alexander Zimmermann <alexander.zimmermann@netapp.com>
8  * Copyright (C) 2010-2013 Arnd Hannemann <arnd@arndnet.de>
9  * Copyright (C) 2010-2013 Christian Samsel <christian.samsel@rwth-aachen.de>
10  * Copyright (C) 2009 Tim Kosse <tim.kosse@gmx.de>
11  * Copyright (C) 2007-2008 Daniel Schaffrath <daniel.schaffrath@mac.com>
12  *
13  * This file is part of Flowgrind.
14  *
15  * Flowgrind is free software: you can redistribute it and/or modify
16  * it under the terms of the GNU General Public License as published by
17  * the Free Software Foundation, either version 3 of the License, or
18  * (at your option) any later version.
19  *
20  * Flowgrind is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23  * GNU General Public License for more details.
24  *
25  * You should have received a copy of the GNU General Public License
26  * along with Flowgrind. If not, see <http://www.gnu.org/licenses/>.
27  *
28  */
29 
30 #ifndef _FLOWGRIND_H_
31 #define _FLOWGRIND_H_
32 
33 #ifdef HAVE_CONFIG_H
34 #include "config.h"
35 #endif /* HAVE_CONFIG_H */
36 
37 #include <stdbool.h>
38 #include <limits.h>
39 
40 #include "common.h"
41 #include "fg_list.h"
42 
44 #define GUARDBAND 2
45 
47 #define MAX_COLUM_TOO_LARGE 5
48 
50 #define MAX_REPORTS_IN_ROW 25
51 
53 enum protocol_t {
55  PROTO_TCP = 1,
58 };
59 
61 enum os_t {
63  LINUX = 0,
70 };
71 
78 };
79 
80 #ifndef HAVE_TCP_CA_STATE
81 
82 enum tcp_ca_state {
84  TCP_CA_Open = 0,
86  TCP_CA_Disorder = 1,
88  TCP_CA_CWR = 2,
90  TCP_CA_Recovery = 3,
92  TCP_CA_Loss = 4,
93 };
94 #endif /* HAVE_TCP_CA_STATE */
95 
97 enum column_id {
139 #ifdef DEBUG
140 
142 #endif /* DEBUG */
143 
145 };
146 
148 enum option_t {
157 };
158 
169 };
170 
174  LOG_FILE_OPTION = CHAR_MAX + 1,
175 };
176 
180  unsigned short num_flows;
188  const char *dump_prefix;
190  bool clobber;
192  bool mbyte;
194  bool symbolic;
197 };
198 
200 struct daemon {
201 /* Note: a daemon can potentially managing multiple flows */
203  char uuid[38];
207  char os_name[257];
209  char os_release[257];
211  char *url;
212 };
213 
215 struct rpc_info {
217  char server_url[1000];
219  char server_name[257];
221  unsigned short server_port;
222 };
223 
233  struct daemon* daemon;
235  char test_address[1000];
236 };
237 
239 struct cflow {
242 
243  /* TODO Some of this flow option members are duplicates from the
244  * _flow_settings struct (see common.h). Flowgrind contoller
245  * should use this one */
246 
250  char shutdown;
256  unsigned random_seed;
257 
258  /* For the following arrays: 0 stands for source; 1 for destination */
259 
261  int endpoint_id[2];
263  struct timespec start_timestamp[2];
269  char finished[2];
271  struct report *final_report[2];
272 };
273 
277  const char* name;
279  const char* unit;
280 };
281 
283 struct column_state {
285  bool visible;
287  unsigned oversized;
289  size_t last_width;
290 };
291 
293 struct column {
300 };
301 
302 #endif /* _FLOWGRIND_H_ */
LINUX
@ LINUX
Linux.
Definition: flowgrind.h:63
column::type
enum column_id type
Unique column identifier.
Definition: flowgrind.h:295
cflow::byte_counting
char byte_counting
Enumerate bytes in payload instead of sending zeros (option -E).
Definition: flowgrind.h:254
COL_TCP_LOST
@ COL_TCP_LOST
Metric from the Linux / BSD TCP stack.
Definition: flowgrind.h:127
controller_options::mbyte
bool mbyte
Report in MByte/s instead of MBit/s (option -m).
Definition: flowgrind.h:192
COL_BLOCK_REQU
@ COL_BLOCK_REQU
Blocks per second.
Definition: flowgrind.h:108
MUTEX_CONTEXT_DESTINATION
@ MUTEX_CONTEXT_DESTINATION
Context for flow options on destination side.
Definition: flowgrind.h:168
MUTEX_CONTEXT_CONTROLLER
@ MUTEX_CONTEXT_CONTROLLER
Context for controller options.
Definition: flowgrind.h:162
COL_IAT_AVG
@ COL_IAT_AVG
Application level inter-arrival time.
Definition: flowgrind.h:116
cflow::shutdown
char shutdown
shutdown() each socket direction after test flow (option (-N).
Definition: flowgrind.h:250
column
Intermediated interval report column.
Definition: flowgrind.h:293
controller_options::log_to_stdout
bool log_to_stdout
Write output to screen (option -q).
Definition: flowgrind.h:184
cflow::settings
struct flow_settings settings[2]
Flow specific options.
Definition: flowgrind.h:267
cflow::final_report
struct report * final_report[2]
Final report from the daemon.
Definition: flowgrind.h:271
COL_TCP_UACK
@ COL_TCP_UACK
Metric from the Linux / BSD TCP stack.
Definition: flowgrind.h:125
column_header::name
const char * name
First header row: name of the column.
Definition: flowgrind.h:277
LOG_FILE_OPTION
@ LOG_FILE_OPTION
Pseudo short option for option –log-file.
Definition: flowgrind.h:174
COL_STATUS
@ COL_STATUS
Read / write status.
Definition: flowgrind.h:141
COL_TCP_TRET
@ COL_TCP_TRET
Metric from the Linux / BSD TCP stack.
Definition: flowgrind.h:129
COL_IAT_MAX
@ COL_IAT_MAX
Application level inter-arrival time.
Definition: flowgrind.h:117
COL_RTT_MIN
@ COL_RTT_MIN
Application level round-trip time.
Definition: flowgrind.h:111
COL_RTT_AVG
@ COL_RTT_AVG
Application level round-trip time.
Definition: flowgrind.h:112
controller_options
Controller options.
Definition: flowgrind.h:178
COL_TCP_RTTVAR
@ COL_TCP_RTTVAR
Metric from the Linux / BSD TCP stack.
Definition: flowgrind.h:134
COL_TCP_REOR
@ COL_TCP_REOR
Metric from the Linux / BSD TCP stack.
Definition: flowgrind.h:131
COL_THROUGH
@ COL_THROUGH
Throughput per seconds.
Definition: flowgrind.h:104
flow_endpoint::test_address
char test_address[1000]
network address where the actual test connection goes to.
Definition: flowgrind.h:235
NUM_COL
@ NUM_COL
Number of elements in enum.
Definition: flowgrind.h:144
flow_endpoint::receive_buffer_size_real
int receive_buffer_size_real
Receiver buffer (SO_RCVBUF).
Definition: flowgrind.h:229
cflow::summarize_only
char summarize_only
Summarize only, no intermediated interval reports (option -Q).
Definition: flowgrind.h:252
daemon
Infos about a flowgrind daemon.
Definition: flowgrind.h:200
flow_endpoint::rpc_info
struct rpc_info * rpc_info
Pointer to manage flow endpoint XMLRPC information.
Definition: flowgrind.h:231
cflow::endpoint_id
int endpoint_id[2]
ID used internally by the deamon to distinguish its flows.
Definition: flowgrind.h:261
daemon::api_version
int api_version
Flowgrind API version supported by this daemon.
Definition: flowgrind.h:205
OPT_FLOW_ENDPOINT
@ OPT_FLOW_ENDPOINT
Flow option with endpoint string.
Definition: flowgrind.h:156
COL_BLOCK_RESP
@ COL_BLOCK_RESP
Blocks per second.
Definition: flowgrind.h:109
mutex_context_t
mutex_context_t
Mutual exclusion contexts for options.
Definition: flowgrind.h:160
daemon::uuid
char uuid[38]
UUID of the daemon.
Definition: flowgrind.h:203
column::state
struct column_state state
State of the column.
Definition: flowgrind.h:299
column_state::oversized
unsigned oversized
How often the current column width was too high.
Definition: flowgrind.h:287
report
Definition: common.h:286
COL_TCP_SSTH
@ COL_TCP_SSTH
Metric from the Linux / BSD TCP stack.
Definition: flowgrind.h:124
flow_endpoint
Infos about the flow endpoint.
Definition: flowgrind.h:225
OPT_SELECTOR
@ OPT_SELECTOR
Selects a subset of flows to apply options to (-F).
Definition: flowgrind.h:152
COL_TCP_RETR
@ COL_TCP_RETR
Metric from the Linux / BSD TCP stack.
Definition: flowgrind.h:128
cflow::late_connect
char late_connect
Call connect() immediately before sending data (option -L).
Definition: flowgrind.h:248
COL_IAT_MIN
@ COL_IAT_MIN
Application level inter-arrival time.
Definition: flowgrind.h:115
controller_options::reporting_interval
double reporting_interval
Length of reporting interval, in seconds (option -i).
Definition: flowgrind.h:182
option_t
option_t
Option types in flowgrind controller.
Definition: flowgrind.h:148
OPT_FLOW
@ OPT_FLOW
Flow option without endpoint string.
Definition: flowgrind.h:154
os_t
os_t
Supported operating systems.
Definition: flowgrind.h:61
COL_SMSS
@ COL_SMSS
Metric from the Linux / BSD TCP stack.
Definition: flowgrind.h:137
COL_BEGIN
@ COL_BEGIN
Report interval.
Definition: flowgrind.h:101
flow_endpoint::send_buffer_size_real
int send_buffer_size_real
Sending buffer (SO_SNDBUF).
Definition: flowgrind.h:227
protocol_t
protocol_t
Transport protocols.
Definition: flowgrind.h:53
cflow::start_timestamp
struct timespec start_timestamp[2]
Timestamp set just before starting flow.
Definition: flowgrind.h:263
cflow::random_seed
unsigned random_seed
Random seed for stochastic traffic generation (option -J).
Definition: flowgrind.h:256
column_header
Header of an intermediated interval report column.
Definition: flowgrind.h:275
MUTEX_CONTEXT_SOURCE
@ MUTEX_CONTEXT_SOURCE
Context for flow options on source side.
Definition: flowgrind.h:166
rpc_info::server_name
char server_name[257]
Name of the XMLRPC server.
Definition: flowgrind.h:219
long_opt_only
long_opt_only
For long options with no equivalent short option, use pseudo short option.
Definition: flowgrind.h:172
daemon::os_release
char os_release[257]
Release number of the OS.
Definition: flowgrind.h:209
COL_END
@ COL_END
Report interval.
Definition: flowgrind.h:102
controller_options::symbolic
bool symbolic
Don't use symbolic values instead of number (option -p).
Definition: flowgrind.h:194
cflow::proto
enum protocol_t proto
Used transport protocol.
Definition: flowgrind.h:241
COL_FLOW_ID
@ COL_FLOW_ID
Flow ID.
Definition: flowgrind.h:99
controller_options::num_flows
unsigned short num_flows
Number of test flows (option -n).
Definition: flowgrind.h:180
OPT_CONTROLLER
@ OPT_CONTROLLER
General controller options.
Definition: flowgrind.h:150
column_state
State of an intermediated interval report column.
Definition: flowgrind.h:283
COL_TCP_BKOF
@ COL_TCP_BKOF
Metric from the Linux / BSD TCP stack.
Definition: flowgrind.h:132
fg_list.h
Generic doubly linked list implementation.
PROTO_TCP
@ PROTO_TCP
Transmission Control Protocol.
Definition: flowgrind.h:55
FREEBSD
@ FREEBSD
FreeBSD.
Definition: flowgrind.h:65
column_id
column_id
IDs to explicit address an intermediated interval report column.
Definition: flowgrind.h:97
rpc_info::server_port
unsigned short server_port
Port of the XMLRPC server.
Definition: flowgrind.h:221
daemon::os_name
char os_name[257]
OS on which this daemon runs.
Definition: flowgrind.h:207
common.h
Data structures used by the Flowgrind daemon and controller.
COL_PMTU
@ COL_PMTU
Metric from the Linux / BSD TCP stack.
Definition: flowgrind.h:138
COL_TCP_CA_STATE
@ COL_TCP_CA_STATE
Metric from the Linux / BSD TCP stack.
Definition: flowgrind.h:136
NUM_OSes
@ NUM_OSes
Number of elements in enum.
Definition: flowgrind.h:69
MUTEX_CONTEXT_TWO_SIDED
@ MUTEX_CONTEXT_TWO_SIDED
Context for flow options for both endpoints.
Definition: flowgrind.h:164
COL_TCP_SACK
@ COL_TCP_SACK
Metric from the Linux / BSD TCP stack.
Definition: flowgrind.h:126
rpc_info::server_url
char server_url[1000]
XMLRPC URL for this daemon.
Definition: flowgrind.h:217
column_header::unit
const char * unit
Second header row: unit of the column.
Definition: flowgrind.h:279
cflow
Infos about the flow including flow options.
Definition: flowgrind.h:239
column_state::last_width
size_t last_width
Last width of the column.
Definition: flowgrind.h:289
rpc_info
Infos about a flowgrind daemon and daemon-controller connection.
Definition: flowgrind.h:215
COL_DLY_AVG
@ COL_DLY_AVG
Application level one-way delay.
Definition: flowgrind.h:120
daemon::url
char * url
Pointer to daemon XMLPRC URL.
Definition: flowgrind.h:211
COL_RTT_MAX
@ COL_RTT_MAX
Application level round-trip time.
Definition: flowgrind.h:113
config.h
cflow::finished
char finished[2]
Flag if final report for the flow is received.
Definition: flowgrind.h:269
COL_DLY_MIN
@ COL_DLY_MIN
Application level one-way delay.
Definition: flowgrind.h:119
PROTO_UDP
@ PROTO_UDP
User Datagram Protocol.
Definition: flowgrind.h:57
DARWIN
@ DARWIN
Apple OS X.
Definition: flowgrind.h:67
COL_TCP_RTO
@ COL_TCP_RTO
Metric from the Linux / BSD TCP stack.
Definition: flowgrind.h:135
COL_DLY_MAX
@ COL_DLY_MAX
Application level one-way delay.
Definition: flowgrind.h:121
controller_options::dump_prefix
const char * dump_prefix
Prefix for dumpfile (option -e).
Definition: flowgrind.h:188
tcp_stack_t
tcp_stack_t
Unit of the TCP Stack.
Definition: flowgrind.h:73
controller_options::clobber
bool clobber
Overwrite existing log files (option -o).
Definition: flowgrind.h:190
BYTE_BASED
@ BYTE_BASED
FreeBSD and OS X stack is a bytes-based stack.
Definition: flowgrind.h:77
COL_TCP_FACK
@ COL_TCP_FACK
Metric from the Linux / BSD TCP stack.
Definition: flowgrind.h:130
column_state::visible
bool visible
Dynamically turn an column on/off.
Definition: flowgrind.h:285
controller_options::log_to_file
bool log_to_file
Write output to logfile (option -w).
Definition: flowgrind.h:186
COL_TCP_CWND
@ COL_TCP_CWND
Metric from the Linux / BSD TCP stack.
Definition: flowgrind.h:123
controller_options::force_unit
enum tcp_stack_t force_unit
Force kernel output to specific unit (option -s).
Definition: flowgrind.h:196
COL_TCP_RTT
@ COL_TCP_RTT
Metric from the Linux / BSD TCP stack.
Definition: flowgrind.h:133
column::header
struct column_header header
Column header (name and unit).
Definition: flowgrind.h:297
cflow::endpoint
struct flow_endpoint endpoint[2]
Infos about flow endpoint.
Definition: flowgrind.h:265
SEGMENT_BASED
@ SEGMENT_BASED
Linux is a segment-based stack.
Definition: flowgrind.h:75
COL_TRANSAC
@ COL_TRANSAC
Transactions per second.
Definition: flowgrind.h:106
flow_endpoint::daemon
struct daemon * daemon
Pointer to manage flow endpoint daemon.
Definition: flowgrind.h:233
flow_settings
Settings that describe a flow between from a endpoint's perspective.
Definition: common.h:181