ccRTP
|
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 NAMESPACE_COMMONCPP 00051 00075 class __EXPORT RTPDataQueue : 00076 public IncomingDataQueue, 00077 public OutgoingDataQueue 00078 { 00079 public: 00099 typedef enum { 00100 tosBestEffort, 00101 tosEnhanced 00102 } Tos; 00103 00116 inline void 00117 setTypeOfService(Tos tos) 00118 { typeOfService = tos; } 00119 00124 inline void enableStack() 00125 { dataServiceActive = true; } 00126 00130 inline void disableStack() 00131 { dataServiceActive = false; } 00132 00138 inline bool 00139 isActive() const 00140 { return dataServiceActive; } 00141 00201 uint32 00202 getCurrentTimestamp() const; 00203 00211 void 00212 setSessionBandwidth(uint32 bw) 00213 { sessionBw = bw; } 00214 00215 uint32 00216 getDefaultSessionBandwidth() const 00217 { return defaultSessionBw; } 00218 00219 uint32 00220 getSessionBandwidth() const 00221 { return sessionBw; } 00222 00226 inline void 00227 setTimeclock() 00228 { timeclock.setTimer(); } 00229 00235 inline timeout_t 00236 getTimeclock() const 00237 { return timeclock.getElapsed(); } 00238 00239 protected: 00240 00248 RTPDataQueue(uint32 size = defaultMembersHashSize); 00249 00265 RTPDataQueue(uint32* ssrc, uint32 size = defaultMembersHashSize); 00266 00271 inline virtual 00272 ~RTPDataQueue() 00273 { endQueue(); } 00274 00278 inline virtual void 00279 timerTick() 00280 { return; } 00281 00282 void renewLocalSSRC() 00283 {IncomingDataQueue::renewLocalSSRC();} 00284 00285 private: 00286 RTPDataQueue(const RTPDataQueue &o); 00287 00288 RTPDataQueue& 00289 operator=(const RTPDataQueue &o); 00290 00296 void 00297 initQueue(); 00298 00299 protected: 00303 void 00304 endQueue(); 00305 00313 virtual bool 00314 isPendingData(microtimeout_t timeout) = 0; 00315 00316 private: 00317 // true if connection "active" 00318 volatile bool dataServiceActive; 00319 Tos typeOfService; 00320 TimerPort timeclock; 00321 /* RTP session bandwidth control */ 00322 static const uint32 defaultSessionBw; 00323 uint32 sessionBw; 00324 00325 00326 }; 00327 // ioqueue 00329 00330 END_NAMESPACE 00331 00332 #endif //CCXX_RTP_IOQUEUE_H_ 00333