37 #ifndef RTPUDPV6TRANSMITTER_H
39 #define RTPUDPV6TRANSMITTER_H
41 #include "rtpconfig.h"
43 #ifdef RTP_SUPPORT_IPV6
49 #if ! (defined(WIN32) || defined(_WIN32_WCE))
50 #include <netinet/in.h>
55 #ifdef RTP_SUPPORT_THREAD
56 #include <jthread/jmutex.h>
57 #endif // RTP_SUPPORT_THREAD
59 #define RTPUDPV6TRANS_HASHSIZE 8317
60 #define RTPUDPV6TRANS_DEFAULTPORTBASE 5000
62 #define RTPUDPV6TRANS_RTPRECEIVEBUFFER 32768
63 #define RTPUDPV6TRANS_RTCPRECEIVEBUFFER 32768
64 #define RTPUDPV6TRANS_RTPTRANSMITBUFFER 32768
65 #define RTPUDPV6TRANS_RTCPTRANSMITBUFFER 32768
74 RTPUDPv6TransmissionParams():
RTPTransmissionParams(
RTPTransmitter::IPv6UDPProto) { portbase = RTPUDPV6TRANS_DEFAULTPORTBASE;
for (
int i = 0 ; i < 16 ; i++) bindIP.s6_addr[i] = 0; multicastTTL = 1; mcastifidx = 0; rtpsendbuf = RTPUDPV6TRANS_RTPTRANSMITBUFFER; rtprecvbuf= RTPUDPV6TRANS_RTPRECEIVEBUFFER; rtcpsendbuf = RTPUDPV6TRANS_RTCPTRANSMITBUFFER; rtcprecvbuf = RTPUDPV6TRANS_RTCPRECEIVEBUFFER; }
138 unsigned int mcastifidx;
139 std::list<in6_addr> localIPs;
140 uint8_t multicastTTL;
141 int rtpsendbuf, rtprecvbuf;
142 int rtcpsendbuf, rtcprecvbuf;
149 #if ! (defined(WIN32) || defined(_WIN32_WCE))
154 { localIPlist = iplist; rtpsocket = rtpsock; rtcpsocket = rtcpsock; }
156 ~RTPUDPv6TransmissionInfo() { }
160 #if ! (defined(WIN32) || defined(_WIN32_WCE))
171 std::list<in6_addr> localIPlist;
172 #if ! (defined(WIN32) || defined(_WIN32_WCE))
173 int rtpsocket,rtcpsocket;
175 SOCKET rtpsocket,rtcpsocket;
179 class RTPUDPv6Trans_GetHashIndex_IPv6Dest
182 static int GetIndex(
const RTPIPv6Destination &d) { in6_addr ip = d.GetIP();
return ((((uint32_t)ip.s6_addr[12])<<24)|(((uint32_t)ip.s6_addr[13])<<16)|(((uint32_t)ip.s6_addr[14])<<8)|((uint32_t)ip.s6_addr[15]))%RTPUDPV6TRANS_HASHSIZE; }
185 class RTPUDPv6Trans_GetHashIndex_in6_addr
188 static int GetIndex(
const in6_addr &ip) {
return ((((uint32_t)ip.s6_addr[12])<<24)|(((uint32_t)ip.s6_addr[13])<<16)|(((uint32_t)ip.s6_addr[14])<<8)|((uint32_t)ip.s6_addr[15]))%RTPUDPV6TRANS_HASHSIZE; }
191 #define RTPUDPV6TRANS_HEADERSIZE (40+8)
206 int Init(
bool treadsafe);
212 int GetLocalHostName(uint8_t *buffer,
size_t *bufferlength);
213 bool ComesFromThisTransmitter(
const RTPAddress *addr);
214 size_t GetHeaderOverhead() {
return RTPUDPV6TRANS_HEADERSIZE; }
217 int WaitForIncomingData(
const RTPTime &delay,
bool *dataavailable = 0);
220 int SendRTPData(
const void *data,
size_t len);
221 int SendRTCPData(
const void *data,
size_t len);
224 int DeleteDestination(
const RTPAddress &addr);
225 void ClearDestinations();
227 bool SupportsMulticasting();
228 int JoinMulticastGroup(
const RTPAddress &addr);
229 int LeaveMulticastGroup(
const RTPAddress &addr);
230 void LeaveAllMulticastGroups();
234 int DeleteFromIgnoreList(
const RTPAddress &addr);
235 void ClearIgnoreList();
237 int DeleteFromAcceptList(
const RTPAddress &addr);
238 void ClearAcceptList();
239 int SetMaximumPacketSize(
size_t s);
241 bool NewDataAvailable();
247 int CreateLocalIPList();
248 bool GetLocalIPList_Interfaces();
249 void GetLocalIPList_DNS();
250 void AddLoopbackAddress();
252 int PollSocket(
bool rtp);
253 int ProcessAddAcceptIgnoreEntry(in6_addr ip,uint16_t port);
254 int ProcessDeleteAcceptIgnoreEntry(in6_addr ip,uint16_t port);
255 #ifdef RTP_SUPPORT_IPV6MULTICAST
256 bool SetMulticastTTL(uint8_t ttl);
257 #endif // RTP_SUPPORT_IPV6MULTICAST
258 bool ShouldAcceptData(in6_addr srcip,uint16_t srcport);
259 void ClearAcceptIgnoreInfo();
264 #if (defined(WIN32) || defined(_WIN32_WCE))
265 SOCKET rtpsock,rtcpsock;
266 #else // not using winsock
267 int rtpsock,rtcpsock;
270 unsigned int mcastifidx;
271 std::list<in6_addr> localIPs;
273 uint8_t multicastTTL;
276 uint8_t *localhostname;
277 size_t localhostnamelength;
279 RTPHashTable<const RTPIPv6Destination,RTPUDPv6Trans_GetHashIndex_IPv6Dest,RTPUDPV6TRANS_HASHSIZE> destinations;
280 #ifdef RTP_SUPPORT_IPV6MULTICAST
281 RTPHashTable<const in6_addr,RTPUDPv6Trans_GetHashIndex_in6_addr,RTPUDPV6TRANS_HASHSIZE> multicastgroups;
282 #endif // RTP_SUPPORT_IPV6MULTICAST
283 std::list<RTPRawPacket*> rawpacketlist;
285 bool supportsmulticasting;
291 PortInfo() { all =
false; }
294 std::list<uint16_t> portlist;
297 RTPKeyHashTable<const in6_addr,PortInfo*,RTPUDPv6Trans_GetHashIndex_in6_addr,RTPUDPV6TRANS_HASHSIZE> acceptignoreinfo;
300 #if (defined(WIN32) || defined(_WIN32_WCE))
305 int CreateAbortDescriptors();
306 void DestroyAbortDescriptors();
307 void AbortWaitInternal();
308 #ifdef RTP_SUPPORT_THREAD
309 jthread::JMutex mainmutex,waitmutex;
311 #endif // RTP_SUPPORT_THREAD
316 #endif // RTP_SUPPORT_IPV6
318 #endif // RTPUDPV6TRANSMITTER_H
void SetBindIP(in6_addr ip)
Sets the IP address which is used to bind the sockets to ip.
Definition: rtpudpv6transmitter.h:77
This class is used by the transmission component to store the incoming RTP and RTCP data in...
Definition: rtprawpacket.h:51
Base class for transmission parameters.
Definition: rtptransmitter.h:227
void SetRTCPSendBuffer(int s)
Sets the RTCP socket's send buffer size.
Definition: rtpudpv6transmitter.h:119
uint16_t GetPortbase() const
Returns the RTP portbase which will be used (default is 5000).
Definition: rtpudpv6transmitter.h:104
int GetRTPReceiveBuffer() const
Returns the RTP socket's receive buffer size.
Definition: rtpudpv6transmitter.h:128
void SetRTPSendBuffer(int s)
Sets the RTP socket's send buffer size.
Definition: rtpudpv6transmitter.h:113
Additional information about the UDP over IPv6 transmitter.
Definition: rtpudpv6transmitter.h:146
int GetRTCPReceiveBuffer() const
Returns the RTCP socket's receive buffer size.
Definition: rtpudpv6transmitter.h:134
This class is an abstract class which is used to specify destinations, multicast groups etc...
Definition: rtpaddress.h:50
void SetMulticastInterfaceIndex(unsigned int idx)
Sets the multicast interface index.
Definition: rtpudpv6transmitter.h:80
An UDP over IPv6 transmitter.
Definition: rtpudpv6transmitter.h:200
void SetMulticastTTL(uint8_t mcastTTL)
Sets the multicast TTL to be used to mcastTTL.
Definition: rtpudpv6transmitter.h:86
void SetLocalIPList(std::list< in6_addr > &iplist)
Passes a list of IP addresses which will be used as the local IP addresses.
Definition: rtpudpv6transmitter.h:89
Abstract class from which actual transmission components should be derived.
Definition: rtptransmitter.h:61
ReceiveMode
Three kind of receive modes can be specified.
Definition: rtptransmitter.h:78
int GetRTCPSocket() const
Returns the socket descriptor used for receiving and transmitting RTCP packets.
Definition: rtpudpv6transmitter.h:165
const std::list< in6_addr > & GetLocalIPList() const
Returns the list of local IP addresses.
Definition: rtpudpv6transmitter.h:110
int GetRTPSocket() const
Returns the socket descriptor used for receiving and transmitting RTP packets.
Definition: rtpudpv6transmitter.h:162
void SetRTPReceiveBuffer(int s)
Sets the RTP socket's receive buffer size.
Definition: rtpudpv6transmitter.h:116
This class is used to specify wallclock time, delay intervals etc.
Definition: rtptimeutilities.h:80
A memory manager.
Definition: rtpmemorymanager.h:147
in6_addr GetBindIP() const
Returns the IP address which will be used to bind the sockets.
Definition: rtpudpv6transmitter.h:98
void SetRTCPReceiveBuffer(int s)
Sets the RTCP socket's receive buffer size.
Definition: rtpudpv6transmitter.h:122
uint8_t GetMulticastTTL() const
Returns the multicast TTL which will be used (default is 1).
Definition: rtpudpv6transmitter.h:107
void ClearLocalIPList()
Clears the list of local IP addresses.
Definition: rtpudpv6transmitter.h:95
Specifies the internal UDP over IPv6 transmitter.
Definition: rtptransmitter.h:72
unsigned int GetMulticastInterfaceIndex() const
Returns the multicast interface index.
Definition: rtpudpv6transmitter.h:101
int GetRTPSendBuffer() const
Returns the RTP socket's send buffer size.
Definition: rtpudpv6transmitter.h:125
Base class for additional information about the transmitter.
Definition: rtptransmitter.h:246
Parameters for the UDP over IPv6 transmitter.
Definition: rtpudpv6transmitter.h:71
int GetRTCPSendBuffer() const
Returns the RTCP socket's send buffer size.
Definition: rtpudpv6transmitter.h:131
std::list< in6_addr > GetLocalIPList() const
Returns the list of IPv6 addresses the transmitter considers to be the local IP addresses.
Definition: rtpudpv6transmitter.h:159
void SetPortbase(uint16_t pbase)
Sets the RTP portbase to pbase.
Definition: rtpudpv6transmitter.h:83