Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

cabal_conn.h

00001 /*
00002    cabal_conn.h
00003 
00004    CABAL - CAllback BALance
00005 
00006    Cabal socket cache wrapper class.
00007 
00008    $Id: cabal_conn.h,v 1.2 2004/03/31 16:29:37 jonnymind Exp $
00009 ---------------------------------------------
00010    Begin      :
00011    Author     : Giancarlo Niccolai
00012 
00013    Last modified because:
00014 
00015 */
00016 
00017 #ifndef CABAL_CONNECTION_H
00018 #define CABAL_CONNECTION_H
00019 
00020 #include <list>
00021 #include <cabal_line.h>
00022 #include <cabal_channel.h>
00023 #include <cabal_socket.h>
00024 #include <cabal_defs.h>
00025 
00026 namespace Cabal
00027 {
00028 
00029 class Transmission;
00030 class Reception;
00031 
00068 class Connection
00069 {
00070 protected:
00071 
00076    Socket *m_socket;
00077 
00079    Address m_remote;
00080    
00085    Line *m_line;
00086    
00087    Transmission *m_trans;
00088    Reception *m_recpt;
00089 
00091    long int m_nextSchedule;
00092    
00097    Channel * m_channel;
00098    
00099 public:
00105    Connection( Socket *s, Transmission *trans, Reception *recpt = 0 );
00106 
00108    ~Connection();
00109    
00114    void account( const int iBytes ) { 
00115       m_line->usedBandwidth( iBytes ); 
00116       if ( m_channel ) m_channel->usedBandwidth( iBytes );
00117    }
00118    
00120    Socket *socket() const { return m_socket; }
00121    
00125    Address const &remote() const { return m_remote; }
00126    
00128    Line * line() const { return m_line; }
00129    
00133    void line( Line *l ) { m_line = l; }
00134    
00138    Transmission *transmission() const { return m_trans; }
00139    
00141    Reception *reception() const { return m_recpt; }
00142    
00150    void schedule( const long int milliseconds, Priority prio=medium_prio );
00151    
00155    long int nextSchedule() const { return m_nextSchedule; }
00156 };
00157 
00158 }
00159 
00160 #endif
00161 
00162 /* cabal_conn.h */

Generated on Sat Apr 10 17:41:48 2004 for Cabal by doxygen 1.3.5