Bayonne2 / Common C++ 2 Framework
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
78  public IncomingDataQueue,
79  public OutgoingDataQueue
80 {
81 public:
101  typedef enum {
103  tosEnhanced
104  } Tos;
105 
118  inline void
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
215  { sessionBw = bw; }
216 
217  uint32
219  { return defaultSessionBw; }
220 
221  uint32
223  { return sessionBw; }
224 
228  inline void
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
282  { return; }
283 
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;
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 
void setTimeclock()
Set the packet timeclock for synchronizing timestamps.
Definition: ioqueue.h:229
Best-effort network service.
Definition: ioqueue.h:102
void disableStack()
Disable packet queue processing in the stack.
Definition: ioqueue.h:132
void renewLocalSSRC()
Definition: ioqueue.h:284
Tos typeOfService
Definition: ioqueue.h:321
uint32 microtimeout_t
Time interval expressed in microseconds.
Definition: base.h:69
uint32 getSessionBandwidth() const
Definition: ioqueue.h:222
Queue for incoming RTP data packets in an RTP session.
Definition: iqueue.h:883
static const uint32 defaultSessionBw
Definition: ioqueue.h:324
uint32 sessionBw
Definition: ioqueue.h:325
unsigned long timeout_t
Definition: thread.h:74
bool isActive() const
Get active connection state flag.
Definition: ioqueue.h:141
void setSessionBandwidth(uint32 bw)
Specify the bandwidth of the current session.
Definition: ioqueue.h:214
Generic RTP input queues.
Generic RTP output queues.
void setTypeOfService(Tos tos)
Specify the kind of service the application expects to use.
Definition: ioqueue.h:119
virtual ~RTPDataQueue()
The queue destructor flushes the queue and stops all services.
Definition: ioqueue.h:274
void enableStack()
Enable packet queue processing in the stack.
Definition: ioqueue.h:126
TimerPort timeclock
Definition: ioqueue.h:322
virtual void timerTick()
A plugin point for timer tick driven events.
Definition: ioqueue.h:281
#define __EXPORT
Definition: audio2.h:51
Timer ports are used to provide synchronized timing events when managed under a "service thread" such...
Definition: thread.h:1759
timeout_t getTimeclock() const
Get the packet timeclock for synchronizing timestamps.
Definition: ioqueue.h:238
A generic outgoing RTP data queue supporting multiple destinations.
Definition: oqueue.h:222
Tos
rtp.h cc++/rtp.h
Definition: ioqueue.h:101
uint32 getDefaultSessionBandwidth() const
Definition: ioqueue.h:218
A packet queue handler for building different kinds of RTP protocol systems.
Definition: ioqueue.h:77
volatile bool dataServiceActive
Definition: ioqueue.h:320