ioqueue.h

Go to the documentation of this file.
00001 // Copyright (C) 2001,2002,2004 Federico Montesino Pouzols <fedemp@altern.org>.
00002 //
00003 // This program is free software; you can redistribute it and/or modify
00004 // it under the terms of the GNU General Public License as published by
00005 // the Free Software Foundation; either version 2 of the License, or
00006 // (at your option) any later version.
00007 //
00008 // This program is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 // GNU General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU General Public License
00014 // along with this program; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00016 //
00017 // As a special exception, you may use this file as part of a free software
00018 // library without restriction.  Specifically, if other files instantiate
00019 // templates or use macros or inline functions from this file, or you compile
00020 // this file and link it with other files to produce an executable, this
00021 // file does not by itself cause the resulting executable to be covered by
00022 // the GNU General Public License.  This exception does not however
00023 // invalidate any other reasons why the executable file might be covered by
00024 // the GNU General Public License.
00025 //
00026 // This exception applies only to the code released under the name GNU
00027 // ccRTP.  If you copy code from other releases into a copy of GNU
00028 // ccRTP, as the General Public License permits, the exception does
00029 // not apply to the code that you add in this way.  To avoid misleading
00030 // anyone as to the status of such modified files, you must delete
00031 // this exception notice from them.
00032 //
00033 // If you write modifications of your own for GNU ccRTP, it is your choice
00034 // whether to permit this exception to apply to your modifications.
00035 // If you do not wish that, delete this exception notice.
00036 //
00037 
00044 #ifndef CCXX_RTP_IOQUEUE_H_
00045 #define CCXX_RTP_IOQUEUE_H_
00046 
00047 #include <ccrtp/iqueue.h>
00048 #include <ccrtp/oqueue.h>
00049 
00050 #ifdef  CCXX_NAMESPACES
00051 namespace ost {
00052 #endif
00053 
00077 class __EXPORT RTPDataQueue :
00078         public IncomingDataQueue,
00079         public OutgoingDataQueue
00080 {
00081 public:
00101         typedef enum {
00102                 tosBestEffort,      
00103                 tosEnhanced         
00104         }       Tos;
00105 
00118         inline void
00119         setTypeOfService(Tos tos)
00120         { typeOfService = tos; }
00121 
00126         inline void enableStack()
00127         { dataServiceActive = true; }
00128 
00132         inline void disableStack()
00133         { dataServiceActive = false; }
00134 
00140         inline bool
00141         isActive() const
00142         { return dataServiceActive; }
00143 
00203         uint32
00204         getCurrentTimestamp() const;
00205 
00213         void
00214         setSessionBandwidth(uint32 bw)
00215         { sessionBw = bw; }
00216 
00217         uint32
00218         getDefaultSessionBandwidth() const
00219         { return defaultSessionBw; }
00220 
00221         uint32
00222         getSessionBandwidth() const
00223         { return sessionBw; }
00224 
00228         inline void
00229         setTimeclock()
00230         { timeclock.setTimer(); }
00231 
00237         inline timeout_t
00238         getTimeclock() const
00239         { return timeclock.getElapsed(); }
00240 
00241 protected:
00242 
00250         RTPDataQueue(uint32 size = defaultMembersHashSize);
00251 
00267         RTPDataQueue(uint32* ssrc, uint32 size = defaultMembersHashSize);
00268 
00273         inline virtual
00274         ~RTPDataQueue()
00275         { endQueue(); }
00276 
00280         inline virtual void
00281         timerTick()
00282         { return; }
00283 
00284         void renewLocalSSRC()
00285                 {IncomingDataQueue::renewLocalSSRC();};
00286 
00287 private:
00288         RTPDataQueue(const RTPDataQueue &o);
00289 
00290         RTPDataQueue&
00291         operator=(const RTPDataQueue &o);
00292 
00298         void
00299         initQueue();
00300 
00301 protected:
00305         void
00306         endQueue();
00307 
00315         virtual bool
00316         isPendingData(microtimeout_t timeout) = 0;
00317 
00318 private:
00319         // true if connection "active"
00320         volatile bool dataServiceActive;
00321         Tos typeOfService;
00322         TimerPort timeclock;
00323         /* RTP session bandwidth control */
00324         static const uint32 defaultSessionBw;
00325         uint32 sessionBw;
00326 
00327 
00328 };
00329  // ioqueue
00331 
00332 #ifdef  CCXX_NAMESPACES
00333 }
00334 #endif
00335 
00336 #endif  //CCXX_RTP_IOQUEUE_H_
00337 

Generated on Mon Oct 23 08:04:56 2006 for ccRTP by  doxygen 1.4.7