ccRTP
ext.h
Go to the documentation of this file.
1// Copyright (C) 1999-2005 Open Source Telecom Corporation.
2// Copyright (C) 2006-2014 David Sugar, Tycho Softworks.
3// Copyright (C) 2015 Cherokees of Idaho.
4//
5// This program is free software; you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation; either version 2 of the License, or
8// (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU Lesser General Public License
16// along with GNU ccRTP. If not, see <http://www.gnu.org/licenses/>.
17//
18// As a special exception, you may use this file as part of a free software
19// library without restriction. Specifically, if other files instantiate
20// templates or use macros or inline functions from this file, or you compile
21// this file and link it with other files to produce an executable, this
22// file does not by itself cause the resulting executable to be covered by
23// the GNU General Public License. This exception does not however
24// invalidate any other reasons why the executable file might be covered by
25// the GNU General Public License.
26//
27// This exception applies only to the code released under the name GNU
28// ccRTP. If you copy code from other releases into a copy of GNU
29// ccRTP, as the General Public License permits, the exception does
30// not apply to the code that you add in this way. To avoid misleading
31// anyone as to the status of such modified files, you must delete
32// this exception notice from them.
33//
34// If you write modifications of your own for GNU ccRTP, it is your choice
35// whether to permit this exception to apply to your modifications.
36// If you do not wish that, delete this exception notice.
37//
38
44#ifndef CCXX_RTP_EXT_H
45#define CCXX_RTP_EXT_H
46
47#ifndef COMMONCPP_SOCKET_H_
48#include <commoncpp/socket.h>
49#include <commoncpp/udp.h>
50#endif
51
52#include <ccrtp/ioqueue.h>
53#include <ccrtp/channel.h>
54
55NAMESPACE_COMMONCPP
56
72class __EXPORT RTPDuplex : public RTPDataQueue,
73 protected UDPReceive, public UDPTransmit
74{
75public:
81 RTPDuplex(const InetAddress &bind, tpport_t local, tpport_t remote);
82
86 virtual
88
95 UDPTransmit::Error
96 connect(const InetHostAddress &host, tpport_t port = 0);
97
98protected:
99
104 bool
106 { return isPendingReceive(timeout); }
107
113 size_t
114 sendData(const unsigned char *const buffer, size_t len)
115 { return UDPTransmit::transmit((const char *)buffer, len); }
116
124 size_t
125 recvData(unsigned char *buffer, size_t len,
126 InetHostAddress& na, tpport_t& tp)
127 { /* na = UDPReceive::getPeer(&tp); FIX name ambiguity */
128 return UDPReceive::receive(buffer, len); }
129
134 inline void
135 setDataPeer(const InetAddress&, tpport_t)
136 { }
137
142 inline void
143 setControlPeer(const InetAddress&, tpport_t)
144 { }
145
146 inline size_t
148 {
149 // the const cast is a trick only needed for cc++2 <= 1.0.10
150 size_t len; ccioctl(const_cast<RTPDuplex*>(this)->UDPReceive::getReceiver(),FIONREAD,len); return len;
151 }
152
157
158private:
159 tpport_t dataBasePort;
160};
161 // rtpext
163
164END_NAMESPACE
165
166#endif //CCXX_RTP_EXT_H
167
uint32 microtimeout_t
Time interval expressed in microseconds.
Definition base.h:67
Definition of socket classes for different underlying transport and/or network protocols that can be ...
size_t ccioctl(int so, int request, size_t &len)
Definition channel.h:45
A packet queue handler for building different kinds of RTP protocol systems.
Definition ioqueue.h:77
A peer associated RTP socket pair for physically connected peer hosts.
Definition ext.h:74
Synchronization source in an RTP session.
Definition sources.h:193
size_t getNextDataPacketSize() const
Definition ext.h:147
SyncSource & getPeer()
bool isPendingData(microtimeout_t timeout)
Definition ext.h:105
void setControlPeer(const InetAddress &, tpport_t)
Definition ext.h:143
UDPTransmit::Error connect(const InetHostAddress &host, tpport_t port=0)
void setDataPeer(const InetAddress &, tpport_t)
Definition ext.h:135
RTPDuplex(const InetAddress &bind, tpport_t local, tpport_t remote)
size_t recvData(unsigned char *buffer, size_t len, InetHostAddress &na, tpport_t &tp)
Definition ext.h:125
virtual ~RTPDuplex()
size_t sendData(const unsigned char *const buffer, size_t len)
Definition ext.h:114
Generic RTP input/output queues.