Source: congestionmonitor.h


Annotated List
Files
Globals
Hierarchy
Index
// ##########################################################################
// ####                                                                  ####
// ####                      RTP Audio Server Project                    ####
// ####                    ============================                  ####
// ####                                                                  ####
// #### Congestion Monitor                                               ####
// ####                                                                  ####
// #### 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 CONGESTIONMONITOR_H
#define CONGESTIONMONITOR_H


#include "system.h"
#include "socket.h"
#include "timedthread.h"
#include "networkmonitorinterface.h"


#include <multiset.h>


namespace Coral {


/**
  * This class implements a congestion monitor. It monitors a network
  * using a NetworkMonitorInterface.
  *
  * @short   Congestion Monitor.
  * @author  Thomas Dreibholz (Dreibholz@bigfoot.com)
  * @version 1.0
  */
class CongestionMonitor : public TimedThread
{
   // ====== Constructor/Destructor =========================================
   public:
   /**
     * Constructor for a new CongestionMonitor.
     *
     * @param monitor NetworkMonitorInterface for network monitor.
     * @param bandwidth Bandwidth in bytes per second (*not* bits/s!).
     * @param flags CongestionMonitor flags.
     */
   CongestionMonitor(NetworkMonitorInterface* monitor,
                     const card64             bandwidth,
                     const card8              flags = 0);

   /**
     * Destructor.
     */
   ~CongestionMonitor();


   // ====== Settings =======================================================
   /**
     * Get number of report receivers.
     *
     * @return Number of report receivers.
     */
   inline cardinal getReceivers();


   // ====== Add and remove receivers =======================================
   /**
     * Add a report receiver to the congestion monitor.
     *
     * @param receiver Socket with connection to the new receiver.
     * @return true, if receiver has been added; false otherwise.
     */
   bool addReportReceiver(Socket* receiver);

   /**
     * Remove a report receiver from the congestion monitor.
     *
     * @param receiver Socket of the receiver to be removed.
     */
   void removeReportReceiver(Socket* receiver);


   // ====== Private data ===================================================
   private:
   void timerEvent();

  
   card64                   Bandwidth;
   card32                   SequenceNumber;
   NetworkMonitorInterface* Monitor;
   multiset<Socket*>        ReportReceiverSet;
   card8                    Flags;
};


}


#include "congestionmonitor.icc"


#endif

Generated by: viper@odin on Fri Feb 23 12:41:26 2001, using kdoc 2.0a36.