Source: streammonitorreport.h
|
|
|
|
// ##########################################################################
// #### ####
// #### RTP Audio Server Project ####
// #### ============================ ####
// #### ####
// #### Stream Monitor Report ####
// #### ####
// #### Version 1.00 -- February 23, 2001 ####
// #### ####
// #### Copyright (C) 1999 Thomas Dreibholz ####
// #### 2000 Universität Bonn, Abt. IV ####
// #### 2001 EMail: Dreibholz@bigfoot.com ####
// #### WWW: http://www.bigfoot.com/~dreibholz ####
// #### ####
// ##########################################################################
#ifndef STREAMMONITORREPORT_H
#define STREAMMONITORREPORT_H
#include "system.h"
#include "internetaddress.h"
#include "streamreport.h"
#include "trafficclassvalues.h"
#include <multiset.h>
#include <algo.h>
namespace Coral {
/**
* This class contains a report for a set of streams.
* Note: No synchronization is done by StreamMonitorReport. The user has
* to take care for correct thread synchronization!
*
* @short Stream Monitor Report
* @author Thomas Dreibholz (Dreibholz@bigfoot.com)
* @version 1.0
*
* @see StreamReport
*/
class StreamMonitorReport
{
// ====== Constructor/Destructor =========================================
public:
/**
* Constructor.
*
* @param maxCount Maximum number of streams.
*/
StreamMonitorReport(const cardinal maxCount);
/**
* Destructor.
*/
~StreamMonitorReport();
// ====== Status functions ===============================================
/**
* Check, if StreamMonitorReport is ready.
*
* @return true, if ready; false otherwise.
*/
inline bool ready() const;
/**
* Get current stream report count.
*
* @return Current stream report count.
*/
inline cardinal getCount() const;
/**
* Get maximum stream report count.
*
* @return Maximum stream report count.
*/
inline cardinal getMaxCount() const;
// ====== Monitor settings ===============================================
/**
* Set list of accepted sources. Addresses with port number 0 are
* interpreted as any port.
* Warning: Do *not* change this set unsynchronized with StreamMonitorReport!
*
* @param set Set of accepted sources given by PortableAddress.
*/
inline void setAcceptedSourceList(multiset<PortableAddress>* set);
/**
* Set list of accepted destinations. Addresses with port number 0 are
* interpreted as any port.
* Warning: Do *not* change this set unsynchronized with StreamMonitorReport!
*
* @param set Set of accepted destinations given by PortableAddress.
*/
inline void setAcceptedDestinationList(multiset<PortableAddress>* set);
/**
* Check, if all sources are accepted.
*
* @return true, if all sources are accepted; false otherwise.
*/
inline bool getAcceptAllSources() const;
/**
* Set, if all sources are accepted.
*
* @param true to accept all sources; false otherwise.
*/
inline void setAcceptAllSources(const bool setIt);
/**
* Check, if all destinations are accepted.
*
* @return true, if all destinations are accepted; false otherwise.
*/
inline bool getAcceptAllDestinations() const;
/**
* Set, if all destinations are accepted.
*
* @param true to accept all destinations; false otherwise.
*/
inline void setAcceptAllDestinations(const bool setIt);
/**
* Check, if accepted transmissions are printed to cout.
*
* @return true, if accepted transmissions are printed to cout.
*/
inline bool getPrintAccepted() const;
/**
* Set, if accepted transmissions are printed to cout.
*
* @param true to print accepted transmissions to cout.
*/
inline void setPrintAccepted(const bool printAccepted);
/**
* Check, if rejected transmissions are printed to cout.
*
* @return true, if rejected transmissions are printed to cout.
*/
inline bool getPrintRejected() const;
/**
* Set, if rejected transmissions are printed to cout.
*
* @param true to print rejected transmissions to cout.
*/
inline void setPrintRejected(const bool printRejected);
// ====== Stream monitor report management ===============================
/**
* Reset.
*/
void reset();
/**
* Update report with new a stream report.
*
* @param Protocol string (unused in this version!).
* @param source Source address.
* @param destination Destination address.
* @param flowLabel Flow label.
* @param rawLength Raw length (with headers).
* @param payloadLength Payload length (without headers).
*/
void update(const char* protocol,
const PortableAddress& source,
const PortableAddress& destination,
const card32 flowLabel,
const card8 trafficClass,
const cardinal rawLength,
const cardinal payloadLength);
/**
* Get pointer to StreamReport at given index.
*
* @param index Index of StreamReport.
* @return Pointer to StreamReport.
*/
inline StreamReport* getReport(const cardinal index) const;
// ====== Values =========================================================
/**
* Total raw bytes counter for each traffic class.
*/
card64 TotalBytesRaw[TrafficClassValues::MaxValues];
/**
* Total payload bytes counter for each traffic class.
*/
card64 TotalBytesPayload[TrafficClassValues::MaxValues];
/**
* Total packets counter for each traffic class.
*/
card32 TotalPackets[TrafficClassValues::MaxValues];
// ====== Private data ===================================================
private:
bool isAccepted(multiset<PortableAddress>* set, const PortableAddress& address);
cardinal MaxCount;
cardinal Count;
StreamReport** Report;
bool AcceptAllSources;
bool AcceptAllDestinations;
bool PrintAccepted;
bool PrintRejected;
multiset<PortableAddress>* AcceptedSources;
multiset<PortableAddress>* AcceptedDestinations;
};
/**
* Implementation of << operator.
*/
ostream& operator<<(ostream& os, StreamMonitorReport& report);
}
#include "streammonitorreport.icc"
#endif
Generated by: viper@odin on Fri Feb 23 12:41:26 2001, using kdoc 2.0a36. |