/*
Copyright (c) 2001                      RIPE NCC


All Rights Reserved

Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of the author not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.

THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS; IN NO EVENT SHALL
AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

/*
-------------------------------------------------------------------------------
Module Header
Filename          : TTMStatistics.h
Author            : Rene Wilhelm
Date              : 28-06-2001
Description       : TTM Statistics class definition
Language Version  : C++
OSs Tested        : Solaris 2.6, Solaris 8, Debian Linux 2.2

TTMStatistics objects store the TTM statistics of measurements
between specific source and destination box.  

While processing TTM data files, the user adds information by calling
the Update() method. Once finished reading files, the summary 
numbers can be retrieved with corresponding methods.

$Id: TTMStatistics.h,v 1.2 2003/01/16 17:29:57 wilhelm Exp $
-------------------------------------------------------------------------------
*/

#ifndef TTMSTATISTICS_H
#define TTMSTATISTICS_H

#include "Delay.h"
#include "Percentiles.h"

#include <iostream.h>
#include <stdlib.h>

class TTMStatistics {
private:
	Percentiles *delays;     // Percentiles data per part of day
        Percentiles allDelays;	 // Percentiles data for whole period

	int *numPacketsSent;	 // Number of packets send per part of day
	int *numPacketsValid;	 // Number of packets send valid at src & dst
	int *numLost;            // Number of packets lost per part of day
	int totalPacketsSent;	 // Total number of packets send
	int totalPacketsValid;	 // Total number of packets valid at src & dst
	int totalLost;		 // Total number of packets lost
	int numIntervals;	 // Number of intervals in one day
	int secondsPerInterval;	 // Number of seconds in one interval

        int *routevectors;	// array with routevectors ids
	int vectorsize;		// allocated size of the routevectors array
        int entries;		// actual number of entries in array
        int flaps;		// number of routeing flaps 
        int lastid;		// last seen route id
        int maxhops;		// maximum number of hops
        int minhops;		// minimum number of hops

public:
	TTMStatistics();
	void SetNumIntervals(int nIntervals);
	void Update(Delay *delay, time_t starttime);
	void Reset();
	float GetDelayPerc(int interval, float level);
	float GetLossRate(int interval);
	int GetNumPacketsSent(int interval);
	int GetNumPacketsValid(int interval);
	~TTMStatistics();
};

#endif
