ccRTP 2.1.2
 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-2015 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 Lesser General Public License
14 // along with GNU ccRTP. If not, see <http://www.gnu.org/licenses/>.
15 //
16 // As a special exception, you may use this file as part of a free software
17 // library without restriction. Specifically, if other files instantiate
18 // templates or use macros or inline functions from this file, or you compile
19 // this file and link it with other files to produce an executable, this
20 // file does not by itself cause the resulting executable to be covered by
21 // the GNU General Public License. This exception does not however
22 // invalidate any other reasons why the executable file might be covered by
23 // the GNU General Public License.
24 //
25 // This exception applies only to the code released under the name GNU
26 // ccRTP. If you copy code from other releases into a copy of GNU
27 // ccRTP, as the General Public License permits, the exception does
28 // not apply to the code that you add in this way. To avoid misleading
29 // anyone as to the status of such modified files, you must delete
30 // this exception notice from them.
31 //
32 // If you write modifications of your own for GNU ccRTP, it is your choice
33 // whether to permit this exception to apply to your modifications.
34 // If you do not wish that, delete this exception notice.
35 //
36 
43 #ifndef CCXX_RTP_IOQUEUE_H_
44 #define CCXX_RTP_IOQUEUE_H_
45 
46 #include <ccrtp/iqueue.h>
47 #include <ccrtp/oqueue.h>
48 
49 NAMESPACE_COMMONCPP
50 
75  public IncomingDataQueue,
76  public OutgoingDataQueue
77 {
78 public:
98  typedef enum {
100  tosEnhanced
101  } Tos;
102 
115  inline void
117  { typeOfService = tos; }
118 
123  inline void enableStack()
124  { dataServiceActive = true; }
125 
129  inline void disableStack()
130  { dataServiceActive = false; }
131 
137  inline bool
138  isActive() const
139  { return dataServiceActive; }
140 
200  uint32
201  getCurrentTimestamp() const;
202 
210  void
212  { sessionBw = bw; }
213 
214  uint32
216  { return defaultSessionBw; }
217 
218  uint32
220  { return sessionBw; }
221 
225  inline void
227  { timeclock.setTimer(); }
228 
234  inline timeout_t
235  getTimeclock() const
236  { return timeclock.getElapsed(); }
237 
238 protected:
239 
247  RTPDataQueue(uint32 size = defaultMembersHashSize);
248 
264  RTPDataQueue(uint32* ssrc, uint32 size = defaultMembersHashSize);
265 
270  inline virtual
272  { endQueue(); }
273 
277  inline virtual void
279  { return; }
280 
283 
284 private:
285  RTPDataQueue(const RTPDataQueue &o);
286 
287  RTPDataQueue&
288  operator=(const RTPDataQueue &o);
289 
295  void
296  initQueue();
297 
298 protected:
302  void
303  endQueue();
304 
312  virtual bool
313  isPendingData(microtimeout_t timeout) = 0;
314 
315 private:
316  // true if connection "active"
317  volatile bool dataServiceActive;
319  TimerPort timeclock;
320  /* RTP session bandwidth control */
321  static const uint32 defaultSessionBw;
322  uint32 sessionBw;
323 
324 
325 };
326  // ioqueue
328 
329 END_NAMESPACE
330 
331 #endif //CCXX_RTP_IOQUEUE_H_
332 
void setTimeclock()
Set the packet timeclock for synchronizing timestamps.
Definition: ioqueue.h:226
Best-effort network service.
Definition: ioqueue.h:99
void disableStack()
Disable packet queue processing in the stack.
Definition: ioqueue.h:129
void renewLocalSSRC()
Definition: ioqueue.h:281
void renewLocalSSRC()
Definition: incqueue.cpp:128
Tos typeOfService
Definition: ioqueue.h:318
uint32 microtimeout_t
Time interval expressed in microseconds.
Definition: base.h:67
uint32 getSessionBandwidth() const
Definition: ioqueue.h:219
Queue for incoming RTP data packets in an RTP session.
Definition: iqueue.h:883
static const uint32 defaultSessionBw
Definition: ioqueue.h:321
MembershipBookkeeping & operator=(const MembershipBookkeeping &o)
uint32 sessionBw
Definition: ioqueue.h:322
bool isActive() const
Get active connection state flag.
Definition: ioqueue.h:138
void setSessionBandwidth(uint32 bw)
Specify the bandwidth of the current session.
Definition: ioqueue.h:211
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:116
virtual ~RTPDataQueue()
The queue destructor flushes the queue and stops all services.
Definition: ioqueue.h:271
#define __EXPORT
Definition: ZrtpCallback.h:40
void enableStack()
Enable packet queue processing in the stack.
Definition: ioqueue.h:123
TimerPort timeclock
Definition: ioqueue.h:319
virtual void timerTick()
A plugin point for timer tick driven events.
Definition: ioqueue.h:278
timeout_t getTimeclock() const
Get the packet timeclock for synchronizing timestamps.
Definition: ioqueue.h:235
A generic outgoing RTP data queue supporting multiple destinations.
Definition: oqueue.h:219
Tos
rtp.h cc++/rtp.h
Definition: ioqueue.h:98
uint32 getDefaultSessionBandwidth() const
Definition: ioqueue.h:215
A packet queue handler for building different kinds of RTP protocol systems.
Definition: ioqueue.h:74
volatile bool dataServiceActive
Definition: ioqueue.h:317