ccRTP
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
49NAMESPACE_COMMONCPP
50
74class __EXPORT RTPDataQueue :
75 public IncomingDataQueue,
77{
78public:
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
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
236 { return timeclock.getElapsed(); }
237
238protected:
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
284private:
285 RTPDataQueue(const RTPDataQueue &o);
286
288 operator=(const RTPDataQueue &o);
289
295 void
296 initQueue();
297
298protected:
302 void
304
312 virtual bool
314
315private:
316 // true if connection "active"
317 volatile bool dataServiceActive;
318 Tos typeOfService;
319 TimerPort timeclock;
320 /* RTP session bandwidth control */
321 static const uint32 defaultSessionBw;
322 uint32 sessionBw;
323
324
325};
326 // ioqueue
328
329END_NAMESPACE
330
331#endif //CCXX_RTP_IOQUEUE_H_
332
uint32 microtimeout_t
Time interval expressed in microseconds.
Definition base.h:67
Queue for incoming RTP data packets in an RTP session.
Definition iqueue.h:885
A generic outgoing RTP data queue supporting multiple destinations.
Definition oqueue.h:225
A packet queue handler for building different kinds of RTP protocol systems.
Definition ioqueue.h:77
RTPDataQueue(uint32 size=defaultMembersHashSize)
Constructor.
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
uint32 getCurrentTimestamp() const
Get the timestamp that should be given for a packet whose payload sampling instant corresponds to the...
uint32 getSessionBandwidth() const
Definition ioqueue.h:219
void setTimeclock()
Set the packet timeclock for synchronizing timestamps.
Definition ioqueue.h:226
void renewLocalSSRC()
Definition ioqueue.h:281
virtual bool isPendingData(microtimeout_t timeout)=0
This function is used to check for and schedule against arriving packets based on the derived connect...
void endQueue()
This method ends the queue.
RTPDataQueue(uint32 *ssrc, uint32 size=defaultMembersHashSize)
Using this constructor you can start a session with the given ssrc, instead of the usual randomly gen...
uint32 getDefaultSessionBandwidth() const
Definition ioqueue.h:215
void disableStack()
Disable packet queue processing in the stack.
Definition ioqueue.h:129
timeout_t getTimeclock() const
Get the packet timeclock for synchronizing timestamps.
Definition ioqueue.h:235
virtual void timerTick()
A plugin point for timer tick driven events.
Definition ioqueue.h:278
bool isActive() const
Get active connection state flag.
Definition ioqueue.h:138
Tos
rtp.h cc++/rtp.h
Definition ioqueue.h:98
@ tosBestEffort
Best-effort network service.
Definition ioqueue.h:99
void setSessionBandwidth(uint32 bw)
Specify the bandwidth of the current session.
Definition ioqueue.h:211
void enableStack()
Enable packet queue processing in the stack.
Definition ioqueue.h:123
Generic RTP input queues.
Generic RTP output queues.