ccRTP
ioqueue.h
Go to the documentation of this file.
1 // Copyright (C) 2001,2002,2004 Federico Montesino Pouzols <fedemp@altern.org>.
2 //
3 // This program is free software; you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation; either version 2 of the License, or
6 // (at your option) any later version.
7 //
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 //
17 // As a special exception, you may use this file as part of a free software
18 // library without restriction. Specifically, if other files instantiate
19 // templates or use macros or inline functions from this file, or you compile
20 // this file and link it with other files to produce an executable, this
21 // file does not by itself cause the resulting executable to be covered by
22 // the GNU General Public License. This exception does not however
23 // invalidate any other reasons why the executable file might be covered by
24 // the GNU General Public License.
25 //
26 // This exception applies only to the code released under the name GNU
27 // ccRTP. If you copy code from other releases into a copy of GNU
28 // ccRTP, as the General Public License permits, the exception does
29 // not apply to the code that you add in this way. To avoid misleading
30 // anyone as to the status of such modified files, you must delete
31 // this exception notice from them.
32 //
33 // If you write modifications of your own for GNU ccRTP, it is your choice
34 // whether to permit this exception to apply to your modifications.
35 // If you do not wish that, delete this exception notice.
36 //
37 
44 #ifndef CCXX_RTP_IOQUEUE_H_
45 #define CCXX_RTP_IOQUEUE_H_
46 
47 #include <ccrtp/iqueue.h>
48 #include <ccrtp/oqueue.h>
49 
50 #ifdef CCXX_NAMESPACES
51 namespace ost {
52 #endif
53 
77 class __EXPORT RTPDataQueue :
78  public IncomingDataQueue,
79  public OutgoingDataQueue
80 {
81 public:
101  typedef enum {
103  tosEnhanced
104  } Tos;
105 
118  inline void
119  setTypeOfService(Tos tos)
120  { typeOfService = tos; }
121 
126  inline void enableStack()
127  { dataServiceActive = true; }
128 
132  inline void disableStack()
133  { dataServiceActive = false; }
134 
140  inline bool
141  isActive() const
142  { return dataServiceActive; }
143 
203  uint32
204  getCurrentTimestamp() const;
205 
213  void
214  setSessionBandwidth(uint32 bw)
215  { sessionBw = bw; }
216 
217  uint32
218  getDefaultSessionBandwidth() const
219  { return defaultSessionBw; }
220 
221  uint32
222  getSessionBandwidth() const
223  { return sessionBw; }
224 
228  inline void
229  setTimeclock()
230  { timeclock.setTimer(); }
231 
237  inline timeout_t
238  getTimeclock() const
239  { return timeclock.getElapsed(); }
240 
241 protected:
242 
250  RTPDataQueue(uint32 size = defaultMembersHashSize);
251 
267  RTPDataQueue(uint32* ssrc, uint32 size = defaultMembersHashSize);
268 
273  inline virtual
275  { endQueue(); }
276 
280  inline virtual void
281  timerTick()
282  { return; }
283 
284  void renewLocalSSRC()
286 
287 private:
288  RTPDataQueue(const RTPDataQueue &o);
289 
290  RTPDataQueue&
291  operator=(const RTPDataQueue &o);
292 
298  void
299  initQueue();
300 
301 protected:
305  void
306  endQueue();
307 
315  virtual bool
316  isPendingData(microtimeout_t timeout) = 0;
317 
318 private:
319  // true if connection "active"
320  volatile bool dataServiceActive;
321  Tos typeOfService;
322  TimerPort timeclock;
323  /* RTP session bandwidth control */
324  static const uint32 defaultSessionBw;
325  uint32 sessionBw;
326 
327 
328 };
329  // ioqueue
331 
332 #ifdef CCXX_NAMESPACES
333 }
334 #endif
335 
336 #endif //CCXX_RTP_IOQUEUE_H_
337