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 NAMESPACE_COMMONCPP
51 
75 class __EXPORT RTPDataQueue :
76  public IncomingDataQueue,
77  public OutgoingDataQueue
78 {
79 public:
99  typedef enum {
101  tosEnhanced
102  } Tos;
103 
116  inline void
118  { typeOfService = tos; }
119 
124  inline void enableStack()
125  { dataServiceActive = true; }
126 
130  inline void disableStack()
131  { dataServiceActive = false; }
132 
138  inline bool
139  isActive() const
140  { return dataServiceActive; }
141 
201  uint32
202  getCurrentTimestamp() const;
203 
211  void
213  { sessionBw = bw; }
214 
215  uint32
217  { return defaultSessionBw; }
218 
219  uint32
221  { return sessionBw; }
222 
226  inline void
228  { timeclock.setTimer(); }
229 
235  inline timeout_t
236  getTimeclock() const
237  { return timeclock.getElapsed(); }
238 
239 protected:
240 
248  RTPDataQueue(uint32 size = defaultMembersHashSize);
249 
265  RTPDataQueue(uint32* ssrc, uint32 size = defaultMembersHashSize);
266 
271  inline virtual
273  { endQueue(); }
274 
278  inline virtual void
280  { return; }
281 
284 
285 private:
286  RTPDataQueue(const RTPDataQueue &o);
287 
288  RTPDataQueue&
289  operator=(const RTPDataQueue &o);
290 
296  void
297  initQueue();
298 
299 protected:
303  void
304  endQueue();
305 
313  virtual bool
314  isPendingData(microtimeout_t timeout) = 0;
315 
316 private:
317  // true if connection "active"
318  volatile bool dataServiceActive;
319  Tos typeOfService;
320  TimerPort timeclock;
321  /* RTP session bandwidth control */
322  static const uint32 defaultSessionBw;
323  uint32 sessionBw;
324 
325 
326 };
327  // ioqueue
329 
330 END_NAMESPACE
331 
332 #endif //CCXX_RTP_IOQUEUE_H_
333 
uint32 getSessionBandwidth() const
Definition: ioqueue.h:220
timeout_t getTimeclock() const
Get the packet timeclock for synchronizing timestamps.
Definition: ioqueue.h:236
uint32 microtimeout_t
Time interval expressed in microseconds.
Definition: base.h:68
uint32 getDefaultSessionBandwidth() const
Definition: ioqueue.h:216
virtual ~RTPDataQueue()
The queue destructor flushes the queue and stops all services.
Definition: ioqueue.h:272
Queue for incoming RTP data packets in an RTP session.
Definition: iqueue.h:884
void setTypeOfService(Tos tos)
Specify the kind of service the application expects to use.
Definition: ioqueue.h:117
void setTimeclock()
Set the packet timeclock for synchronizing timestamps.
Definition: ioqueue.h:227
void enableStack()
Enable packet queue processing in the stack.
Definition: ioqueue.h:124
Tos
rtp.h cc++/rtp.h
Definition: ioqueue.h:99
Generic RTP input queues.
void disableStack()
Disable packet queue processing in the stack.
Definition: ioqueue.h:130
Generic RTP output queues.
virtual void timerTick()
A plugin point for timer tick driven events.
Definition: ioqueue.h:279
Best-effort network service.
Definition: ioqueue.h:100
bool isActive() const
Get active connection state flag.
Definition: ioqueue.h:139
A packet queue handler for building different kinds of RTP protocol systems.
Definition: ioqueue.h:75
void renewLocalSSRC()
Definition: ioqueue.h:282
A generic outgoing RTP data queue supporting multiple destinations.
Definition: oqueue.h:220
void setSessionBandwidth(uint32 bw)
Specify the bandwidth of the current session.
Definition: ioqueue.h:212