#
# =============================================
# ==       Passive Measurement Tool          ==
# ==              Version 1.0                ==
# =============================================
#
# Technische Universitaet Braunschweig
# Institut of Operating Systems and Computer Networks
# Muehlenpfordtstr. 23
# 38106 Braunschweig
#
# http://www.ibr.cs.tu-bs.de/passivemeasurement/
#
# Please see the COPYING file for license details.
#


I.) Dependencies
-----------------------
The measurement tool requires the following dependencies:
- autoconf
- automake
- doxygen
- boost
- libtrace
- google-glog
- sqlite
- sqlite
- poco sqlite


II.) Installation
-----------------------
The software was successfully tested under Debian Wheezy. To untar and build the code execute:

$ tar xvfz meas-1.0.tar.gz
$ cd meas-1.0
$ apt-get install autoconf build-essential libtool libgoogle-glog-dev doxygen libboost-dev \
	libboost-program-options-dev libboost-signals-dev libtrace-dev libpoco-dev libpacketdump-dev
$ sh autogen.sh
$ make
$ make install


III.) Program execution
-----------------------
The measurement tool recognizes the following program parameters:

$ meas_app -h

Options:
  -h [ --help ]               display help message
  -H [ --libtrace-help ]      display libtrace help message
  -l [ --local ] arg          local packet source ref
  -r [ --remote ] arg         remote packet source ref
  --modules arg               measurement modules
  --log-console arg (=1)      log to console
  --log-db arg                log SQLite filename
  --log-file arg              log output filename (CSV)
  --log-mode arg (=event)     log mode (none|event|stat|all)
  -f [ --filter ] arg         packet filter
  -i [ --ip-filter ] arg      ip address filter
  -s [ --snaplen ] arg        capture <arg> bytes from each packet
  -p [ --promisc ]            enable promiscuous mode
  --ntp-override              override NTP root-dist check
  --nat arg                   reverse NAT (NATIP-PublicIP)
  -v [ --verbose ] [=arg(=1)] enable verbose logging
  --vmodule arg               configure per module logging
                               example: '--vmodule Packet=2,*=1'


To start with a new measurement you have to define at least the local network interface and one/multiple measurement module(s), e.g.:

$ meas_app -l eth0 --modules tcpts


IV.) Measurement Modules
-----------------------
The tool supports several measurement modules:
- dump: Console output of decoded packets, no measurements
- ping: ICMP Echo request/response pairs (RTT) and IP timestamps (one-way delay)
- ntp: NTP request/response pairs (one-way delay)
- pair: Paired Log Analysis
- tcpdelack: Analysis of Delayed Acknowledgment causes
- tcpseq: Analysis of TCP Sequence Numbers
- tcpts: Analysis of TCP Timestamps
- bytecounter: Bandwidth measurement using Byte Counting
- bwest: Bandwidth estimation via Inter-Packet Arrival Times


V.) Database
-----------------------
If you want to store the output into a SQLite database, create a new database table:

CREATE TABLE IF NOT EXISTS passive
	( track_id UNSIGNED INTEGER NOT NULL
	, time REAL NOT NULL DEFAULT(strftime('%s', 'now'))
	, name TEXT NOT NULL
	, peer TEXT NOT NULL
	, value REAL NULL
	, reference REAL NULL
	, min REAL NULL
	, max REAL NULL
	, count REAL NULL
	, extra TEXT NOT NULL DEFAULT('')
	, FOREIGN KEY(track_id) REFERENCES track(id)
	);
