libnetmeas is a library designed we wrote in order to help TCP researchers to automatically log TCP variables such as cwnd, ssthresh, RTT, etc. The library, written in C language using glib, is built upon Web100 library and exports an easy to use API in order to be easily integrated in existing applications.
Requirements to use the library are the following:
Instructions to patch and install a web100 kernel can be found at Web100 website.
Once a working linux web100 kernel has been built you will be able to use the libnetmeas in your applications. In order to use the library it is sufficient to use the following C function:
gboolean init_tcpstats(const gchar *lport_token, gint sfreq);
This function initializes the tcpstats internal thread which automatically logs all flows which match the lport_token string creating a file tcp_CID_timestamp.txt where CID is the connection ID and timestamp is the UNIX timestamp of the first data logged. lport_token is the local port to listen, a range of ports or a list of ports (for further details see the documentation).
Moreover it is possible to set the congestion control algorithm using the following function:
void set_congestion_control (gint cong);
Integrating the library in an existing applitation is as easy as calling init_tcpstats() and linking the application to libnetmeas (see library documentation for further details).
We patched iperf in order to automatically log TCP variables. We just modified the Makefile.rules adding libnetmes library:
LIBS = `pkg-config glib-2.0 --libs` -lweb100 \ `pkg-config gthread-2.0 --libs` -lnetmes
Moreover we modified Listener.cpp adding the following code in Listener::Run() method:
char *port; port = (char *)malloc (20); sprintf(port,"%d",mSettings->mPort); init_tcpstats (port,10);
And obviously including the header tcpstats.h in Listener.cpp. Running iperf -s will now automatically generate logfiles for each flow.