ioqueue.h
Go to the documentation of this file.
// Copyright (C) 2001,2002,2004 Federico Montesino Pouzols <fedemp@altern.org>.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// This exception applies only to the code released under the name GNU
// ccRTP. If you copy code from other releases into a copy of GNU
// ccRTP, as the General Public License permits, the exception does
// not apply to the code that you add in this way. To avoid misleading
// anyone as to the status of such modified files, you must delete
// this exception notice from them.
//
// If you write modifications of your own for GNU ccRTP, it is your choice
// whether to permit this exception to apply to your modifications.
// If you do not wish that, delete this exception notice.
//
#ifndef CCXX_RTP_IOQUEUE_H_
#define CCXX_RTP_IOQUEUE_H_
#include <ccrtp/iqueue.h>
#include <ccrtp/oqueue.h>
NAMESPACE_COMMONCPP
class __EXPORT RTPDataQueue :
public IncomingDataQueue,
public OutgoingDataQueue
{
public:
typedef enum {
tosBestEffort,
tosEnhanced
} Tos;
inline void
setTypeOfService(Tos tos)
{ typeOfService = tos; }
inline void enableStack()
{ dataServiceActive = true; }
inline void disableStack()
{ dataServiceActive = false; }
inline bool
isActive() const
{ return dataServiceActive; }
uint32
getCurrentTimestamp() const;
void
setSessionBandwidth(uint32 bw)
{ sessionBw = bw; }
uint32
getDefaultSessionBandwidth() const
{ return defaultSessionBw; }
uint32
getSessionBandwidth() const
{ return sessionBw; }
inline void
setTimeclock()
{ timeclock.setTimer(); }
inline timeout_t
getTimeclock() const
{ return timeclock.getElapsed(); }
protected:
RTPDataQueue(uint32 size = defaultMembersHashSize);
RTPDataQueue(uint32* ssrc, uint32 size = defaultMembersHashSize);
inline virtual
~RTPDataQueue()
{ endQueue(); }
inline virtual void
timerTick()
{ return; }
void renewLocalSSRC()
{IncomingDataQueue::renewLocalSSRC();}
private:
RTPDataQueue(const RTPDataQueue &o);
RTPDataQueue&
operator=(const RTPDataQueue &o);
void
initQueue();
protected:
void
endQueue();
virtual bool
isPendingData(microtimeout_t timeout) = 0;
private:
// true if connection "active"
volatile bool dataServiceActive;
Tos typeOfService;
TimerPort timeclock;
/* RTP session bandwidth control */
static const uint32 defaultSessionBw;
uint32 sessionBw;
};
// ioqueue
END_NAMESPACE
#endif //CCXX_RTP_IOQUEUE_H_
microtimeout_t
uint32 microtimeout_t
Time interval expressed in microseconds.
Definition base.h:68
IncomingDataQueue::renewLocalSSRC
void renewLocalSSRC()
IncomingDataQueue::IncomingDataQueue
IncomingDataQueue(uint32 size)
MembershipBookkeeping::defaultMembersHashSize
static const size_t defaultMembersHashSize
Definition iqueue.h:855
OutgoingDataQueue::OutgoingDataQueue
OutgoingDataQueue()
RTPDataQueue
A packet queue handler for building different kinds of RTP protocol systems.
Definition ioqueue.h:78
RTPDataQueue::RTPDataQueue
RTPDataQueue(uint32 size=defaultMembersHashSize)
Constructor.
RTPDataQueue::setTypeOfService
void setTypeOfService(Tos tos)
Specify the kind of service the application expects to use.
Definition ioqueue.h:117
RTPDataQueue::~RTPDataQueue
virtual ~RTPDataQueue()
The queue destructor flushes the queue and stops all services.
Definition ioqueue.h:272
RTPDataQueue::getCurrentTimestamp
uint32 getCurrentTimestamp() const
Get the timestamp that should be given for a packet whose payload sampling instant corresponds to the...
RTPDataQueue::getSessionBandwidth
uint32 getSessionBandwidth() const
Definition ioqueue.h:220
RTPDataQueue::setTimeclock
void setTimeclock()
Set the packet timeclock for synchronizing timestamps.
Definition ioqueue.h:227
RTPDataQueue::renewLocalSSRC
void renewLocalSSRC()
Definition ioqueue.h:282
RTPDataQueue::isPendingData
virtual bool isPendingData(microtimeout_t timeout)=0
This function is used to check for and schedule against arriving packets based on the derived connect...
RTPDataQueue::endQueue
void endQueue()
This method ends the queue.
RTPDataQueue::RTPDataQueue
RTPDataQueue(uint32 *ssrc, uint32 size=defaultMembersHashSize)
Using this constructor you can start a session with the given ssrc, instead of the usual randomly gen...
RTPDataQueue::getDefaultSessionBandwidth
uint32 getDefaultSessionBandwidth() const
Definition ioqueue.h:216
RTPDataQueue::disableStack
void disableStack()
Disable packet queue processing in the stack.
Definition ioqueue.h:130
RTPDataQueue::getTimeclock
timeout_t getTimeclock() const
Get the packet timeclock for synchronizing timestamps.
Definition ioqueue.h:236
RTPDataQueue::timerTick
virtual void timerTick()
A plugin point for timer tick driven events.
Definition ioqueue.h:279
RTPDataQueue::isActive
bool isActive() const
Get active connection state flag.
Definition ioqueue.h:139
RTPDataQueue::Tos
Tos
rtp.h cc++/rtp.h
Definition ioqueue.h:99
RTPDataQueue::tosBestEffort
@ tosBestEffort
Best-effort network service.
Definition ioqueue.h:100
RTPDataQueue::tosEnhanced
@ tosEnhanced
Enhanced network service.
Definition ioqueue.h:101
RTPDataQueue::setSessionBandwidth
void setSessionBandwidth(uint32 bw)
Specify the bandwidth of the current session.
Definition ioqueue.h:212
RTPDataQueue::enableStack
void enableStack()
Enable packet queue processing in the stack.
Definition ioqueue.h:124
iqueue.h
Generic RTP input queues.
oqueue.h
Generic RTP output queues.