mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-22 17:45:48 -05:00
qrtplib: removed IPV6 and netinet dependency
This commit is contained in:
parent
ced185c2ff
commit
c1c705b8be
@ -22,8 +22,6 @@ set (qrtplib_HEADERS
|
||||
rtpinternalsourcedata.h
|
||||
rtpipv4address.h
|
||||
rtpipv4destination.h
|
||||
rtpipv6address.h
|
||||
rtpipv6destination.h
|
||||
rtpkeyhashtable.h
|
||||
rtplibraryversion.h
|
||||
rtpmemorymanager.h
|
||||
@ -47,7 +45,6 @@ set (qrtplib_HEADERS
|
||||
rtptypes.h
|
||||
rtpudpv4transmitter.h
|
||||
rtpudpv4transmitternobind.h
|
||||
rtpudpv6transmitter.h
|
||||
rtpbyteaddress.h
|
||||
rtpexternaltransmitter.h
|
||||
rtpsocketutil.h
|
||||
@ -72,9 +69,7 @@ set(qrtplib_SOURCES
|
||||
rtperrors.cpp
|
||||
rtpinternalsourcedata.cpp
|
||||
rtpipv4address.cpp
|
||||
rtpipv6address.cpp
|
||||
rtpipv4destination.cpp
|
||||
rtpipv6destination.cpp
|
||||
rtplibraryversion.cpp
|
||||
rtppacket.cpp
|
||||
rtppacketbuilder.cpp
|
||||
@ -90,7 +85,6 @@ set(qrtplib_SOURCES
|
||||
rtptimeutilities.cpp
|
||||
rtpudpv4transmitter.cpp
|
||||
rtpudpv4transmitternobind.cpp
|
||||
rtpudpv6transmitter.cpp
|
||||
rtpbyteaddress.cpp
|
||||
rtpexternaltransmitter.cpp
|
||||
rtpabortdescriptors.cpp
|
||||
|
@ -41,9 +41,7 @@
|
||||
#include "rtpconfig.h"
|
||||
#include "rtcppacket.h"
|
||||
#include "rtpstructs.h"
|
||||
#ifdef RTP_SUPPORT_NETINET_IN
|
||||
#include <netinet/in.h>
|
||||
#endif // RTP_SUPPORT_NETINET_IN
|
||||
#include "rtpendian.h"
|
||||
|
||||
namespace qrtplib
|
||||
{
|
||||
@ -79,6 +77,7 @@ public:
|
||||
/** Returns the length of the actual data. */
|
||||
size_t GetAPPDataLength() const;
|
||||
private:
|
||||
RTPEndian m_endian;
|
||||
size_t appdatalen;
|
||||
};
|
||||
|
||||
@ -96,7 +95,7 @@ inline uint32_t RTCPAPPPacket::GetSSRC() const
|
||||
return 0;
|
||||
|
||||
uint32_t *ssrc = (uint32_t *)(data+sizeof(RTCPCommonHeader));
|
||||
return ntohl(*ssrc);
|
||||
return m_endian.qToHost(*ssrc);
|
||||
}
|
||||
|
||||
inline uint8_t *RTCPAPPPacket::GetName()
|
||||
|
@ -41,9 +41,7 @@
|
||||
#include "rtpconfig.h"
|
||||
#include "rtcppacket.h"
|
||||
#include "rtpstructs.h"
|
||||
#ifdef RTP_SUPPORT_NETINET_IN
|
||||
#include <netinet/in.h>
|
||||
#endif // RTP_SUPPORT_NETINET_IN
|
||||
#include "rtpendian.h"
|
||||
|
||||
namespace qrtplib
|
||||
{
|
||||
@ -80,6 +78,7 @@ public:
|
||||
uint8_t *GetReasonData();
|
||||
|
||||
private:
|
||||
RTPEndian m_endian;
|
||||
size_t reasonoffset;
|
||||
};
|
||||
|
||||
@ -97,7 +96,7 @@ inline uint32_t RTCPBYEPacket::GetSSRC(int index) const
|
||||
if (!knownformat)
|
||||
return 0;
|
||||
uint32_t *ssrc = (uint32_t *)(data+sizeof(RTCPCommonHeader)+sizeof(uint32_t)*index);
|
||||
return ntohl(*ssrc);
|
||||
return m_endian.qToHost(*ssrc);
|
||||
}
|
||||
|
||||
inline bool RTCPBYEPacket::HasReasonForLeaving() const
|
||||
|
@ -41,9 +41,6 @@
|
||||
#include "rtcpbyepacket.h"
|
||||
#include "rtcpapppacket.h"
|
||||
#include "rtcpunknownpacket.h"
|
||||
#ifdef RTP_SUPPORT_NETINET_IN
|
||||
#include <netinet/in.h>
|
||||
#endif // RTP_SUPPORT_NETINET_IN
|
||||
|
||||
namespace qrtplib
|
||||
{
|
||||
@ -132,7 +129,7 @@ int RTCPCompoundPacket::ParseData(uint8_t *data, size_t datalen)
|
||||
}
|
||||
}
|
||||
|
||||
length = (size_t)ntohs(rtcphdr->length);
|
||||
length = (size_t)m_endian.qToHost(rtcphdr->length);
|
||||
length++;
|
||||
length *= sizeof(uint32_t);
|
||||
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "rtpconfig.h"
|
||||
#include "rtptypes.h"
|
||||
#include "rtpmemoryobject.h"
|
||||
#include "rtpendian.h"
|
||||
#include <list>
|
||||
|
||||
namespace qrtplib
|
||||
@ -92,6 +93,7 @@ protected:
|
||||
void ClearPacketList();
|
||||
int ParseData(uint8_t *packet, size_t len);
|
||||
|
||||
RTPEndian m_endian;
|
||||
int error;
|
||||
|
||||
uint8_t *compoundpacket;
|
||||
|
@ -39,9 +39,6 @@
|
||||
#ifdef RTP_SUPPORT_RTCPUNKNOWN
|
||||
#include "rtcpunknownpacket.h"
|
||||
#endif // RTP_SUPPORT_RTCPUNKNOWN
|
||||
#ifdef RTP_SUPPORT_NETINET_IN
|
||||
#include <netinet/in.h>
|
||||
#endif // RTP_SUPPORT_NETINET_IN
|
||||
#include <string.h>
|
||||
|
||||
namespace qrtplib
|
||||
@ -175,14 +172,14 @@ int RTCPCompoundPacketBuilder::StartSenderReport(uint32_t senderssrc,const RTPNT
|
||||
report.isSR = true;
|
||||
|
||||
uint32_t *ssrc = (uint32_t *)report.headerdata;
|
||||
*ssrc = htonl(senderssrc);
|
||||
*ssrc = qToBigEndian(senderssrc);
|
||||
|
||||
RTCPSenderReport *sr = (RTCPSenderReport *)(report.headerdata + sizeof(uint32_t));
|
||||
sr->ntptime_msw = htonl(ntptimestamp.GetMSW());
|
||||
sr->ntptime_lsw = htonl(ntptimestamp.GetLSW());
|
||||
sr->rtptimestamp = htonl(rtptimestamp);
|
||||
sr->packetcount = htonl(packetcount);
|
||||
sr->octetcount = htonl(octetcount);
|
||||
sr->ntptime_msw = qToBigEndian(ntptimestamp.GetMSW());
|
||||
sr->ntptime_lsw = qToBigEndian(ntptimestamp.GetLSW());
|
||||
sr->rtptimestamp = qToBigEndian(rtptimestamp);
|
||||
sr->packetcount = qToBigEndian(packetcount);
|
||||
sr->octetcount = qToBigEndian(octetcount);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -211,7 +208,7 @@ int RTCPCompoundPacketBuilder::StartReceiverReport(uint32_t senderssrc)
|
||||
report.isSR = false;
|
||||
|
||||
uint32_t *ssrc = (uint32_t *)report.headerdata;
|
||||
*ssrc = htonl(senderssrc);
|
||||
*ssrc = qToBigEndian(senderssrc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -242,15 +239,15 @@ int RTCPCompoundPacketBuilder::AddReportBlock(uint32_t ssrc,uint8_t fractionlost
|
||||
uint32_t *packlost = (uint32_t *)&packetslost;
|
||||
uint32_t packlost2 = (*packlost);
|
||||
|
||||
rr->ssrc = htonl(ssrc);
|
||||
rr->ssrc = qToBigEndian(ssrc);
|
||||
rr->fractionlost = fractionlost;
|
||||
rr->packetslost[2] = (uint8_t)(packlost2&0xFF);
|
||||
rr->packetslost[1] = (uint8_t)((packlost2>>8)&0xFF);
|
||||
rr->packetslost[0] = (uint8_t)((packlost2>>16)&0xFF);
|
||||
rr->exthighseqnr = htonl(exthighestseq);
|
||||
rr->jitter = htonl(jitter);
|
||||
rr->lsr = htonl(lsr);
|
||||
rr->dlsr = htonl(dlsr);
|
||||
rr->exthighseqnr = qToBigEndian(exthighestseq);
|
||||
rr->jitter = qToBigEndian(jitter);
|
||||
rr->lsr = qToBigEndian(lsr);
|
||||
rr->dlsr = qToBigEndian(dlsr);
|
||||
|
||||
report.reportblocks.push_back(Buffer(buf,sizeof(RTCPReceiverReport)));
|
||||
return 0;
|
||||
@ -437,14 +434,14 @@ int RTCPCompoundPacketBuilder::AddBYEPacket(uint32_t *ssrcs,uint8_t numssrcs,con
|
||||
hdr->count = numssrcs;
|
||||
|
||||
numwords = packsize/sizeof(uint32_t);
|
||||
hdr->length = htons((uint16_t)(numwords-1));
|
||||
hdr->length = qToBigEndian((uint16_t)(numwords-1));
|
||||
hdr->packettype = RTP_RTCPTYPE_BYE;
|
||||
|
||||
uint32_t *sources = (uint32_t *)(buf+sizeof(RTCPCommonHeader));
|
||||
uint8_t srcindex;
|
||||
|
||||
for (srcindex = 0 ; srcindex < numssrcs ; srcindex++)
|
||||
sources[srcindex] = htonl(ssrcs[srcindex]);
|
||||
sources[srcindex] = qToBigEndian(ssrcs[srcindex]);
|
||||
|
||||
if (reasonlength != 0)
|
||||
{
|
||||
@ -498,11 +495,11 @@ int RTCPCompoundPacketBuilder::AddAPPPacket(uint8_t subtype,uint32_t ssrc,const
|
||||
hdr->padding = 0;
|
||||
hdr->count = subtype;
|
||||
|
||||
hdr->length = htons((uint16_t)(appdatawords+2));
|
||||
hdr->length = qToBigEndian((uint16_t)(appdatawords+2));
|
||||
hdr->packettype = RTP_RTCPTYPE_APP;
|
||||
|
||||
uint32_t *source = (uint32_t *)(buf+sizeof(RTCPCommonHeader));
|
||||
*source = htonl(ssrc);
|
||||
*source = qToBigEndian(ssrc);
|
||||
|
||||
buf[sizeof(RTCPCommonHeader)+sizeof(uint32_t)+0] = name[0];
|
||||
buf[sizeof(RTCPCommonHeader)+sizeof(uint32_t)+1] = name[1];
|
||||
@ -545,11 +542,11 @@ int RTCPCompoundPacketBuilder::AddUnknownPacket(uint8_t payload_type, uint8_t su
|
||||
hdr->version = 2;
|
||||
hdr->padding = 0;
|
||||
hdr->count = subtype;
|
||||
hdr->length = htons((uint16_t)(datawords+1));
|
||||
hdr->length = qToBigEndian((uint16_t)(datawords+1));
|
||||
hdr->packettype = payload_type;
|
||||
|
||||
uint32_t *source = (uint32_t *)(buf+sizeof(RTCPCommonHeader));
|
||||
*source = htonl(ssrc);
|
||||
*source = qToBigEndian(ssrc);
|
||||
|
||||
if (len > 0)
|
||||
memcpy((buf+sizeof(RTCPCommonHeader)+sizeof(uint32_t)),data,len);
|
||||
@ -630,7 +627,7 @@ int RTCPCompoundPacketBuilder::EndBuild()
|
||||
|
||||
size_t numwords = offset/sizeof(uint32_t);
|
||||
|
||||
hdr->length = htons((uint16_t)(numwords-1));
|
||||
hdr->length = qToBigEndian((uint16_t)(numwords-1));
|
||||
hdr->count = count;
|
||||
|
||||
// add entry in parent's list
|
||||
@ -674,7 +671,7 @@ int RTCPCompoundPacketBuilder::EndBuild()
|
||||
while (sourceit != sdes.sdessources.end() && sourcecount < 31)
|
||||
{
|
||||
uint32_t *ssrc = (uint32_t *)(curbuf+offset);
|
||||
*ssrc = htonl((*sourceit)->ssrc);
|
||||
*ssrc = qToBigEndian((*sourceit)->ssrc);
|
||||
offset += sizeof(uint32_t);
|
||||
|
||||
std::list<Buffer>::const_iterator itemit,itemend;
|
||||
@ -709,7 +706,7 @@ int RTCPCompoundPacketBuilder::EndBuild()
|
||||
size_t numwords = offset/4;
|
||||
|
||||
hdr->count = sourcecount;
|
||||
hdr->length = htons((uint16_t)(numwords-1));
|
||||
hdr->length = qToBigEndian((uint16_t)(numwords-1));
|
||||
|
||||
p = RTPNew(GetMemoryManager(),RTPMEM_TYPE_CLASS_RTCPSDESPACKET) RTCPSDESPacket(curbuf,offset);
|
||||
if (p == 0)
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "rtptimeutilities.h"
|
||||
#include "rtcpsdespacket.h"
|
||||
#include "rtperrors.h"
|
||||
#include "rtpendian.h"
|
||||
#include <list>
|
||||
|
||||
namespace qrtplib
|
||||
@ -372,6 +373,7 @@ private:
|
||||
std::list<SDESSource *>::const_iterator sdesit;
|
||||
};
|
||||
|
||||
RTPEndian m_endian;
|
||||
size_t maximumpacketsize;
|
||||
uint8_t *buffer;
|
||||
bool external;
|
||||
|
@ -41,9 +41,7 @@
|
||||
#include "rtpconfig.h"
|
||||
#include "rtcppacket.h"
|
||||
#include "rtpstructs.h"
|
||||
#ifdef RTP_SUPPORT_NETINET_IN
|
||||
#include <netinet/in.h>
|
||||
#endif // RTP_SUPPORT_NETINET_IN
|
||||
#include "rtpendian.h"
|
||||
|
||||
namespace qrtplib
|
||||
{
|
||||
@ -113,6 +111,8 @@ public:
|
||||
|
||||
private:
|
||||
RTCPReceiverReport *GotoReport(int index) const;
|
||||
|
||||
RTPEndian m_endian;
|
||||
};
|
||||
|
||||
inline uint32_t RTCPRRPacket::GetSenderSSRC() const
|
||||
@ -121,7 +121,7 @@ inline uint32_t RTCPRRPacket::GetSenderSSRC() const
|
||||
return 0;
|
||||
|
||||
uint32_t *ssrcptr = (uint32_t *)(data+sizeof(RTCPCommonHeader));
|
||||
return ntohl(*ssrcptr);
|
||||
return m_endian.qToHost(*ssrcptr);
|
||||
}
|
||||
inline int RTCPRRPacket::GetReceptionReportCount() const
|
||||
{
|
||||
@ -142,7 +142,7 @@ inline uint32_t RTCPRRPacket::GetSSRC(int index) const
|
||||
if (!knownformat)
|
||||
return 0;
|
||||
RTCPReceiverReport *r = GotoReport(index);
|
||||
return ntohl(r->ssrc);
|
||||
return m_endian.qToHost(r->ssrc);
|
||||
}
|
||||
|
||||
inline uint8_t RTCPRRPacket::GetFractionLost(int index) const
|
||||
@ -170,7 +170,7 @@ inline uint32_t RTCPRRPacket::GetExtendedHighestSequenceNumber(int index) const
|
||||
if (!knownformat)
|
||||
return 0;
|
||||
RTCPReceiverReport *r = GotoReport(index);
|
||||
return ntohl(r->exthighseqnr);
|
||||
return m_endian.qToHost(r->exthighseqnr);
|
||||
}
|
||||
|
||||
inline uint32_t RTCPRRPacket::GetJitter(int index) const
|
||||
@ -178,7 +178,7 @@ inline uint32_t RTCPRRPacket::GetJitter(int index) const
|
||||
if (!knownformat)
|
||||
return 0;
|
||||
RTCPReceiverReport *r = GotoReport(index);
|
||||
return ntohl(r->jitter);
|
||||
return m_endian.qToHost(r->jitter);
|
||||
}
|
||||
|
||||
inline uint32_t RTCPRRPacket::GetLSR(int index) const
|
||||
@ -186,7 +186,7 @@ inline uint32_t RTCPRRPacket::GetLSR(int index) const
|
||||
if (!knownformat)
|
||||
return 0;
|
||||
RTCPReceiverReport *r = GotoReport(index);
|
||||
return ntohl(r->lsr);
|
||||
return m_endian.qToHost(r->lsr);
|
||||
}
|
||||
|
||||
inline uint32_t RTCPRRPacket::GetDLSR(int index) const
|
||||
@ -194,7 +194,7 @@ inline uint32_t RTCPRRPacket::GetDLSR(int index) const
|
||||
if (!knownformat)
|
||||
return 0;
|
||||
RTCPReceiverReport *r = GotoReport(index);
|
||||
return ntohl(r->dlsr);
|
||||
return m_endian.qToHost(r->dlsr);
|
||||
}
|
||||
|
||||
} // end namespace
|
||||
|
@ -42,9 +42,7 @@
|
||||
#include "rtcppacket.h"
|
||||
#include "rtpstructs.h"
|
||||
#include "rtpdefines.h"
|
||||
#ifdef RTP_SUPPORT_NETINET_IN
|
||||
#include <netinet/in.h>
|
||||
#endif // RTP_SUPPORT_NETINET_IN
|
||||
#include "rtpendian.h"
|
||||
|
||||
namespace qrtplib
|
||||
{
|
||||
@ -143,6 +141,7 @@ public:
|
||||
#endif // RTP_SUPPORT_SDESPRIV
|
||||
|
||||
private:
|
||||
RTPEndian m_endian;
|
||||
uint8_t *currentchunk;
|
||||
int curchunknum;
|
||||
size_t itemoffset;
|
||||
@ -203,7 +202,7 @@ inline uint32_t RTCPSDESPacket::GetChunkSSRC() const
|
||||
if (currentchunk == 0)
|
||||
return 0;
|
||||
uint32_t *ssrc = (uint32_t *)currentchunk;
|
||||
return ntohl(*ssrc);
|
||||
return m_endian.qToHost(*ssrc);
|
||||
}
|
||||
|
||||
inline bool RTCPSDESPacket::GotoFirstItem()
|
||||
|
@ -42,9 +42,7 @@
|
||||
#include "rtcppacket.h"
|
||||
#include "rtptimeutilities.h"
|
||||
#include "rtpstructs.h"
|
||||
#ifdef RTP_SUPPORT_NETINET_IN
|
||||
#include <netinet/in.h>
|
||||
#endif // RTP_SUPPORT_NETINET_IN
|
||||
#include "rtpendian.h"
|
||||
|
||||
namespace qrtplib
|
||||
{
|
||||
@ -125,6 +123,8 @@ public:
|
||||
|
||||
private:
|
||||
RTCPReceiverReport *GotoReport(int index) const;
|
||||
|
||||
RTPEndian m_endian;
|
||||
};
|
||||
|
||||
inline uint32_t RTCPSRPacket::GetSenderSSRC() const
|
||||
@ -133,7 +133,7 @@ inline uint32_t RTCPSRPacket::GetSenderSSRC() const
|
||||
return 0;
|
||||
|
||||
uint32_t *ssrcptr = (uint32_t *)(data+sizeof(RTCPCommonHeader));
|
||||
return ntohl(*ssrcptr);
|
||||
return m_endian.qToHost(*ssrcptr);
|
||||
}
|
||||
|
||||
inline RTPNTPTime RTCPSRPacket::GetNTPTimestamp() const
|
||||
@ -142,7 +142,7 @@ inline RTPNTPTime RTCPSRPacket::GetNTPTimestamp() const
|
||||
return RTPNTPTime(0,0);
|
||||
|
||||
RTCPSenderReport *sr = (RTCPSenderReport *)(data+sizeof(RTCPCommonHeader)+sizeof(uint32_t));
|
||||
return RTPNTPTime(ntohl(sr->ntptime_msw),ntohl(sr->ntptime_lsw));
|
||||
return RTPNTPTime(m_endian.qToHost(sr->ntptime_msw),m_endian.qToHost(sr->ntptime_lsw));
|
||||
}
|
||||
|
||||
inline uint32_t RTCPSRPacket::GetRTPTimestamp() const
|
||||
@ -150,7 +150,7 @@ inline uint32_t RTCPSRPacket::GetRTPTimestamp() const
|
||||
if (!knownformat)
|
||||
return 0;
|
||||
RTCPSenderReport *sr = (RTCPSenderReport *)(data+sizeof(RTCPCommonHeader)+sizeof(uint32_t));
|
||||
return ntohl(sr->rtptimestamp);
|
||||
return m_endian.qToHost(sr->rtptimestamp);
|
||||
}
|
||||
|
||||
inline uint32_t RTCPSRPacket::GetSenderPacketCount() const
|
||||
@ -158,7 +158,7 @@ inline uint32_t RTCPSRPacket::GetSenderPacketCount() const
|
||||
if (!knownformat)
|
||||
return 0;
|
||||
RTCPSenderReport *sr = (RTCPSenderReport *)(data+sizeof(RTCPCommonHeader)+sizeof(uint32_t));
|
||||
return ntohl(sr->packetcount);
|
||||
return m_endian.qToHost(sr->packetcount);
|
||||
}
|
||||
|
||||
inline uint32_t RTCPSRPacket::GetSenderOctetCount() const
|
||||
@ -166,7 +166,7 @@ inline uint32_t RTCPSRPacket::GetSenderOctetCount() const
|
||||
if (!knownformat)
|
||||
return 0;
|
||||
RTCPSenderReport *sr = (RTCPSenderReport *)(data+sizeof(RTCPCommonHeader)+sizeof(uint32_t));
|
||||
return ntohl(sr->octetcount);
|
||||
return m_endian.qToHost(sr->octetcount);
|
||||
}
|
||||
|
||||
inline int RTCPSRPacket::GetReceptionReportCount() const
|
||||
@ -188,7 +188,7 @@ inline uint32_t RTCPSRPacket::GetSSRC(int index) const
|
||||
if (!knownformat)
|
||||
return 0;
|
||||
RTCPReceiverReport *r = GotoReport(index);
|
||||
return ntohl(r->ssrc);
|
||||
return m_endian.qToHost(r->ssrc);
|
||||
}
|
||||
|
||||
inline uint8_t RTCPSRPacket::GetFractionLost(int index) const
|
||||
@ -216,7 +216,7 @@ inline uint32_t RTCPSRPacket::GetExtendedHighestSequenceNumber(int index) const
|
||||
if (!knownformat)
|
||||
return 0;
|
||||
RTCPReceiverReport *r = GotoReport(index);
|
||||
return ntohl(r->exthighseqnr);
|
||||
return m_endian.qToHost(r->exthighseqnr);
|
||||
}
|
||||
|
||||
inline uint32_t RTCPSRPacket::GetJitter(int index) const
|
||||
@ -224,7 +224,7 @@ inline uint32_t RTCPSRPacket::GetJitter(int index) const
|
||||
if (!knownformat)
|
||||
return 0;
|
||||
RTCPReceiverReport *r = GotoReport(index);
|
||||
return ntohl(r->jitter);
|
||||
return m_endian.qToHost(r->jitter);
|
||||
}
|
||||
|
||||
inline uint32_t RTCPSRPacket::GetLSR(int index) const
|
||||
@ -232,7 +232,7 @@ inline uint32_t RTCPSRPacket::GetLSR(int index) const
|
||||
if (!knownformat)
|
||||
return 0;
|
||||
RTCPReceiverReport *r = GotoReport(index);
|
||||
return ntohl(r->lsr);
|
||||
return m_endian.qToHost(r->lsr);
|
||||
}
|
||||
|
||||
inline uint32_t RTCPSRPacket::GetDLSR(int index) const
|
||||
@ -240,7 +240,7 @@ inline uint32_t RTCPSRPacket::GetDLSR(int index) const
|
||||
if (!knownformat)
|
||||
return 0;
|
||||
RTCPReceiverReport *r = GotoReport(index);
|
||||
return ntohl(r->dlsr);
|
||||
return m_endian.qToHost(r->dlsr);
|
||||
}
|
||||
|
||||
} // end namespace
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
This library was developed at the Expertise Centre for Digital Media
|
||||
(http://www.edm.uhasselt.be), a research center of the Hasselt University
|
||||
(http://www.uhasselt.be). The library is based upon work done for
|
||||
(http://www.uhasselt.be). The library is based upon work done for
|
||||
my thesis at the School for Knowledge Technology (Belgium/The Netherlands).
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
@ -41,8 +41,8 @@
|
||||
#define JRTPLIB_UNUSED(x) (void)(x)
|
||||
#endif // JRTPLIB_UNUSED
|
||||
|
||||
#define JRTPLIB_IMPORT
|
||||
#define JRTPLIB_EXPORT
|
||||
#define JRTPLIB_IMPORT
|
||||
#define JRTPLIB_EXPORT
|
||||
#ifdef JRTPLIB_COMPILING
|
||||
#define JRTPLIB_IMPORTEXPORT JRTPLIB_EXPORT
|
||||
#else
|
||||
@ -69,9 +69,9 @@
|
||||
|
||||
#define RTP_SUPPORT_GETLOGINR
|
||||
|
||||
#define RTP_SUPPORT_IPV6
|
||||
// no #define RTP_SUPPORT_IPV6
|
||||
|
||||
#define RTP_SUPPORT_IPV6MULTICAST
|
||||
// no #define RTP_SUPPORT_IPV6MULTICAST
|
||||
|
||||
#define RTP_SUPPORT_IFADDRS
|
||||
|
||||
@ -81,7 +81,7 @@
|
||||
|
||||
// No support for sending unknown RTCP packets
|
||||
|
||||
#define RTP_SUPPORT_NETINET_IN
|
||||
// no #define RTP_SUPPORT_NETINET_IN
|
||||
|
||||
// Not using winsock sockets
|
||||
|
||||
|
@ -1,91 +0,0 @@
|
||||
/*
|
||||
|
||||
This file is a part of JRTPLIB
|
||||
Copyright (c) 1999-2017 Jori Liesenborgs
|
||||
|
||||
Contact: jori.liesenborgs@gmail.com
|
||||
|
||||
This library was developed at the Expertise Centre for Digital Media
|
||||
(http://www.edm.uhasselt.be), a research center of the Hasselt University
|
||||
(http://www.uhasselt.be). The library is based upon work done for
|
||||
my thesis at the School for Knowledge Technology (Belgium/The Netherlands).
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rtpipv6address.h"
|
||||
#include "rtpmemorymanager.h"
|
||||
|
||||
#ifdef RTP_SUPPORT_IPV6
|
||||
|
||||
|
||||
namespace qrtplib
|
||||
{
|
||||
|
||||
RTPAddress *RTPIPv6Address::CreateCopy(RTPMemoryManager *mgr) const
|
||||
{
|
||||
JRTPLIB_UNUSED(mgr); // possibly unused
|
||||
RTPIPv6Address *newaddr = RTPNew(mgr,RTPMEM_TYPE_CLASS_RTPADDRESS) RTPIPv6Address(ip,port);
|
||||
return newaddr;
|
||||
}
|
||||
|
||||
bool RTPIPv6Address::IsSameAddress(const RTPAddress *addr) const
|
||||
{
|
||||
if (addr == 0)
|
||||
return false;
|
||||
if (addr->GetAddressType() != RTPAddress::IPv6Address)
|
||||
return false;
|
||||
|
||||
const RTPIPv6Address *addr2 = (const RTPIPv6Address *)addr;
|
||||
const uint8_t *ip2 = addr2->ip.s6_addr;
|
||||
|
||||
if (port != addr2->port)
|
||||
return false;
|
||||
|
||||
for (int i = 0 ; i < 16 ; i++)
|
||||
{
|
||||
if (ip.s6_addr[i] != ip2[i])
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RTPIPv6Address::IsFromSameHost(const RTPAddress *addr) const
|
||||
{
|
||||
if (addr == 0)
|
||||
return false;
|
||||
if (addr->GetAddressType() != RTPAddress::IPv6Address)
|
||||
return false;
|
||||
|
||||
const RTPIPv6Address *addr2 = (const RTPIPv6Address *)addr;
|
||||
const uint8_t *ip2 = addr2->ip.s6_addr;
|
||||
for (int i = 0 ; i < 16 ; i++)
|
||||
{
|
||||
if (ip.s6_addr[i] != ip2[i])
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
} // end namespace
|
||||
|
||||
#endif // RTP_SUPPORT_IPV6
|
||||
|
@ -1,108 +0,0 @@
|
||||
/*
|
||||
|
||||
This file is a part of JRTPLIB
|
||||
Copyright (c) 1999-2017 Jori Liesenborgs
|
||||
|
||||
Contact: jori.liesenborgs@gmail.com
|
||||
|
||||
This library was developed at the Expertise Centre for Digital Media
|
||||
(http://www.edm.uhasselt.be), a research center of the Hasselt University
|
||||
(http://www.uhasselt.be). The library is based upon work done for
|
||||
my thesis at the School for Knowledge Technology (Belgium/The Netherlands).
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file rtpipv6address.h
|
||||
*/
|
||||
|
||||
#ifndef RTPIPV6ADDRESS_H
|
||||
|
||||
#define RTPIPV6ADDRESS_H
|
||||
|
||||
#include "rtpconfig.h"
|
||||
|
||||
#ifdef RTP_SUPPORT_IPV6
|
||||
|
||||
#include "rtpaddress.h"
|
||||
#include "rtptypes.h"
|
||||
#ifdef RTP_SUPPORT_NETINET_IN
|
||||
#include <netinet/in.h>
|
||||
#endif // RTP_SUPPORT_NETINET_IN
|
||||
|
||||
namespace qrtplib
|
||||
{
|
||||
|
||||
/** Represents an IPv6 IP address and port.
|
||||
* This class is used by the UDP over IPv4 transmission component.
|
||||
* When an RTPIPv6Address is used in one of the multicast functions of the
|
||||
* transmitter, the port number is ignored. When an instance is used in one of
|
||||
* the accept or ignore functions of the transmitter, a zero port number represents
|
||||
* all ports for the specified IP address.
|
||||
*/
|
||||
class JRTPLIB_IMPORTEXPORT RTPIPv6Address : public RTPAddress
|
||||
{
|
||||
public:
|
||||
/** Creates an instance with IP address and port number set to zero. */
|
||||
RTPIPv6Address():RTPAddress(IPv6Address) { for (int i = 0 ; i < 16 ; i++) ip.s6_addr[i] = 0; port = 0; }
|
||||
|
||||
/** Creates an instance with IP address \c ip and port number \c port (the port number is assumed to be in
|
||||
* host byte order). */
|
||||
RTPIPv6Address(const uint8_t ip[16],uint16_t port = 0):RTPAddress(IPv6Address) { SetIP(ip); RTPIPv6Address::port = port; }
|
||||
|
||||
/** Creates an instance with IP address \c ip and port number \c port (the port number is assumed to be in
|
||||
* host byte order). */
|
||||
RTPIPv6Address(in6_addr ip,uint16_t port = 0):RTPAddress(IPv6Address) { RTPIPv6Address::ip = ip; RTPIPv6Address::port = port; }
|
||||
~RTPIPv6Address() { }
|
||||
|
||||
/** Sets the IP address for this instance to \c ip. */
|
||||
void SetIP(in6_addr ip) { RTPIPv6Address::ip = ip; }
|
||||
|
||||
/** Sets the IP address for this instance to \c ip. */
|
||||
void SetIP(const uint8_t ip[16]) { for (int i = 0 ; i < 16 ; i++) RTPIPv6Address::ip.s6_addr[i] = ip[i]; }
|
||||
|
||||
/** Sets the port number for this instance to \c port, which is interpreted in host byte order. */
|
||||
void SetPort(uint16_t port) { RTPIPv6Address::port = port; }
|
||||
|
||||
/** Copies the IP address of this instance in \c ip. */
|
||||
void GetIP(uint8_t ip[16]) const { for (int i = 0 ; i < 16 ; i++) ip[i] = RTPIPv6Address::ip.s6_addr[i]; }
|
||||
|
||||
/** Returns the IP address of this instance. */
|
||||
in6_addr GetIP() const { return ip; }
|
||||
|
||||
/** Returns the port number contained in this instance in host byte order. */
|
||||
uint16_t GetPort() const { return port; }
|
||||
|
||||
RTPAddress *CreateCopy(RTPMemoryManager *mgr) const;
|
||||
bool IsSameAddress(const RTPAddress *addr) const;
|
||||
bool IsFromSameHost(const RTPAddress *addr) const;
|
||||
|
||||
private:
|
||||
in6_addr ip;
|
||||
uint16_t port;
|
||||
};
|
||||
|
||||
} // end namespace
|
||||
|
||||
#endif // RTP_SUPPORT_IPV6
|
||||
|
||||
#endif // RTPIPV6ADDRESS_H
|
||||
|
@ -1,61 +0,0 @@
|
||||
/*
|
||||
|
||||
This file is a part of JRTPLIB
|
||||
Copyright (c) 1999-2011 Jori Liesenborgs
|
||||
|
||||
Contact: jori.liesenborgs@gmail.com
|
||||
|
||||
This library was developed at the Expertise Centre for Digital Media
|
||||
(http://www.edm.uhasselt.be), a research center of the Hasselt University
|
||||
(http://www.uhasselt.be). The library is based upon work done for
|
||||
my thesis at the School for Knowledge Technology (Belgium/The Netherlands).
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rtpipv6destination.h"
|
||||
|
||||
#ifdef RTP_SUPPORT_IPV6
|
||||
|
||||
#include "rtpinternalutils.h"
|
||||
|
||||
namespace qrtplib
|
||||
{
|
||||
|
||||
std::string RTPIPv6Destination::GetDestinationString() const
|
||||
{
|
||||
uint16_t ip16[8];
|
||||
char str[48];
|
||||
uint16_t portbase = ntohs(rtpaddr.sin6_port);
|
||||
int i,j;
|
||||
for (i = 0,j = 0 ; j < 8 ; j++,i += 2)
|
||||
{
|
||||
ip16[j] = (((uint16_t)rtpaddr.sin6_addr.s6_addr[i])<<8);
|
||||
ip16[j] |= ((uint16_t)rtpaddr.sin6_addr.s6_addr[i+1]);
|
||||
}
|
||||
RTP_SNPRINTF(str,48,"%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X/%d",(int)ip16[0],(int)ip16[1],(int)ip16[2],(int)ip16[3],(int)ip16[4],(int)ip16[5],(int)ip16[6],(int)ip16[7],(int)portbase);
|
||||
return std::string(str);
|
||||
}
|
||||
|
||||
} // end namespace
|
||||
|
||||
#endif // RTP_SUPPORT_IPV6
|
||||
|
||||
|
@ -1,91 +0,0 @@
|
||||
/*
|
||||
|
||||
This file is a part of JRTPLIB
|
||||
Copyright (c) 1999-2017 Jori Liesenborgs
|
||||
|
||||
Contact: jori.liesenborgs@gmail.com
|
||||
|
||||
This library was developed at the Expertise Centre for Digital Media
|
||||
(http://www.edm.uhasselt.be), a research center of the Hasselt University
|
||||
(http://www.uhasselt.be). The library is based upon work done for
|
||||
my thesis at the School for Knowledge Technology (Belgium/The Netherlands).
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file rtpipv6destination.h
|
||||
*/
|
||||
|
||||
#ifndef RTPIPV6DESTINATION_H
|
||||
|
||||
#define RTPIPV6DESTINATION_H
|
||||
|
||||
#include "rtpconfig.h"
|
||||
|
||||
#ifdef RTP_SUPPORT_IPV6
|
||||
|
||||
#include "rtptypes.h"
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
#ifndef RTP_SOCKETTYPE_WINSOCK
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/socket.h>
|
||||
#endif // RTP_SOCKETTYPE_WINSOCK
|
||||
|
||||
namespace qrtplib
|
||||
{
|
||||
|
||||
class JRTPLIB_IMPORTEXPORT RTPIPv6Destination
|
||||
{
|
||||
public:
|
||||
RTPIPv6Destination(in6_addr ip,uint16_t portbase)
|
||||
{
|
||||
memset(&rtpaddr,0,sizeof(struct sockaddr_in6));
|
||||
memset(&rtcpaddr,0,sizeof(struct sockaddr_in6));
|
||||
rtpaddr.sin6_family = AF_INET6;
|
||||
rtpaddr.sin6_port = htons(portbase);
|
||||
rtpaddr.sin6_addr = ip;
|
||||
rtcpaddr.sin6_family = AF_INET6;
|
||||
rtcpaddr.sin6_port = htons(portbase+1);
|
||||
rtcpaddr.sin6_addr = ip;
|
||||
}
|
||||
in6_addr GetIP() const { return rtpaddr.sin6_addr; }
|
||||
bool operator==(const RTPIPv6Destination &src) const
|
||||
{
|
||||
if (rtpaddr.sin6_port == src.rtpaddr.sin6_port && (memcmp(&(src.rtpaddr.sin6_addr),&(rtpaddr.sin6_addr),sizeof(in6_addr)) == 0))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
const struct sockaddr_in6 *GetRTPSockAddr() const { return &rtpaddr; }
|
||||
const struct sockaddr_in6 *GetRTCPSockAddr() const { return &rtcpaddr; }
|
||||
std::string GetDestinationString() const;
|
||||
private:
|
||||
struct sockaddr_in6 rtpaddr;
|
||||
struct sockaddr_in6 rtcpaddr;
|
||||
};
|
||||
|
||||
} // end namespace
|
||||
|
||||
#endif // RTP_SUPPORT_IPV6
|
||||
|
||||
#endif // RTPIPV6DESTINATION_H
|
||||
|
@ -35,9 +35,6 @@
|
||||
#include "rtpdefines.h"
|
||||
#include "rtperrors.h"
|
||||
#include "rtprawpacket.h"
|
||||
#ifdef RTP_SUPPORT_NETINET_IN
|
||||
#include <netinet/in.h>
|
||||
#endif // RTP_SUPPORT_NETINET_IN
|
||||
#include <string.h>
|
||||
|
||||
namespace qrtplib
|
||||
@ -153,7 +150,7 @@ int RTPPacket::ParseRawPacket(RTPRawPacket &rawpack)
|
||||
rtpextheader = (RTPExtensionHeader *)(packetbytes+payloadoffset);
|
||||
payloadoffset += sizeof(RTPExtensionHeader);
|
||||
|
||||
uint16_t exthdrlen = ntohs(rtpextheader->length);
|
||||
uint16_t exthdrlen = m_endian.qToHost(rtpextheader->length);
|
||||
payloadoffset += ((int)exthdrlen)*sizeof(uint32_t);
|
||||
}
|
||||
else
|
||||
@ -171,8 +168,8 @@ int RTPPacket::ParseRawPacket(RTPRawPacket &rawpack)
|
||||
RTPPacket::hasextension = hasextension;
|
||||
if (hasextension)
|
||||
{
|
||||
RTPPacket::extid = ntohs(rtpextheader->extid);
|
||||
RTPPacket::extensionlength = ((int)ntohs(rtpextheader->length))*sizeof(uint32_t);
|
||||
RTPPacket::extid = m_endian.qToHost(rtpextheader->extid);
|
||||
RTPPacket::extensionlength = ((int)m_endian.qToHost(rtpextheader->length))*sizeof(uint32_t);
|
||||
RTPPacket::extension = ((uint8_t *)rtpextheader)+sizeof(RTPExtensionHeader);
|
||||
}
|
||||
|
||||
@ -183,10 +180,10 @@ int RTPPacket::ParseRawPacket(RTPRawPacket &rawpack)
|
||||
// Note: we don't fill in the EXTENDED sequence number here, since we
|
||||
// don't have information about the source here. We just fill in the low
|
||||
// 16 bits
|
||||
RTPPacket::extseqnr = (uint32_t)ntohs(rtpheader->sequencenumber);
|
||||
RTPPacket::extseqnr = (uint32_t)m_endian.qToHost(rtpheader->sequencenumber);
|
||||
|
||||
RTPPacket::timestamp = ntohl(rtpheader->timestamp);
|
||||
RTPPacket::ssrc = ntohl(rtpheader->ssrc);
|
||||
RTPPacket::timestamp = m_endian.qToHost(rtpheader->timestamp);
|
||||
RTPPacket::ssrc = m_endian.qToHost(rtpheader->ssrc);
|
||||
RTPPacket::packet = packetbytes;
|
||||
RTPPacket::payload = packetbytes+payloadoffset;
|
||||
RTPPacket::packetlength = packetlen;
|
||||
@ -209,7 +206,7 @@ uint32_t RTPPacket::GetCSRC(int num) const
|
||||
|
||||
csrcpos = packet+sizeof(RTPHeader)+num*sizeof(uint32_t);
|
||||
csrcval_nbo = (uint32_t *)csrcpos;
|
||||
csrcval_hbo = ntohl(*csrcval_nbo);
|
||||
csrcval_hbo = m_endian.qToHost(*csrcval_nbo);
|
||||
return csrcval_hbo;
|
||||
}
|
||||
|
||||
@ -285,24 +282,24 @@ int RTPPacket::BuildPacket(uint8_t payloadtype,const void *payloaddata,size_t pa
|
||||
rtphdr->extension = 0;
|
||||
rtphdr->csrccount = numcsrcs;
|
||||
rtphdr->payloadtype = payloadtype&127; // make sure high bit isn't set
|
||||
rtphdr->sequencenumber = htons(seqnr);
|
||||
rtphdr->timestamp = htonl(timestamp);
|
||||
rtphdr->ssrc = htonl(ssrc);
|
||||
rtphdr->sequencenumber = qToBigEndian(seqnr);
|
||||
rtphdr->timestamp = qToBigEndian(timestamp);
|
||||
rtphdr->ssrc = qToBigEndian(ssrc);
|
||||
|
||||
uint32_t *curcsrc;
|
||||
int i;
|
||||
|
||||
curcsrc = (uint32_t *)(packet+sizeof(RTPHeader));
|
||||
for (i = 0 ; i < numcsrcs ; i++,curcsrc++)
|
||||
*curcsrc = htonl(csrcs[i]);
|
||||
*curcsrc = qToBigEndian(csrcs[i]);
|
||||
|
||||
payload = packet+sizeof(RTPHeader)+((size_t)numcsrcs)*sizeof(uint32_t);
|
||||
if (gotextension)
|
||||
{
|
||||
RTPExtensionHeader *rtpexthdr = (RTPExtensionHeader *)payload;
|
||||
|
||||
rtpexthdr->extid = htons(extensionid);
|
||||
rtpexthdr->length = htons((uint16_t)extensionlen_numwords);
|
||||
rtpexthdr->extid = qToBigEndian(extensionid);
|
||||
rtpexthdr->length = qToBigEndian((uint16_t)extensionlen_numwords);
|
||||
|
||||
payload += sizeof(RTPExtensionHeader);
|
||||
memcpy(payload,extensiondata,RTPPacket::extensionlength);
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "rtptypes.h"
|
||||
#include "rtptimeutilities.h"
|
||||
#include "rtpmemoryobject.h"
|
||||
#include "rtpendian.h"
|
||||
|
||||
namespace qrtplib
|
||||
{
|
||||
@ -155,6 +156,7 @@ private:
|
||||
bool gotextension,uint16_t extensionid,uint16_t extensionlen_numwords,const void *extensiondata,
|
||||
void *buffer,size_t maxsize);
|
||||
|
||||
RTPEndian m_endian;
|
||||
int error;
|
||||
|
||||
bool hasextension,hasmarker;
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include "rtpsession.h"
|
||||
#include "rtperrors.h"
|
||||
#include "rtpudpv4transmitter.h"
|
||||
#include "rtpudpv6transmitter.h"
|
||||
#include "rtptcptransmitter.h"
|
||||
#include "rtpexternaltransmitter.h"
|
||||
#include "rtpsessionparams.h"
|
||||
@ -121,11 +120,6 @@ int RTPSession::Create(const RTPSessionParams &sessparams,const RTPTransmissionP
|
||||
case RTPTransmitter::IPv4UDPProto:
|
||||
rtptrans = RTPNew(GetMemoryManager(),RTPMEM_TYPE_CLASS_RTPTRANSMITTER) RTPUDPv4Transmitter(GetMemoryManager());
|
||||
break;
|
||||
#ifdef RTP_SUPPORT_IPV6
|
||||
case RTPTransmitter::IPv6UDPProto:
|
||||
rtptrans = RTPNew(GetMemoryManager(),RTPMEM_TYPE_CLASS_RTPTRANSMITTER) RTPUDPv6Transmitter(GetMemoryManager());
|
||||
break;
|
||||
#endif // RTP_SUPPORT_IPV6
|
||||
case RTPTransmitter::ExternalProto:
|
||||
rtptrans = RTPNew(GetMemoryManager(),RTPMEM_TYPE_CLASS_RTPTRANSMITTER) RTPExternalTransmitter(GetMemoryManager());
|
||||
break;
|
||||
|
@ -34,9 +34,6 @@
|
||||
#include "rtpdefines.h"
|
||||
#include "rtpaddress.h"
|
||||
#include "rtpmemorymanager.h"
|
||||
#ifdef RTP_SUPPORT_NETINET_IN
|
||||
#include <netinet/in.h>
|
||||
#endif // RTP_SUPPORT_NETINET_IN
|
||||
|
||||
|
||||
#define ACCEPTPACKETCODE \
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,322 +0,0 @@
|
||||
/*
|
||||
|
||||
This file is a part of JRTPLIB
|
||||
Copyright (c) 1999-2017 Jori Liesenborgs
|
||||
|
||||
Contact: jori.liesenborgs@gmail.com
|
||||
|
||||
This library was developed at the Expertise Centre for Digital Media
|
||||
(http://www.edm.uhasselt.be), a research center of the Hasselt University
|
||||
(http://www.uhasselt.be). The library is based upon work done for
|
||||
my thesis at the School for Knowledge Technology (Belgium/The Netherlands).
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file rtpudpv6transmitter.h
|
||||
*/
|
||||
|
||||
#ifndef RTPUDPV6TRANSMITTER_H
|
||||
|
||||
#define RTPUDPV6TRANSMITTER_H
|
||||
|
||||
#include "rtpconfig.h"
|
||||
|
||||
#ifdef RTP_SUPPORT_IPV6
|
||||
|
||||
#include "rtptransmitter.h"
|
||||
#include "rtpipv6destination.h"
|
||||
#include "rtphashtable.h"
|
||||
#include "rtpkeyhashtable.h"
|
||||
#include "rtpsocketutil.h"
|
||||
#include "rtpabortdescriptors.h"
|
||||
#include <string.h>
|
||||
#include <list>
|
||||
|
||||
#define RTPUDPV6TRANS_HASHSIZE 8317
|
||||
#define RTPUDPV6TRANS_DEFAULTPORTBASE 5000
|
||||
|
||||
#define RTPUDPV6TRANS_RTPRECEIVEBUFFER 32768
|
||||
#define RTPUDPV6TRANS_RTCPRECEIVEBUFFER 32768
|
||||
#define RTPUDPV6TRANS_RTPTRANSMITBUFFER 32768
|
||||
#define RTPUDPV6TRANS_RTCPTRANSMITBUFFER 32768
|
||||
|
||||
namespace qrtplib
|
||||
{
|
||||
|
||||
/** Parameters for the UDP over IPv6 transmitter. */
|
||||
class JRTPLIB_IMPORTEXPORT RTPUDPv6TransmissionParams : public RTPTransmissionParams
|
||||
{
|
||||
public:
|
||||
RTPUDPv6TransmissionParams();
|
||||
|
||||
/** Sets the IP address which is used to bind the sockets to \c ip. */
|
||||
void SetBindIP(in6_addr ip) { bindIP = ip; }
|
||||
|
||||
/** Sets the multicast interface index. */
|
||||
void SetMulticastInterfaceIndex(unsigned int idx) { mcastifidx = idx; }
|
||||
|
||||
/** Sets the RTP portbase to \c pbase. This has to be an even number. */
|
||||
void SetPortbase(uint16_t pbase) { portbase = pbase; }
|
||||
|
||||
/** Sets the multicast TTL to be used to \c mcastTTL. */
|
||||
void SetMulticastTTL(uint8_t mcastTTL) { multicastTTL = mcastTTL; }
|
||||
|
||||
/** Passes a list of IP addresses which will be used as the local IP addresses. */
|
||||
void SetLocalIPList(std::list<in6_addr> &iplist) { localIPs = iplist; }
|
||||
|
||||
/** Clears the list of local IP addresses.
|
||||
* Clears the list of local IP addresses. An empty list will make the transmission component
|
||||
* itself determine the local IP addresses.
|
||||
*/
|
||||
void ClearLocalIPList() { localIPs.clear(); }
|
||||
|
||||
/** Returns the IP address which will be used to bind the sockets. */
|
||||
in6_addr GetBindIP() const { return bindIP; }
|
||||
|
||||
/** Returns the multicast interface index. */
|
||||
unsigned int GetMulticastInterfaceIndex() const { return mcastifidx; }
|
||||
|
||||
/** Returns the RTP portbase which will be used (default is 5000). */
|
||||
uint16_t GetPortbase() const { return portbase; }
|
||||
|
||||
/** Returns the multicast TTL which will be used (default is 1). */
|
||||
uint8_t GetMulticastTTL() const { return multicastTTL; }
|
||||
|
||||
/** Returns the list of local IP addresses. */
|
||||
const std::list<in6_addr> &GetLocalIPList() const { return localIPs; }
|
||||
|
||||
/** Sets the RTP socket's send buffer size. */
|
||||
void SetRTPSendBuffer(int s) { rtpsendbuf = s; }
|
||||
|
||||
/** Sets the RTP socket's receive buffer size. */
|
||||
void SetRTPReceiveBuffer(int s) { rtprecvbuf = s; }
|
||||
|
||||
/** Sets the RTCP socket's send buffer size. */
|
||||
void SetRTCPSendBuffer(int s) { rtcpsendbuf = s; }
|
||||
|
||||
/** Sets the RTCP socket's receive buffer size. */
|
||||
void SetRTCPReceiveBuffer(int s) { rtcprecvbuf = s; }
|
||||
|
||||
/** If non null, the specified abort descriptors will be used to cancel
|
||||
* the function that's waiting for packets to arrive; set to null (the default
|
||||
* to let the transmitter create its own instance. */
|
||||
void SetCreatedAbortDescriptors(RTPAbortDescriptors *desc) { m_pAbortDesc = desc; }
|
||||
|
||||
/** Returns the RTP socket's send buffer size. */
|
||||
int GetRTPSendBuffer() const { return rtpsendbuf; }
|
||||
|
||||
/** Returns the RTP socket's receive buffer size. */
|
||||
int GetRTPReceiveBuffer() const { return rtprecvbuf; }
|
||||
|
||||
/** Returns the RTCP socket's send buffer size. */
|
||||
int GetRTCPSendBuffer() const { return rtcpsendbuf; }
|
||||
|
||||
/** Returns the RTCP socket's receive buffer size. */
|
||||
int GetRTCPReceiveBuffer() const { return rtcprecvbuf; }
|
||||
|
||||
/** If non-null, this RTPAbortDescriptors instance will be used internally,
|
||||
* which can be useful when creating your own poll thread for multiple
|
||||
* sessions. */
|
||||
RTPAbortDescriptors *GetCreatedAbortDescriptors() const { return m_pAbortDesc; }
|
||||
private:
|
||||
uint16_t portbase;
|
||||
in6_addr bindIP;
|
||||
unsigned int mcastifidx;
|
||||
std::list<in6_addr> localIPs;
|
||||
uint8_t multicastTTL;
|
||||
int rtpsendbuf, rtprecvbuf;
|
||||
int rtcpsendbuf, rtcprecvbuf;
|
||||
|
||||
RTPAbortDescriptors *m_pAbortDesc;
|
||||
};
|
||||
|
||||
inline RTPUDPv6TransmissionParams::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;
|
||||
|
||||
m_pAbortDesc = 0;
|
||||
}
|
||||
|
||||
/** Additional information about the UDP over IPv6 transmitter. */
|
||||
class JRTPLIB_IMPORTEXPORT RTPUDPv6TransmissionInfo : public RTPTransmissionInfo
|
||||
{
|
||||
public:
|
||||
RTPUDPv6TransmissionInfo(std::list<in6_addr> iplist, SocketType rtpsock, SocketType rtcpsock,
|
||||
uint16_t rtpport, uint16_t rtcpport) : RTPTransmissionInfo(RTPTransmitter::IPv6UDPProto)
|
||||
{ localIPlist = iplist; rtpsocket = rtpsock; rtcpsocket = rtcpsock; m_rtpPort = rtpport; m_rtcpPort = rtcpport; }
|
||||
|
||||
~RTPUDPv6TransmissionInfo() { }
|
||||
|
||||
/** Returns the list of IPv6 addresses the transmitter considers to be the local IP addresses. */
|
||||
std::list<in6_addr> GetLocalIPList() const { return localIPlist; }
|
||||
|
||||
/** Returns the socket descriptor used for receiving and transmitting RTP packets. */
|
||||
SocketType GetRTPSocket() const { return rtpsocket; }
|
||||
|
||||
/** Returns the socket descriptor used for receiving and transmitting RTCP packets. */
|
||||
SocketType GetRTCPSocket() const { return rtcpsocket; }
|
||||
|
||||
/** Returns the port number that the RTP socket receives packets on. */
|
||||
uint16_t GetRTPPort() const { return m_rtpPort; }
|
||||
|
||||
/** Returns the port number that the RTCP socket receives packets on. */
|
||||
uint16_t GetRTCPPort() const { return m_rtcpPort; }
|
||||
private:
|
||||
std::list<in6_addr> localIPlist;
|
||||
SocketType rtpsocket,rtcpsocket;
|
||||
uint16_t m_rtpPort, m_rtcpPort;
|
||||
};
|
||||
|
||||
class JRTPLIB_IMPORTEXPORT RTPUDPv6Trans_GetHashIndex_IPv6Dest
|
||||
{
|
||||
public:
|
||||
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; }
|
||||
};
|
||||
|
||||
class JRTPLIB_IMPORTEXPORT RTPUDPv6Trans_GetHashIndex_in6_addr
|
||||
{
|
||||
public:
|
||||
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; }
|
||||
};
|
||||
|
||||
#define RTPUDPV6TRANS_HEADERSIZE (40+8)
|
||||
|
||||
/** An UDP over IPv6 transmitter.
|
||||
* This class inherits the RTPTransmitter interface and implements a transmission component
|
||||
* which uses UDP over IPv6 to send and receive RTP and RTCP data. The component's parameters
|
||||
* are described by the class RTPUDPv6TransmissionParams. The functions which have an RTPAddress
|
||||
* argument require an argument of RTPIPv6Address. The GetTransmissionInfo member function
|
||||
* returns an instance of type RTPUDPv6TransmissionInfo.
|
||||
*/
|
||||
class JRTPLIB_IMPORTEXPORT RTPUDPv6Transmitter : public RTPTransmitter
|
||||
{
|
||||
public:
|
||||
RTPUDPv6Transmitter(RTPMemoryManager *mgr);
|
||||
~RTPUDPv6Transmitter();
|
||||
|
||||
int Init(bool treadsafe);
|
||||
int Create(size_t maxpacksize,const RTPTransmissionParams *transparams);
|
||||
void Destroy();
|
||||
RTPTransmissionInfo *GetTransmissionInfo();
|
||||
void DeleteTransmissionInfo(RTPTransmissionInfo *inf);
|
||||
|
||||
int GetLocalHostName(uint8_t *buffer,size_t *bufferlength);
|
||||
bool ComesFromThisTransmitter(const RTPAddress *addr);
|
||||
size_t GetHeaderOverhead() { return RTPUDPV6TRANS_HEADERSIZE; }
|
||||
|
||||
int Poll();
|
||||
int WaitForIncomingData(const RTPTime &delay,bool *dataavailable = 0);
|
||||
int AbortWait();
|
||||
|
||||
int SendRTPData(const void *data,size_t len);
|
||||
int SendRTCPData(const void *data,size_t len);
|
||||
|
||||
int AddDestination(const RTPAddress &addr);
|
||||
int DeleteDestination(const RTPAddress &addr);
|
||||
void ClearDestinations();
|
||||
|
||||
bool SupportsMulticasting();
|
||||
int JoinMulticastGroup(const RTPAddress &addr);
|
||||
int LeaveMulticastGroup(const RTPAddress &addr);
|
||||
void LeaveAllMulticastGroups();
|
||||
|
||||
int SetReceiveMode(RTPTransmitter::ReceiveMode m);
|
||||
int AddToIgnoreList(const RTPAddress &addr);
|
||||
int DeleteFromIgnoreList(const RTPAddress &addr);
|
||||
void ClearIgnoreList();
|
||||
int AddToAcceptList(const RTPAddress &addr);
|
||||
int DeleteFromAcceptList(const RTPAddress &addr);
|
||||
void ClearAcceptList();
|
||||
int SetMaximumPacketSize(size_t s);
|
||||
|
||||
bool NewDataAvailable();
|
||||
RTPRawPacket *GetNextPacket();
|
||||
|
||||
private:
|
||||
int CreateLocalIPList();
|
||||
bool GetLocalIPList_Interfaces();
|
||||
void GetLocalIPList_DNS();
|
||||
void AddLoopbackAddress();
|
||||
void FlushPackets();
|
||||
int PollSocket(bool rtp);
|
||||
int ProcessAddAcceptIgnoreEntry(in6_addr ip,uint16_t port);
|
||||
int ProcessDeleteAcceptIgnoreEntry(in6_addr ip,uint16_t port);
|
||||
#ifdef RTP_SUPPORT_IPV6MULTICAST
|
||||
bool SetMulticastTTL(uint8_t ttl);
|
||||
#endif // RTP_SUPPORT_IPV6MULTICAST
|
||||
bool ShouldAcceptData(in6_addr srcip,uint16_t srcport);
|
||||
void ClearAcceptIgnoreInfo();
|
||||
|
||||
bool init;
|
||||
bool created;
|
||||
bool waitingfordata;
|
||||
SocketType rtpsock,rtcpsock;
|
||||
in6_addr bindIP;
|
||||
unsigned int mcastifidx;
|
||||
std::list<in6_addr> localIPs;
|
||||
uint16_t portbase;
|
||||
uint8_t multicastTTL;
|
||||
RTPTransmitter::ReceiveMode receivemode;
|
||||
|
||||
uint8_t *localhostname;
|
||||
size_t localhostnamelength;
|
||||
|
||||
RTPHashTable<const RTPIPv6Destination,RTPUDPv6Trans_GetHashIndex_IPv6Dest,RTPUDPV6TRANS_HASHSIZE> destinations;
|
||||
#ifdef RTP_SUPPORT_IPV6MULTICAST
|
||||
RTPHashTable<const in6_addr,RTPUDPv6Trans_GetHashIndex_in6_addr,RTPUDPV6TRANS_HASHSIZE> multicastgroups;
|
||||
#endif // RTP_SUPPORT_IPV6MULTICAST
|
||||
std::list<RTPRawPacket*> rawpacketlist;
|
||||
|
||||
bool supportsmulticasting;
|
||||
size_t maxpacksize;
|
||||
|
||||
class PortInfo
|
||||
{
|
||||
public:
|
||||
PortInfo() { all = false; }
|
||||
|
||||
bool all;
|
||||
std::list<uint16_t> portlist;
|
||||
};
|
||||
|
||||
RTPKeyHashTable<const in6_addr,PortInfo*,RTPUDPv6Trans_GetHashIndex_in6_addr,RTPUDPV6TRANS_HASHSIZE> acceptignoreinfo;
|
||||
RTPAbortDescriptors m_abortDesc;
|
||||
RTPAbortDescriptors *m_pAbortDesc;
|
||||
|
||||
};
|
||||
|
||||
} // end namespace
|
||||
|
||||
#endif // RTP_SUPPORT_IPV6
|
||||
|
||||
#endif // RTPUDPV6TRANSMITTER_H
|
||||
|
Loading…
Reference in New Issue
Block a user