JRTPLIB  3.11.2 (development version)
rtptransmitter.h
Go to the documentation of this file.
1 /*
2 
3  This file is a part of JRTPLIB
4  Copyright (c) 1999-2017 Jori Liesenborgs
5 
6  Contact: jori.liesenborgs@gmail.com
7 
8  This library was developed at the Expertise Centre for Digital Media
9  (http://www.edm.uhasselt.be), a research center of the Hasselt University
10  (http://www.uhasselt.be). The library is based upon work done for
11  my thesis at the School for Knowledge Technology (Belgium/The Netherlands).
12 
13  Permission is hereby granted, free of charge, to any person obtaining a
14  copy of this software and associated documentation files (the "Software"),
15  to deal in the Software without restriction, including without limitation
16  the rights to use, copy, modify, merge, publish, distribute, sublicense,
17  and/or sell copies of the Software, and to permit persons to whom the
18  Software is furnished to do so, subject to the following conditions:
19 
20  The above copyright notice and this permission notice shall be included
21  in all copies or substantial portions of the Software.
22 
23  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
29  IN THE SOFTWARE.
30 
31 */
32 
37 #ifndef RTPTRANSMITTER_H
38 
39 #define RTPTRANSMITTER_H
40 
41 #include "rtpconfig.h"
42 #include "rtptypes.h"
43 #include "rtpmemoryobject.h"
44 #include "rtptimeutilities.h"
45 
46 namespace jrtplib
47 {
48 
49 class RTPRawPacket;
50 class RTPAddress;
51 class RTPTransmissionParams;
52 class RTPTime;
53 class RTPTransmissionInfo;
54 
62 class JRTPLIB_IMPORTEXPORT RTPTransmitter : public RTPMemoryObject
63 {
64 public:
71  {
76  UserDefinedProto
77  };
78 
81  {
84  IgnoreSome
85  };
86 protected:
88  RTPTransmitter(RTPMemoryManager *mgr) : RTPMemoryObject(mgr) { timeinit.Dummy(); }
89 public:
90  virtual ~RTPTransmitter() { }
91 
96  virtual int Init(bool threadsafe) = 0;
97 
106  virtual int Create(size_t maxpacksize,const RTPTransmissionParams *transparams) = 0;
107 
111  virtual void Destroy() = 0;
112 
121 
126 
136  virtual int GetLocalHostName(uint8_t *buffer,size_t *bufferlength) = 0;
137 
139  virtual bool ComesFromThisTransmitter(const RTPAddress *addr) = 0;
140 
143  virtual size_t GetHeaderOverhead() = 0;
144 
146  virtual int Poll() = 0;
147 
152  virtual int WaitForIncomingData(const RTPTime &delay,bool *dataavailable = 0) = 0;
153 
155  virtual int AbortWait() = 0;
156 
158  virtual int SendRTPData(const void *data,size_t len) = 0;
159 
161  virtual int SendRTCPData(const void *data,size_t len) = 0;
162 
164  virtual int AddDestination(const RTPAddress &addr) = 0;
165 
167  virtual int DeleteDestination(const RTPAddress &addr) = 0;
168 
170  virtual void ClearDestinations() = 0;
171 
173  virtual bool SupportsMulticasting() = 0;
174 
176  virtual int JoinMulticastGroup(const RTPAddress &addr) = 0;
177 
179  virtual int LeaveMulticastGroup(const RTPAddress &addr) = 0;
180 
182  virtual void LeaveAllMulticastGroups() = 0;
183 
190 
192  virtual int AddToIgnoreList(const RTPAddress &addr) = 0;
193 
195  virtual int DeleteFromIgnoreList(const RTPAddress &addr)= 0;
196 
198  virtual void ClearIgnoreList() = 0;
199 
201  virtual int AddToAcceptList(const RTPAddress &addr) = 0;
202 
204  virtual int DeleteFromAcceptList(const RTPAddress &addr) = 0;
205 
207  virtual void ClearAcceptList() = 0;
208 
210  virtual int SetMaximumPacketSize(size_t s) = 0;
211 
213  virtual bool NewDataAvailable() = 0;
214 
217  virtual RTPRawPacket *GetNextPacket() = 0;
218 #ifdef RTPDEBUG
219  virtual void Dump() = 0;
220 #endif // RTPDEBUG
221 };
222 
229 class JRTPLIB_IMPORTEXPORT RTPTransmissionParams
230 {
231 protected:
233 public:
234  virtual ~RTPTransmissionParams() { }
235 
238 private:
240 };
241 
248 class JRTPLIB_IMPORTEXPORT RTPTransmissionInfo
249 {
250 protected:
252 public:
253  virtual ~RTPTransmissionInfo() { }
256 private:
258 };
259 
260 } // end namespace
261 
262 #endif // RTPTRANSMITTER_H
263 
This class is an abstract class which is used to specify destinations, multicast groups etc.
Definition: rtpaddress.h:51
A memory manager.
Definition: rtpmemorymanager.h:151
This class is used by the transmission component to store the incoming RTP and RTCP data in.
Definition: rtprawpacket.h:53
This class is used to specify wallclock time, delay intervals etc.
Definition: rtptimeutilities.h:86
Base class for additional information about the transmitter.
Definition: rtptransmitter.h:249
RTPTransmitter::TransmissionProtocol GetTransmissionProtocol() const
Returns the transmitter type for which these parameters are valid.
Definition: rtptransmitter.h:255
Base class for transmission parameters.
Definition: rtptransmitter.h:230
RTPTransmitter::TransmissionProtocol GetTransmissionProtocol() const
Returns the transmitter type for which these parameters are valid.
Definition: rtptransmitter.h:237
Abstract class from which actual transmission components should be derived.
Definition: rtptransmitter.h:63
virtual int SetReceiveMode(RTPTransmitter::ReceiveMode m)=0
Sets the receive mode.
RTPTransmitter(RTPMemoryManager *mgr)
Constructor in which you can specify a memory manager to use.
Definition: rtptransmitter.h:88
virtual void LeaveAllMulticastGroups()=0
Leaves all the multicast groups that have been joined.
virtual int SendRTCPData(const void *data, size_t len)=0
Send a packet with length len containing data to all RTCP addresses of the current destination list.
virtual int Init(bool threadsafe)=0
This function must be called before the transmission component can be used.
virtual bool NewDataAvailable()=0
Returns true if packets can be obtained using the GetNextPacket member function.
virtual RTPTransmissionInfo * GetTransmissionInfo()=0
Returns additional information about the transmitter.
ReceiveMode
Three kind of receive modes can be specified.
Definition: rtptransmitter.h:81
@ AcceptAll
All incoming data is accepted, no matter where it originated from.
Definition: rtptransmitter.h:82
@ AcceptSome
Only data coming from specific sources will be accepted.
Definition: rtptransmitter.h:83
virtual void DeleteTransmissionInfo(RTPTransmissionInfo *inf)=0
Deallocates the information returned by RTPTransmitter::GetTransmissionInfo .
virtual int WaitForIncomingData(const RTPTime &delay, bool *dataavailable=0)=0
Waits until incoming data is detected.
virtual int Create(size_t maxpacksize, const RTPTransmissionParams *transparams)=0
Prepares the component to be used.
virtual int AddToAcceptList(const RTPAddress &addr)=0
Adds addr to the list of addresses to accept.
virtual int JoinMulticastGroup(const RTPAddress &addr)=0
Joins the multicast group specified by addr.
virtual int SendRTPData(const void *data, size_t len)=0
Send a packet with length len containing data to all RTP addresses of the current destination list.
virtual int LeaveMulticastGroup(const RTPAddress &addr)=0
Leaves the multicast group specified by addr.
virtual void ClearDestinations()=0
Clears the list of destinations.
virtual void Destroy()=0
By calling this function, buffers are cleared and the component cannot be used anymore.
virtual int AddToIgnoreList(const RTPAddress &addr)=0
Adds addr to the list of addresses to ignore.
virtual size_t GetHeaderOverhead()=0
Returns the amount of bytes that will be added to the RTP packet by the underlying layers (excluding ...
virtual int Poll()=0
Checks for incoming data and stores it.
virtual void ClearIgnoreList()=0
Clears the list of addresses to ignore.
TransmissionProtocol
Used to identify a specific transmitter.
Definition: rtptransmitter.h:71
@ IPv6UDPProto
Specifies the internal UDP over IPv6 transmitter.
Definition: rtptransmitter.h:73
@ IPv4UDPProto
Specifies the internal UDP over IPv4 transmitter.
Definition: rtptransmitter.h:72
@ ExternalProto
Specifies the transmitter which can send packets using an external mechanism, and which can have rece...
Definition: rtptransmitter.h:75
@ TCPProto
Specifies the internal TCP transmitter.
Definition: rtptransmitter.h:74
virtual void ClearAcceptList()=0
Clears the list of addresses to accept.
virtual bool ComesFromThisTransmitter(const RTPAddress *addr)=0
Returns true if the address specified by addr is one of the addresses of the transmitter.
virtual int DeleteFromAcceptList(const RTPAddress &addr)=0
Deletes addr from the list of addresses to accept.
virtual bool SupportsMulticasting()=0
Returns true if the transmission component supports multicasting.
virtual int DeleteFromIgnoreList(const RTPAddress &addr)=0
Deletes addr from the list of addresses to accept.
virtual int GetLocalHostName(uint8_t *buffer, size_t *bufferlength)=0
Looks up the local host name.
virtual RTPRawPacket * GetNextPacket()=0
Returns the raw data of a received RTP packet (received during the Poll function) in an RTPRawPacket ...
virtual int SetMaximumPacketSize(size_t s)=0
Sets the maximum packet size which the transmitter should allow to s.
virtual int DeleteDestination(const RTPAddress &addr)=0
Deletes the address specified by addr from the list of destinations.
virtual int AddDestination(const RTPAddress &addr)=0
Adds the address specified by addr to the list of destinations.
virtual int AbortWait()=0
If the previous function has been called, this one aborts the waiting.