diff --git a/.vscode/launch.json b/.vscode/launch.json index 51b59bd..586cf9f 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -6,7 +6,25 @@ "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/bin/lib/test", - "args": ["rtsp://176.10.0.4:8554/stream","0"], + "args": ["rtsp://122.97.218.170:8604/openUrl/V5nXRHa?params=eyJwcm90b2NhbCI6InJ0c3AiLCJjbGllbnRUeXBlIjoib3Blbl9hcGkiLCJleHByaWVUaW1lIjotMSwicHJvdG9jb2wiOiJydHNwIiwiZXhwaXJlVGltZSI6MzAwLCJlbmFibGVNR0MiOnRydWUsImV4cGFuZCI6InN0YW5kYXJkPXJ0c3Amc3RyZWFtZm9ybT1ydHAiLCJhIjoiMTBjZjM4N2JjY2Y5NDg3YzhjNWYzNjE2M2ViMWUyNTJ8MXwwfDEiLCJ0IjoxfQ==","0"], + "stopAtEntry": false, + "cwd": "${workspaceFolder}/bin/lib", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + },{ + "name": "gen28181ps", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/bin/lib/gen28181ps", + "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}/bin/lib", "environment": [], diff --git a/3rdparty/jrtp_export/build_jrtp.sh b/3rdparty/jrtp_export/build_jrtp.sh new file mode 100644 index 0000000..74cdc94 --- /dev/null +++ b/3rdparty/jrtp_export/build_jrtp.sh @@ -0,0 +1,26 @@ +#!/bin/bash +currentPath=$(pwd) + +libPath=$(pwd)/../jrtplib-3.11.2 + + +if [ -d "./jrtplib" ]; then + rm -rf jrtplib +fi +mkdir jrtplib +cd jrtplib +installPath=$(pwd) + + +cd ${libPath} +if [ -d "./build" ]; then + rm -rf build +fi +mkdir build +cd build + +cmake -DCMAKE_INSTALL_PREFIX=${installPath} -DCMAKE_USE_OPENSSL=OFF .. +make +make install + +cd .. diff --git a/3rdparty/jrtp_export/build_jthread.sh b/3rdparty/jrtp_export/build_jthread.sh new file mode 100644 index 0000000..24d9ec6 --- /dev/null +++ b/3rdparty/jrtp_export/build_jthread.sh @@ -0,0 +1,25 @@ +#!/bin/bash +currentPath=$(pwd) + +libPath=$(pwd)/../jthread-1.3.3 + +if [ -d "./jthread" ]; then + rm -rf jthread +fi +mkdir jthread +cd jthread +installPath=$(pwd) + + +cd ${libPath} +if [ -d "./build" ]; then + rm -rf build +fi +mkdir build +cd build + +cmake -DCMAKE_INSTALL_PREFIX=${installPath} -DCMAKE_USE_OPENSSL=OFF .. +make +make install + +cd .. diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtcpapppacket.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtcpapppacket.h new file mode 100644 index 0000000..170b1d3 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtcpapppacket.h @@ -0,0 +1,132 @@ +/* + + 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 rtcpapppacket.h + */ + +#ifndef RTCPAPPPACKET_H + +#define RTCPAPPPACKET_H + +#include "rtpconfig.h" +#include "rtcppacket.h" +#include "rtpstructs.h" +#ifdef RTP_SUPPORT_NETINET_IN + #include +#endif // RTP_SUPPORT_NETINET_IN + +namespace jrtplib +{ + +class RTCPCompoundPacket; + +/** Describes an RTCP APP packet. */ +class JRTPLIB_IMPORTEXPORT RTCPAPPPacket : public RTCPPacket +{ +public: + /** Creates an instance based on the data in \c data with length \c datalen. + * Creates an instance based on the data in \c data with length \c datalen. Since the \c data pointer + * is referenced inside the class (no copy of the data is made) one must make sure that the memory it + * points to is valid as long as the class instance exists. + */ + RTCPAPPPacket(uint8_t *data,size_t datalen); + ~RTCPAPPPacket() { } + + /** Returns the subtype contained in the APP packet. */ + uint8_t GetSubType() const; + + /** Returns the SSRC of the source which sent this packet. */ + uint32_t GetSSRC() const; + + /** Returns the name contained in the APP packet. + * Returns the name contained in the APP packet. This alway consists of four bytes and is not NULL-terminated. + */ + uint8_t *GetName(); + + /** Returns a pointer to the actual data. */ + uint8_t *GetAPPData(); + + /** Returns the length of the actual data. */ + size_t GetAPPDataLength() const; +#ifdef RTPDEBUG + void Dump(); +#endif // RTPDEBUG +private: + size_t appdatalen; +}; + +inline uint8_t RTCPAPPPacket::GetSubType() const +{ + if (!knownformat) + return 0; + RTCPCommonHeader *hdr = (RTCPCommonHeader *)data; + return hdr->count; +} + +inline uint32_t RTCPAPPPacket::GetSSRC() const +{ + if (!knownformat) + return 0; + + uint32_t *ssrc = (uint32_t *)(data+sizeof(RTCPCommonHeader)); + return ntohl(*ssrc); +} + +inline uint8_t *RTCPAPPPacket::GetName() +{ + if (!knownformat) + return 0; + + return (data+sizeof(RTCPCommonHeader)+sizeof(uint32_t)); +} + +inline uint8_t *RTCPAPPPacket::GetAPPData() +{ + if (!knownformat) + return 0; + if (appdatalen == 0) + return 0; + return (data+sizeof(RTCPCommonHeader)+sizeof(uint32_t)*2); +} + +inline size_t RTCPAPPPacket::GetAPPDataLength() const +{ + if (!knownformat) + return 0; + return appdatalen; +} + +} // end namespace + +#endif // RTCPAPPPACKET_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtcpbyepacket.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtcpbyepacket.h new file mode 100644 index 0000000..9bd0762 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtcpbyepacket.h @@ -0,0 +1,140 @@ +/* + + 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 rtcpbyepacket.h + */ + +#ifndef RTCPBYEPACKET_H + +#define RTCPBYEPACKET_H + +#include "rtpconfig.h" +#include "rtcppacket.h" +#include "rtpstructs.h" +#ifdef RTP_SUPPORT_NETINET_IN + #include +#endif // RTP_SUPPORT_NETINET_IN + +namespace jrtplib +{ + +class RTCPCompoundPacket; + +/** Describes an RTCP BYE packet. */ +class JRTPLIB_IMPORTEXPORT RTCPBYEPacket : public RTCPPacket +{ +public: + /** Creates an instance based on the data in \c data with length \c datalen. + * Creates an instance based on the data in \c data with length \c datalen. Since the \c data pointer + * is referenced inside the class (no copy of the data is made) one must make sure that the memory it + * points to is valid as long as the class instance exists. + */ + RTCPBYEPacket(uint8_t *data,size_t datalen); + ~RTCPBYEPacket() { } + + /** Returns the number of SSRC identifiers present in this BYE packet. */ + int GetSSRCCount() const; + + /** Returns the SSRC described by \c index which may have a value from 0 to GetSSRCCount()-1 + * (note that no check is performed to see if \c index is valid). + */ + uint32_t GetSSRC(int index) const; // note: no check is performed to see if index is valid! + + /** Returns true if the BYE packet contains a reason for leaving. */ + bool HasReasonForLeaving() const; + + /** Returns the length of the string which describes why the source(s) left. */ + size_t GetReasonLength() const; + + /** Returns the actual reason for leaving data. */ + uint8_t *GetReasonData(); + +#ifdef RTPDEBUG + void Dump(); +#endif // RTPDEBUG +private: + size_t reasonoffset; +}; + +inline int RTCPBYEPacket::GetSSRCCount() const +{ + if (!knownformat) + return 0; + + RTCPCommonHeader *hdr = (RTCPCommonHeader *)data; + return (int)(hdr->count); +} + +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); +} + +inline bool RTCPBYEPacket::HasReasonForLeaving() const +{ + if (!knownformat) + return false; + if (reasonoffset == 0) + return false; + return true; +} + +inline size_t RTCPBYEPacket::GetReasonLength() const +{ + if (!knownformat) + return 0; + if (reasonoffset == 0) + return 0; + uint8_t *reasonlen = (data+reasonoffset); + return (size_t)(*reasonlen); +} + +inline uint8_t *RTCPBYEPacket::GetReasonData() +{ + if (!knownformat) + return 0; + if (reasonoffset == 0) + return 0; + uint8_t *reasonlen = (data+reasonoffset); + if ((*reasonlen) == 0) + return 0; + return (data+reasonoffset+1); +} + +} // end namespace + +#endif // RTCPBYEPACKET_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtcpcompoundpacket.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtcpcompoundpacket.h new file mode 100644 index 0000000..a165707 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtcpcompoundpacket.h @@ -0,0 +1,112 @@ +/* + + 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 rtcpcompoundpacket.h + */ + +#ifndef RTCPCOMPOUNDPACKET_H + +#define RTCPCOMPOUNDPACKET_H + +#include "rtpconfig.h" +#include "rtptypes.h" +#include "rtpmemoryobject.h" +#include + +namespace jrtplib +{ + +class RTPRawPacket; +class RTCPPacket; + +/** Represents an RTCP compound packet. */ +class JRTPLIB_IMPORTEXPORT RTCPCompoundPacket : public RTPMemoryObject +{ + JRTPLIB_NO_COPY(RTCPCompoundPacket) +public: + /** Creates an RTCPCompoundPacket instance from the data in \c rawpack, installing a memory manager if specified. */ + RTCPCompoundPacket(RTPRawPacket &rawpack, RTPMemoryManager *memmgr = 0); + + /** Creates an RTCPCompoundPacket instance from the data in \c packet}, with size \c len. + * Creates an RTCPCompoundPacket instance from the data in \c packet}, with size \c len. The \c deletedata + * flag specifies if the data in \c packet should be deleted when the compound packet is destroyed. If + * specified, a memory manager will be installed. + */ + RTCPCompoundPacket(uint8_t *packet, size_t len, bool deletedata = true, RTPMemoryManager *memmgr = 0); +protected: + RTCPCompoundPacket(RTPMemoryManager *memmgr); // this is for the compoundpacket builder +public: + virtual ~RTCPCompoundPacket(); + + /** Checks if the RTCP compound packet was created successfully. + * If the raw packet data in the constructor could not be parsed, this function returns the error code of + * what went wrong. If the packet had an invalid format, the return value is \c ERR_RTP_RTCPCOMPOUND_INVALIDPACKET. + */ + int GetCreationError() { return error; } + + /** Returns a pointer to the data of the entire RTCP compound packet. */ + uint8_t *GetCompoundPacketData() { return compoundpacket; } + + /** Returns the size of the entire RTCP compound packet. */ + size_t GetCompoundPacketLength() const { return compoundpacketlength; } + + /** Starts the iteration over the individual RTCP packets in the RTCP compound packet. */ + void GotoFirstPacket() { rtcppackit = rtcppacklist.begin(); } + + /** Returns a pointer to the next individual RTCP packet. + * Returns a pointer to the next individual RTCP packet. Note that no \c delete call may be done + * on the RTCPPacket instance which is returned. + */ + RTCPPacket *GetNextPacket() { if (rtcppackit == rtcppacklist.end()) return 0; RTCPPacket *p = *rtcppackit; rtcppackit++; return p; } + +#ifdef RTPDEBUG + void Dump(); +#endif // RTPDEBUG +protected: + void ClearPacketList(); + int ParseData(uint8_t *packet, size_t len); + + int error; + + uint8_t *compoundpacket; + size_t compoundpacketlength; + bool deletepacket; + + std::list rtcppacklist; + std::list::const_iterator rtcppackit; +}; + +} // end namespace + +#endif // RTCPCOMPOUNDPACKET_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtcpcompoundpacketbuilder.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtcpcompoundpacketbuilder.h new file mode 100644 index 0000000..24245bd --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtcpcompoundpacketbuilder.h @@ -0,0 +1,400 @@ +/* + + 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 rtcpcompoundpacketbuilder.h + */ + +#ifndef RTCPCOMPOUNDPACKETBUILDER_H + +#define RTCPCOMPOUNDPACKETBUILDER_H + +#include "rtpconfig.h" +#include "rtcpcompoundpacket.h" +#include "rtptimeutilities.h" +#include "rtcpsdespacket.h" +#include "rtperrors.h" +#include + +namespace jrtplib +{ + +class RTPMemoryManager; + +/** This class can be used to construct an RTCP compound packet. + * The RTCPCompoundPacketBuilder class can be used to construct an RTCP compound packet. It inherits the member + * functions of RTCPCompoundPacket which can be used to access the information in the compound packet once it has + * been built successfully. The member functions described below return \c ERR_RTP_RTCPCOMPPACKBUILDER_NOTENOUGHBYTESLEFT + * if the action would cause the maximum allowed size to be exceeded. + */ +class JRTPLIB_IMPORTEXPORT RTCPCompoundPacketBuilder : public RTCPCompoundPacket +{ +public: + /** Constructs an RTCPCompoundPacketBuilder instance, optionally installing a memory manager. */ + RTCPCompoundPacketBuilder(RTPMemoryManager *memmgr = 0); + ~RTCPCompoundPacketBuilder(); + + /** Starts building an RTCP compound packet with maximum size \c maxpacketsize. + * Starts building an RTCP compound packet with maximum size \c maxpacketsize. New memory will be allocated + * to store the packet. + */ + int InitBuild(size_t maxpacketsize); + + /** Starts building a RTCP compound packet. + * Starts building a RTCP compound packet. Data will be stored in \c externalbuffer which + * can contain \c buffersize bytes. + */ + int InitBuild(void *externalbuffer,size_t buffersize); + + /** Adds a sender report to the compound packet. + * Tells the packet builder that the packet should start with a sender report which will contain + * the sender information specified by this function's arguments. Once the sender report is started, + * report blocks can be added using the AddReportBlock function. + */ + int StartSenderReport(uint32_t senderssrc,const RTPNTPTime &ntptimestamp,uint32_t rtptimestamp, + uint32_t packetcount,uint32_t octetcount); + + /** Adds a receiver report to the compound packet. + * Tells the packet builder that the packet should start with a receiver report which will contain + * he sender SSRC \c senderssrc. Once the sender report is started, report blocks can be added using the + * AddReportBlock function. + */ + int StartReceiverReport(uint32_t senderssrc); + + /** Adds the report block information specified by the function's arguments. + * Adds the report block information specified by the function's arguments. If more than 31 report blocks + * are added, the builder will automatically use a new RTCP receiver report packet. + */ + int AddReportBlock(uint32_t ssrc,uint8_t fractionlost,int32_t packetslost,uint32_t exthighestseq, + uint32_t jitter,uint32_t lsr,uint32_t dlsr); + + /** Starts an SDES chunk for participant \c ssrc. */ + int AddSDESSource(uint32_t ssrc); + + /** Adds a normal (non-private) SDES item of type \c t to the current SDES chunk. + * Adds a normal (non-private) SDES item of type \c t to the current SDES chunk. The item's value + * will have length \c itemlength and will contain the data \c itemdata. + */ + int AddSDESNormalItem(RTCPSDESPacket::ItemType t,const void *itemdata,uint8_t itemlength); +#ifdef RTP_SUPPORT_SDESPRIV + /** Adds an SDES PRIV item described by the function's arguments to the current SDES chunk. */ + int AddSDESPrivateItem(const void *prefixdata,uint8_t prefixlength,const void *valuedata, + uint8_t valuelength); +#endif // RTP_SUPPORT_SDESPRIV + + /** Adds a BYE packet to the compound packet. + * Adds a BYE packet to the compound packet. It will contain \c numssrcs source identifiers specified in + * \c ssrcs and will indicate as reason for leaving the string of length \c reasonlength + * containing data \c reasondata. + */ + int AddBYEPacket(uint32_t *ssrcs,uint8_t numssrcs,const void *reasondata,uint8_t reasonlength); + + /** Adds the APP packet specified by the arguments to the compound packet. + * Adds the APP packet specified by the arguments to the compound packet. Note that \c appdatalen has to be + * a multiple of four. + */ + int AddAPPPacket(uint8_t subtype,uint32_t ssrc,const uint8_t name[4],const void *appdata,size_t appdatalen); + + /** Finishes building the compound packet. + * Finishes building the compound packet. If successful, the RTCPCompoundPacket member functions + * can be used to access the RTCP packet data. + */ + int EndBuild(); + +#ifdef RTP_SUPPORT_RTCPUNKNOWN + /** Adds the RTCP packet specified by the arguments to the compound packet. + * Adds the RTCP packet specified by the arguments to the compound packet. + */ + int AddUnknownPacket(uint8_t payload_type, uint8_t subtype, uint32_t ssrc, const void *data, size_t len); +#endif // RTP_SUPPORT_RTCPUNKNOWN +private: + class Buffer + { + public: + Buffer():packetdata(0),packetlength(0) { } + Buffer(uint8_t *data,size_t len):packetdata(data),packetlength(len) { } + + uint8_t *packetdata; + size_t packetlength; + }; + + class Report : public RTPMemoryObject + { + public: + Report(RTPMemoryManager *mgr) : RTPMemoryObject(mgr) + { + headerdata = (uint8_t *)headerdata32; + isSR = false; + headerlength = 0; + } + ~Report() { Clear(); } + + void Clear() + { + std::list::const_iterator it; + for (it = reportblocks.begin() ; it != reportblocks.end() ; it++) + { + if ((*it).packetdata) + RTPDeleteByteArray((*it).packetdata,GetMemoryManager()); + } + reportblocks.clear(); + isSR = false; + headerlength = 0; + } + + size_t NeededBytes() + { + size_t x,n,d,r; + n = reportblocks.size(); + if (n == 0) + { + if (headerlength == 0) + return 0; + x = sizeof(RTCPCommonHeader)+headerlength; + } + else + { + x = n*sizeof(RTCPReceiverReport); + d = n/31; // max 31 reportblocks per report + r = n%31; + if (r != 0) + d++; + x += d*(sizeof(RTCPCommonHeader)+sizeof(uint32_t)); /* header and SSRC */ + if (isSR) + x += sizeof(RTCPSenderReport); + } + return x; + } + + size_t NeededBytesWithExtraReportBlock() + { + size_t x,n,d,r; + n = reportblocks.size() + 1; // +1 for the extra block + x = n*sizeof(RTCPReceiverReport); + d = n/31; // max 31 reportblocks per report + r = n%31; + if (r != 0) + d++; + x += d*(sizeof(RTCPCommonHeader)+sizeof(uint32_t)); /* header and SSRC */ + if (isSR) + x += sizeof(RTCPSenderReport); + return x; + } + + bool isSR; + + uint8_t *headerdata; + uint32_t headerdata32[(sizeof(uint32_t)+sizeof(RTCPSenderReport))/sizeof(uint32_t)]; // either for ssrc and sender info or just ssrc + size_t headerlength; + std::list reportblocks; + }; + + class SDESSource : public RTPMemoryObject + { + public: + SDESSource(uint32_t s,RTPMemoryManager *mgr) : RTPMemoryObject(mgr),ssrc(s),totalitemsize(0) { } + ~SDESSource() + { + std::list::const_iterator it; + for (it = items.begin() ; it != items.end() ; it++) + { + if ((*it).packetdata) + RTPDeleteByteArray((*it).packetdata,GetMemoryManager()); + } + items.clear(); + } + + size_t NeededBytes() + { + size_t x,r; + x = totalitemsize + 1; // +1 for the 0 byte which terminates the item list + r = x%sizeof(uint32_t); + if (r != 0) + x += (sizeof(uint32_t)-r); // make sure it ends on a 32 bit boundary + x += sizeof(uint32_t); // for ssrc + return x; + } + + size_t NeededBytesWithExtraItem(uint8_t itemdatalength) + { + size_t x,r; + x = totalitemsize + sizeof(RTCPSDESHeader) + (size_t)itemdatalength + 1; + r = x%sizeof(uint32_t); + if (r != 0) + x += (sizeof(uint32_t)-r); // make sure it ends on a 32 bit boundary + x += sizeof(uint32_t); // for ssrc + return x; + } + + void AddItem(uint8_t *buf,size_t len) + { + Buffer b(buf,len); + totalitemsize += len; + items.push_back(b); + } + + uint32_t ssrc; + std::list items; + private: + size_t totalitemsize; + }; + + class SDES : public RTPMemoryObject + { + public: + SDES(RTPMemoryManager *mgr) : RTPMemoryObject(mgr) { sdesit = sdessources.end(); } + ~SDES() { Clear(); } + + void Clear() + { + std::list::const_iterator it; + + for (it = sdessources.begin() ; it != sdessources.end() ; it++) + RTPDelete(*it,GetMemoryManager()); + sdessources.clear(); + } + + int AddSSRC(uint32_t ssrc) + { + SDESSource *s = RTPNew(GetMemoryManager(),RTPMEM_TYPE_CLASS_SDESSOURCE) SDESSource(ssrc,GetMemoryManager()); + if (s == 0) + return ERR_RTP_OUTOFMEM; + sdessources.push_back(s); + sdesit = sdessources.end(); + sdesit--; + return 0; + } + + int AddItem(uint8_t *buf,size_t len) + { + if (sdessources.empty()) + return ERR_RTP_RTCPCOMPPACKBUILDER_NOCURRENTSOURCE; + (*sdesit)->AddItem(buf,len); + return 0; + } + + size_t NeededBytes() + { + std::list::const_iterator it; + size_t x = 0; + size_t n,d,r; + + if (sdessources.empty()) + return 0; + + for (it = sdessources.begin() ; it != sdessources.end() ; it++) + x += (*it)->NeededBytes(); + n = sdessources.size(); + d = n/31; + r = n%31; + if (r != 0) + d++; + x += d*sizeof(RTCPCommonHeader); + return x; + } + + size_t NeededBytesWithExtraItem(uint8_t itemdatalength) + { + std::list::const_iterator it; + size_t x = 0; + size_t n,d,r; + + if (sdessources.empty()) + return 0; + + for (it = sdessources.begin() ; it != sdesit ; it++) + x += (*it)->NeededBytes(); + x += (*sdesit)->NeededBytesWithExtraItem(itemdatalength); + n = sdessources.size(); + d = n/31; + r = n%31; + if (r != 0) + d++; + x += d*sizeof(RTCPCommonHeader); + return x; + } + + size_t NeededBytesWithExtraSource() + { + std::list::const_iterator it; + size_t x = 0; + size_t n,d,r; + + if (sdessources.empty()) + return 0; + + for (it = sdessources.begin() ; it != sdessources.end() ; it++) + x += (*it)->NeededBytes(); + + // for the extra source we'll need at least 8 bytes (ssrc and four 0 bytes) + x += sizeof(uint32_t)*2; + + n = sdessources.size() + 1; // also, the number of sources will increase + d = n/31; + r = n%31; + if (r != 0) + d++; + x += d*sizeof(RTCPCommonHeader); + return x; + } + + std::list sdessources; + private: + std::list::const_iterator sdesit; + }; + + size_t maximumpacketsize; + uint8_t *buffer; + bool external; + bool arebuilding; + + Report report; + SDES sdes; + + std::list byepackets; + size_t byesize; + + std::list apppackets; + size_t appsize; + +#ifdef RTP_SUPPORT_RTCPUNKNOWN + std::list unknownpackets; + size_t unknownsize; +#endif // RTP_SUPPORT_RTCPUNKNOWN + + void ClearBuildBuffers(); +}; + +} // end namespace + +#endif // RTCPCOMPOUNDPACKETBUILDER_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtcppacket.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtcppacket.h new file mode 100644 index 0000000..3e74592 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtcppacket.h @@ -0,0 +1,95 @@ +/* + + 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 rtcppacket.h + */ + +#ifndef RTCPPACKET_H + +#define RTCPPACKET_H + +#include "rtpconfig.h" +#include "rtptypes.h" + +namespace jrtplib +{ + +class RTCPCompoundPacket; + +/** Base class for specific types of RTCP packets. */ +class JRTPLIB_IMPORTEXPORT RTCPPacket +{ + JRTPLIB_NO_COPY(RTCPPacket) +public: + /** Identifies the specific kind of RTCP packet. */ + enum PacketType + { + SR, /**< An RTCP sender report. */ + RR, /**< An RTCP receiver report. */ + SDES, /**< An RTCP source description packet. */ + BYE, /**< An RTCP bye packet. */ + APP, /**< An RTCP packet containing application specific data. */ + Unknown /**< The type of RTCP packet was not recognized. */ + }; +protected: + RTCPPacket(PacketType t,uint8_t *d,size_t dlen) : data(d),datalen(dlen),packettype(t) { knownformat = false; } +public: + virtual ~RTCPPacket() { } + + /** Returns \c true if the subclass was able to interpret the data and \c false otherwise. */ + bool IsKnownFormat() const { return knownformat; } + + /** Returns the actual packet type which the subclass implements. */ + PacketType GetPacketType() const { return packettype; } + + /** Returns a pointer to the data of this RTCP packet. */ + uint8_t *GetPacketData() { return data; } + + /** Returns the length of this RTCP packet. */ + size_t GetPacketLength() const { return datalen; } + +#ifdef RTPDEBUG + virtual void Dump(); +#endif // RTPDEBUG +protected: + uint8_t *data; + size_t datalen; + bool knownformat; +private: + const PacketType packettype; +}; + +} // end namespace + +#endif // RTCPPACKET_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtcppacketbuilder.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtcppacketbuilder.h new file mode 100644 index 0000000..1f3be70 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtcppacketbuilder.h @@ -0,0 +1,229 @@ +/* + + 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 rtcppacketbuilder.h + */ + +#ifndef RTCPPACKETBUILDER_H + +#define RTCPPACKETBUILDER_H + +#include "rtpconfig.h" +#include "rtptypes.h" +#include "rtperrors.h" +#include "rtcpsdesinfo.h" +#include "rtptimeutilities.h" +#include "rtpmemoryobject.h" + +namespace jrtplib +{ + +class RTPSources; +class RTPPacketBuilder; +class RTCPScheduler; +class RTCPCompoundPacket; +class RTCPCompoundPacketBuilder; + +/** This class can be used to build RTCP compound packets, on a higher level than the RTCPCompoundPacketBuilder. + * The class RTCPPacketBuilder can be used to build RTCP compound packets. This class is more high-level + * than the RTCPCompoundPacketBuilder class: it uses the information of an RTPPacketBuilder instance and of + * an RTPSources instance to automatically generate the next compound packet which should be sent. It also + * provides functions to determine when SDES items other than the CNAME item should be sent. + */ +class JRTPLIB_IMPORTEXPORT RTCPPacketBuilder : public RTPMemoryObject +{ +public: + /** Creates an RTCPPacketBuilder instance. + * Creates an instance which will use the source table \c sources and the RTP packet builder + * \c rtppackbuilder to determine the information for the next RTCP compound packet. Optionally, + * the memory manager \c mgr can be installed. + */ + RTCPPacketBuilder(RTPSources &sources,RTPPacketBuilder &rtppackbuilder, RTPMemoryManager *mgr = 0); + ~RTCPPacketBuilder(); + + /** Initializes the builder. + * Initializes the builder to use the maximum allowed packet size \c maxpacksize, timestamp unit + * \c timestampunit and the SDES CNAME item specified by \c cname with length \c cnamelen. + * The timestamp unit is defined as a time interval divided by the timestamp interval corresponding to + * that interval: for 8000 Hz audio this would be 1/8000. + */ + int Init(size_t maxpacksize,double timestampunit,const void *cname,size_t cnamelen); + + /** Cleans up the builder. */ + void Destroy(); + + /** Sets the timestamp unit to be used to \c tsunit. + * Sets the timestamp unit to be used to \c tsunit. The timestamp unit is defined as a time interval + * divided by the timestamp interval corresponding to that interval: for 8000 Hz audio this would + * be 1/8000. + */ + int SetTimestampUnit(double tsunit) { if (!init) return ERR_RTP_RTCPPACKETBUILDER_NOTINIT; if (tsunit < 0) return ERR_RTP_RTCPPACKETBUILDER_ILLEGALTIMESTAMPUNIT; timestampunit = tsunit; return 0; } + + /** Sets the maximum size allowed size of an RTCP compound packet to \c maxpacksize. */ + int SetMaximumPacketSize(size_t maxpacksize) { if (!init) return ERR_RTP_RTCPPACKETBUILDER_NOTINIT; if (maxpacksize < RTP_MINPACKETSIZE) return ERR_RTP_RTCPPACKETBUILDER_ILLEGALMAXPACKSIZE; maxpacketsize = maxpacksize; return 0; } + + /** This function allows you to inform RTCP packet builder about the delay between sampling the first + * sample of a packet and sending the packet. + * This function allows you to inform RTCP packet builder about the delay between sampling the first + * sample of a packet and sending the packet. This delay is taken into account when calculating the + * relation between RTP timestamp and wallclock time, used for inter-media synchronization. + */ + int SetPreTransmissionDelay(const RTPTime &delay) { if (!init) return ERR_RTP_RTCPPACKETBUILDER_NOTINIT; transmissiondelay = delay; return 0; } + + /** Builds the next RTCP compound packet which should be sent and stores it in \c pack. */ + int BuildNextPacket(RTCPCompoundPacket **pack); + + /** Builds a BYE packet with reason for leaving specified by \c reason and length \c reasonlength. + * Builds a BYE packet with reason for leaving specified by \c reason and length \c reasonlength. If + * \c useSRifpossible is set to \c true, the RTCP compound packet will start with a sender report if + * allowed. Otherwise, a receiver report is used. + */ + int BuildBYEPacket(RTCPCompoundPacket **pack,const void *reason,size_t reasonlength,bool useSRifpossible = true); + + /** Sets the RTCP interval for the SDES name item. + * After all possible sources in the source table have been processed, the class will check if other + * SDES items need to be sent. If \c count is zero or negative, nothing will happen. If \c count + * is positive, an SDES name item will be added after the sources in the source table have been + * processed \c count times. + */ + void SetNameInterval(int count) { if (!init) return; interval_name = count; } + + /** Sets the RTCP interval for the SDES e-mail item. + * After all possible sources in the source table have been processed, the class will check if other + * SDES items need to be sent. If \c count is zero or negative, nothing will happen. If \c count + * is positive, an SDES e-mail item will be added after the sources in the source table have been + * processed \c count times. + */ + void SetEMailInterval(int count) { if (!init) return; interval_email = count; } + + /** Sets the RTCP interval for the SDES location item. + * After all possible sources in the source table have been processed, the class will check if other + * SDES items need to be sent. If \c count is zero or negative, nothing will happen. If \c count + * is positive, an SDES location item will be added after the sources in the source table have been + * processed \c count times. + */ + void SetLocationInterval(int count) { if (!init) return; interval_location = count; } + + /** Sets the RTCP interval for the SDES phone item. + * After all possible sources in the source table have been processed, the class will check if other + * SDES items need to be sent. If \c count is zero or negative, nothing will happen. If \c count + * is positive, an SDES phone item will be added after the sources in the source table have been + * processed \c count times. + */ + void SetPhoneInterval(int count) { if (!init) return; interval_phone = count; } + + /** Sets the RTCP interval for the SDES tool item. + * After all possible sources in the source table have been processed, the class will check if other + * SDES items need to be sent. If \c count is zero or negative, nothing will happen. If \c count + * is positive, an SDES tool item will be added after the sources in the source table have been + * processed \c count times. + */ + void SetToolInterval(int count) { if (!init) return; interval_tool = count; } + + /** Sets the RTCP interval for the SDES note item. + * After all possible sources in the source table have been processed, the class will check if other + * SDES items need to be sent. If \c count is zero or negative, nothing will happen. If \c count + * is positive, an SDES note item will be added after the sources in the source table have been + * processed \c count times. + */ + void SetNoteInterval(int count) { if (!init) return; interval_note = count; } + + /** Sets the SDES name item for the local participant to the value \c s with length \c len. */ + int SetLocalName(const void *s,size_t len) { if (!init) return ERR_RTP_RTCPPACKETBUILDER_NOTINIT; return ownsdesinfo.SetName((const uint8_t *)s,len); } + + /** Sets the SDES e-mail item for the local participant to the value \c s with length \c len. */ + int SetLocalEMail(const void *s,size_t len) { if (!init) return ERR_RTP_RTCPPACKETBUILDER_NOTINIT; return ownsdesinfo.SetEMail((const uint8_t *)s,len); } + + /** Sets the SDES location item for the local participant to the value \c s with length \c len. */ + int SetLocalLocation(const void *s,size_t len) { if (!init) return ERR_RTP_RTCPPACKETBUILDER_NOTINIT; return ownsdesinfo.SetLocation((const uint8_t *)s,len); } + + /** Sets the SDES phone item for the local participant to the value \c s with length \c len. */ + int SetLocalPhone(const void *s,size_t len) { if (!init) return ERR_RTP_RTCPPACKETBUILDER_NOTINIT; return ownsdesinfo.SetPhone((const uint8_t *)s,len); } + + /** Sets the SDES tool item for the local participant to the value \c s with length \c len. */ + int SetLocalTool(const void *s,size_t len) { if (!init) return ERR_RTP_RTCPPACKETBUILDER_NOTINIT; return ownsdesinfo.SetTool((const uint8_t *)s,len); } + + /** Sets the SDES note item for the local participant to the value \c s with length \c len. */ + int SetLocalNote(const void *s,size_t len) { if (!init) return ERR_RTP_RTCPPACKETBUILDER_NOTINIT; return ownsdesinfo.SetNote((const uint8_t *)s,len); } + + /** Returns the own CNAME item with length \c len */ + uint8_t *GetLocalCNAME(size_t *len) const { if (!init) return 0; return ownsdesinfo.GetCNAME(len); } +private: + void ClearAllSourceFlags(); + int FillInReportBlocks(RTCPCompoundPacketBuilder *pack,const RTPTime &curtime,int maxcount,bool *full,int *added,int *skipped,bool *atendoflist); + int FillInSDES(RTCPCompoundPacketBuilder *pack,bool *full,bool *processedall,int *added); + void ClearAllSDESFlags(); + + RTPSources &sources; + RTPPacketBuilder &rtppacketbuilder; + + bool init; + size_t maxpacketsize; + double timestampunit; + bool firstpacket; + RTPTime prevbuildtime,transmissiondelay; + + class RTCPSDESInfoInternal : public RTCPSDESInfo + { + public: + RTCPSDESInfoInternal(RTPMemoryManager *mgr) : RTCPSDESInfo(mgr) { ClearFlags(); } + void ClearFlags() { pname = false; pemail = false; plocation = false; pphone = false; ptool = false; pnote = false; } + bool ProcessedName() const { return pname; } + bool ProcessedEMail() const { return pemail; } + bool ProcessedLocation() const { return plocation; } + bool ProcessedPhone() const { return pphone; } + bool ProcessedTool() const { return ptool; } + bool ProcessedNote() const { return pnote; } + void SetProcessedName(bool v) { pname = v; } + void SetProcessedEMail(bool v) { pemail = v; } + void SetProcessedLocation(bool v) { plocation = v; } + void SetProcessedPhone(bool v) { pphone = v; } + void SetProcessedTool(bool v) { ptool = v; } + void SetProcessedNote(bool v) { pnote = v; } + private: + bool pname,pemail,plocation,pphone,ptool,pnote; + }; + + RTCPSDESInfoInternal ownsdesinfo; + int interval_name,interval_email,interval_location; + int interval_phone,interval_tool,interval_note; + bool doname,doemail,doloc,dophone,dotool,donote; + bool processingsdes; + + int sdesbuildcount; +}; + +} // end namespace + +#endif // RTCPPACKETBUILDER_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtcprrpacket.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtcprrpacket.h new file mode 100644 index 0000000..b5a8a84 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtcprrpacket.h @@ -0,0 +1,206 @@ +/* + + 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 rtcprrpacket.h + */ + +#ifndef RTCPRRPACKET_H + +#define RTCPRRPACKET_H + +#include "rtpconfig.h" +#include "rtcppacket.h" +#include "rtpstructs.h" +#ifdef RTP_SUPPORT_NETINET_IN + #include +#endif // RTP_SUPPORT_NETINET_IN + +namespace jrtplib +{ + +class RTCPCompoundPacket; + +/** Describes an RTCP receiver report packet. */ +class JRTPLIB_IMPORTEXPORT RTCPRRPacket : public RTCPPacket +{ +public: + /** Creates an instance based on the data in \c data with length \c datalen. + * Creates an instance based on the data in \c data with length \c datalen. Since the \c data pointer + * is referenced inside the class (no copy of the data is made) one must make sure that the memory it points + * to is valid as long as the class instance exists. + */ + RTCPRRPacket(uint8_t *data,size_t datalen); + ~RTCPRRPacket() { } + + /** Returns the SSRC of the participant who sent this packet. */ + uint32_t GetSenderSSRC() const; + + /** Returns the number of reception report blocks present in this packet. */ + int GetReceptionReportCount() const; + + /** Returns the SSRC of the reception report block described by \c index which may have a value + * from 0 to GetReceptionReportCount()-1 (note that no check is performed to see if \c index is + * valid). + */ + uint32_t GetSSRC(int index) const; + + /** Returns the `fraction lost' field of the reception report described by \c index which may have + * a value from 0 to GetReceptionReportCount()-1 (note that no check is performed to see if \c index is + * valid). + */ + uint8_t GetFractionLost(int index) const; + + /** Returns the number of lost packets in the reception report block described by \c index which may have + * a value from 0 to GetReceptionReportCount()-1 (note that no check is performed to see if \c index is + * valid). + */ + int32_t GetLostPacketCount(int index) const; + + /** Returns the extended highest sequence number of the reception report block described by \c index which may have + * a value from 0 to GetReceptionReportCount()-1 (note that no check is performed to see if \c index is + * valid). + */ + uint32_t GetExtendedHighestSequenceNumber(int index) const; + + /** Returns the jitter field of the reception report block described by \c index which may have + * a value from 0 to GetReceptionReportCount()-1 (note that no check is performed to see if \c index is + * valid). + */ + uint32_t GetJitter(int index) const; + + /** Returns the LSR field of the reception report block described by \c index which may have + * a value from 0 to GetReceptionReportCount()-1 (note that no check is performed to see if \c index is + * valid). + */ + uint32_t GetLSR(int index) const; + + /** Returns the DLSR field of the reception report block described by \c index which may have + * a value from 0 to GetReceptionReportCount()-1 (note that no check is performed to see if \c index is + * valid). + */ + uint32_t GetDLSR(int index) const; + + +#ifdef RTPDEBUG + void Dump(); +#endif // RTPDEBUG +private: + RTCPReceiverReport *GotoReport(int index) const; +}; + +inline uint32_t RTCPRRPacket::GetSenderSSRC() const +{ + if (!knownformat) + return 0; + + uint32_t *ssrcptr = (uint32_t *)(data+sizeof(RTCPCommonHeader)); + return ntohl(*ssrcptr); +} +inline int RTCPRRPacket::GetReceptionReportCount() const +{ + if (!knownformat) + return 0; + RTCPCommonHeader *hdr = (RTCPCommonHeader *)data; + return ((int)hdr->count); +} + +inline RTCPReceiverReport *RTCPRRPacket::GotoReport(int index) const +{ + RTCPReceiverReport *r = (RTCPReceiverReport *)(data+sizeof(RTCPCommonHeader)+sizeof(uint32_t)+index*sizeof(RTCPReceiverReport)); + return r; +} + +inline uint32_t RTCPRRPacket::GetSSRC(int index) const +{ + if (!knownformat) + return 0; + RTCPReceiverReport *r = GotoReport(index); + return ntohl(r->ssrc); +} + +inline uint8_t RTCPRRPacket::GetFractionLost(int index) const +{ + if (!knownformat) + return 0; + RTCPReceiverReport *r = GotoReport(index); + return r->fractionlost; +} + +inline int32_t RTCPRRPacket::GetLostPacketCount(int index) const +{ + if (!knownformat) + return 0; + RTCPReceiverReport *r = GotoReport(index); + uint32_t count = ((uint32_t)r->packetslost[2])|(((uint32_t)r->packetslost[1])<<8)|(((uint32_t)r->packetslost[0])<<16); + if ((count&0x00800000) != 0) // test for negative number + count |= 0xFF000000; + int32_t *count2 = (int32_t *)(&count); + return (*count2); +} + +inline uint32_t RTCPRRPacket::GetExtendedHighestSequenceNumber(int index) const +{ + if (!knownformat) + return 0; + RTCPReceiverReport *r = GotoReport(index); + return ntohl(r->exthighseqnr); +} + +inline uint32_t RTCPRRPacket::GetJitter(int index) const +{ + if (!knownformat) + return 0; + RTCPReceiverReport *r = GotoReport(index); + return ntohl(r->jitter); +} + +inline uint32_t RTCPRRPacket::GetLSR(int index) const +{ + if (!knownformat) + return 0; + RTCPReceiverReport *r = GotoReport(index); + return ntohl(r->lsr); +} + +inline uint32_t RTCPRRPacket::GetDLSR(int index) const +{ + if (!knownformat) + return 0; + RTCPReceiverReport *r = GotoReport(index); + return ntohl(r->dlsr); +} + +} // end namespace + +#endif // RTCPRRPACKET_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtcpscheduler.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtcpscheduler.h new file mode 100644 index 0000000..f967d61 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtcpscheduler.h @@ -0,0 +1,189 @@ +/* + + 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 rtcpscheduler.h + */ + +#ifndef RTCPSCHEDULER_H + +#define RTCPSCHEDULER_H + +#include "rtpconfig.h" +#include "rtptimeutilities.h" +#include "rtprandom.h" + +namespace jrtplib +{ + +class RTCPCompoundPacket; +class RTPPacket; +class RTPSources; + +/** Describes parameters used by the RTCPScheduler class. */ +class JRTPLIB_IMPORTEXPORT RTCPSchedulerParams +{ +public: + RTCPSchedulerParams(); + ~RTCPSchedulerParams(); + + /** Sets the RTCP bandwidth to be used to \c bw (in bytes per second). */ + int SetRTCPBandwidth(double bw); + + /** Returns the used RTCP bandwidth in bytes per second (default is 1000). */ + double GetRTCPBandwidth() const { return bandwidth; } + + /** Sets the fraction of the RTCP bandwidth reserved for senders to \c fraction. */ + int SetSenderBandwidthFraction(double fraction); + + /** Returns the fraction of the RTCP bandwidth reserved for senders (default is 25%). */ + double GetSenderBandwidthFraction() const { return senderfraction; } + + /** Sets the minimum (deterministic) interval between RTCP compound packets to \c t. */ + int SetMinimumTransmissionInterval(const RTPTime &t); + + /** Returns the minimum RTCP transmission interval (default is 5 seconds). */ + RTPTime GetMinimumTransmissionInterval() const { return mininterval; } + + /** If \c usehalf is \c true, only use half the minimum interval before sending the first RTCP compound packet. */ + void SetUseHalfAtStartup(bool usehalf) { usehalfatstartup = usehalf; } + + /** Returns \c true if only half the minimum interval should be used before sending the first RTCP compound packet + * (defualt is \c true). + */ + bool GetUseHalfAtStartup() const { return usehalfatstartup; } + + /** If \c v is \c true, the scheduler will schedule a BYE packet to be sent immediately if allowed. */ + void SetRequestImmediateBYE(bool v) { immediatebye = v; } + + /** Returns if the scheduler will schedule a BYE packet to be sent immediately if allowed + * (default is \c true). + */ + bool GetRequestImmediateBYE() const { return immediatebye; } +private: + double bandwidth; + double senderfraction; + RTPTime mininterval; + bool usehalfatstartup; + bool immediatebye; +}; + +/** This class determines when RTCP compound packets should be sent. */ +class JRTPLIB_IMPORTEXPORT RTCPScheduler +{ +public: + /** Creates an instance which will use the source table RTPSources to determine when RTCP compound + * packets should be scheduled. + * Creates an instance which will use the source table RTPSources to determine when RTCP compound + * packets should be scheduled. Note that for correct operation the \c sources instance should have information + * about the own SSRC (added by RTPSources::CreateOwnSSRC). You must also supply a random number + * generator \c rtprand which will be used for adding randomness to the RTCP intervals. + */ + RTCPScheduler(RTPSources &sources, RTPRandom &rtprand); + ~RTCPScheduler(); + + /** Resets the scheduler. */ + void Reset(); + + /** Sets the scheduler parameters to be used to \c params. */ + void SetParameters(const RTCPSchedulerParams ¶ms) { schedparams = params; } + + /** Returns the currently used scheduler parameters. */ + RTCPSchedulerParams GetParameters() const { return schedparams; } + + /** Sets the header overhead from underlying protocols (for example UDP and IP) to \c numbytes. */ + void SetHeaderOverhead(size_t numbytes) { headeroverhead = numbytes; } + + /** Returns the currently used header overhead. */ + size_t GetHeaderOverhead() const { return headeroverhead; } + + /** For each incoming RTCP compound packet, this function has to be called for the scheduler to work correctly. */ + void AnalyseIncoming(RTCPCompoundPacket &rtcpcomppack); + + /** For each outgoing RTCP compound packet, this function has to be called for the scheduler to work correctly. */ + void AnalyseOutgoing(RTCPCompoundPacket &rtcpcomppack); + + /** This function has to be called each time a member times out or sends a BYE packet. */ + void ActiveMemberDecrease(); + + /** Asks the scheduler to schedule an RTCP compound packet containing a BYE packetl; the compound packet + * has size \c packetsize. + */ + void ScheduleBYEPacket(size_t packetsize); + + /** Returns the delay after which an RTCP compound will possibly have to be sent. + * Returns the delay after which an RTCP compound will possibly have to be sent. The IsTime member function + * should be called afterwards to make sure that it actually is time to send an RTCP compound packet. + */ + RTPTime GetTransmissionDelay(); + + /** This function returns \c true if it's time to send an RTCP compound packet and \c false otherwise. + * This function returns \c true if it's time to send an RTCP compound packet and \c false otherwise. + * If the function returns \c true, it will also have calculated the next time at which a packet should + * be sent, so if it is called again right away, it will return \c false. + */ + bool IsTime(); + + /** Calculates the deterministic interval at this time. + * Calculates the deterministic interval at this time. This is used - in combination with a certain multiplier - + * to time out members, senders etc. + */ + RTPTime CalculateDeterministicInterval(bool sender = false); +private: + void CalculateNextRTCPTime(); + void PerformReverseReconsideration(); + RTPTime CalculateBYETransmissionInterval(); + RTPTime CalculateTransmissionInterval(bool sender); + + RTPSources &sources; + RTCPSchedulerParams schedparams; + size_t headeroverhead; + size_t avgrtcppacksize; + bool hassentrtcp; + bool firstcall; + RTPTime nextrtcptime; + RTPTime prevrtcptime; + int pmembers; + + // for BYE packet scheduling + bool byescheduled; + int byemembers,pbyemembers; + size_t avgbyepacketsize; + bool sendbyenow; + + RTPRandom &rtprand; +}; + +} // end namespace + +#endif // RTCPSCHEDULER_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtcpsdesinfo.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtcpsdesinfo.h new file mode 100644 index 0000000..c57d34e --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtcpsdesinfo.h @@ -0,0 +1,221 @@ +/* + + 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 rtcpsdesinfo.h + */ + +#ifndef RTCPSDESINFO_H + +#define RTCPSDESINFO_H + +#include "rtpconfig.h" +#include "rtperrors.h" +#include "rtpdefines.h" +#include "rtptypes.h" +#include "rtpmemoryobject.h" +#include +#include + +namespace jrtplib +{ + +/** The class RTCPSDESInfo is a container for RTCP SDES information. */ +class JRTPLIB_IMPORTEXPORT RTCPSDESInfo : public RTPMemoryObject +{ + JRTPLIB_NO_COPY(RTCPSDESInfo) +public: + /** Constructs an instance, optionally installing a memory manager. */ + RTCPSDESInfo(RTPMemoryManager *mgr = 0) : RTPMemoryObject(mgr) { for (int i = 0 ; i < RTCP_SDES_NUMITEMS_NONPRIVATE ; i++) nonprivateitems[i].SetMemoryManager(mgr); } + virtual ~RTCPSDESInfo() { Clear(); } + + /** Clears all SDES information. */ + void Clear(); + + /** Sets the SDES CNAME item to \c s with length \c l. */ + int SetCNAME(const uint8_t *s,size_t l) { return SetNonPrivateItem(RTCP_SDES_ID_CNAME-1,s,l); } + + /** Sets the SDES name item to \c s with length \c l. */ + int SetName(const uint8_t *s,size_t l) { return SetNonPrivateItem(RTCP_SDES_ID_NAME-1,s,l); } + + /** Sets the SDES e-mail item to \c s with length \c l. */ + int SetEMail(const uint8_t *s,size_t l) { return SetNonPrivateItem(RTCP_SDES_ID_EMAIL-1,s,l); } + + /** Sets the SDES phone item to \c s with length \c l. */ + int SetPhone(const uint8_t *s,size_t l) { return SetNonPrivateItem(RTCP_SDES_ID_PHONE-1,s,l); } + + /** Sets the SDES location item to \c s with length \c l. */ + int SetLocation(const uint8_t *s,size_t l) { return SetNonPrivateItem(RTCP_SDES_ID_LOCATION-1,s,l); } + + /** Sets the SDES tool item to \c s with length \c l. */ + int SetTool(const uint8_t *s,size_t l) { return SetNonPrivateItem(RTCP_SDES_ID_TOOL-1,s,l); } + + /** Sets the SDES note item to \c s with length \c l. */ + int SetNote(const uint8_t *s,size_t l) { return SetNonPrivateItem(RTCP_SDES_ID_NOTE-1,s,l); } + +#ifdef RTP_SUPPORT_SDESPRIV + /** Sets the entry for the prefix string specified by \c prefix with length \c prefixlen to contain + * the value string specified by \c value with length \c valuelen (if the maximum allowed + * number of prefixes was reached, the error code \c ERR_RTP_SDES_MAXPRIVITEMS is returned. + */ + int SetPrivateValue(const uint8_t *prefix,size_t prefixlen,const uint8_t *value,size_t valuelen); + + /** Deletes the entry for the prefix specified by \c s with length \c len. */ + int DeletePrivatePrefix(const uint8_t *s,size_t len); +#endif // RTP_SUPPORT_SDESPRIV + + /** Returns the SDES CNAME item and stores its length in \c len. */ + uint8_t *GetCNAME(size_t *len) const { return GetNonPrivateItem(RTCP_SDES_ID_CNAME-1,len); } + + /** Returns the SDES name item and stores its length in \c len. */ + uint8_t *GetName(size_t *len) const { return GetNonPrivateItem(RTCP_SDES_ID_NAME-1,len); } + + /** Returns the SDES e-mail item and stores its length in \c len. */ + uint8_t *GetEMail(size_t *len) const { return GetNonPrivateItem(RTCP_SDES_ID_EMAIL-1,len); } + + /** Returns the SDES phone item and stores its length in \c len. */ + uint8_t *GetPhone(size_t *len) const { return GetNonPrivateItem(RTCP_SDES_ID_PHONE-1,len); } + + /** Returns the SDES location item and stores its length in \c len. */ + uint8_t *GetLocation(size_t *len) const { return GetNonPrivateItem(RTCP_SDES_ID_LOCATION-1,len); } + + /** Returns the SDES tool item and stores its length in \c len. */ + uint8_t *GetTool(size_t *len) const { return GetNonPrivateItem(RTCP_SDES_ID_TOOL-1,len); } + + /** Returns the SDES note item and stores its length in \c len. */ + uint8_t *GetNote(size_t *len) const { return GetNonPrivateItem(RTCP_SDES_ID_NOTE-1,len); } +#ifdef RTP_SUPPORT_SDESPRIV + /** Starts the iteration over the stored SDES private item prefixes and their associated values. */ + void GotoFirstPrivateValue(); + + /** Returns SDES priv item information. + * If available, returns \c true and stores the next SDES + * private item prefix in \c prefix and its length in + * \c prefixlen. The associated value and its length are + * then stored in \c value and \c valuelen. Otherwise, + * it returns \c false. + */ + bool GetNextPrivateValue(uint8_t **prefix,size_t *prefixlen,uint8_t **value,size_t *valuelen); + + /** Returns SDES priv item information. + * Looks for the entry which corresponds to the SDES private + * item prefix \c prefix with length \c prefixlen. If found, + * the function returns \c true and stores the associated + * value and its length in \c value and \c valuelen + * respectively. + */ + bool GetPrivateValue(const uint8_t *prefix,size_t prefixlen,uint8_t **value,size_t *valuelen) const; +#endif // RTP_SUPPORT_SDESPRIV +private: + int SetNonPrivateItem(int itemno,const uint8_t *s,size_t l) { if (l > RTCP_SDES_MAXITEMLENGTH) return ERR_RTP_SDES_LENGTHTOOBIG; return nonprivateitems[itemno].SetInfo(s,l); } + uint8_t *GetNonPrivateItem(int itemno,size_t *len) const { return nonprivateitems[itemno].GetInfo(len); } + + class SDESItem : public RTPMemoryObject + { + public: + SDESItem(RTPMemoryManager *mgr = 0) : RTPMemoryObject(mgr) + { + str = 0; + length = 0; + } + void SetMemoryManager(RTPMemoryManager *mgr) + { + RTPMemoryObject::SetMemoryManager(mgr); + } + ~SDESItem() + { + if (str) + RTPDeleteByteArray(str,GetMemoryManager()); + } + uint8_t *GetInfo(size_t *len) const { *len = length; return str; } + int SetInfo(const uint8_t *s,size_t len) { return SetString(&str,&length,s,len); } + protected: + int SetString(uint8_t **dest,size_t *destlen,const uint8_t *s,size_t len) + { + if (len <= 0) + { + if (*dest) + RTPDeleteByteArray((*dest),GetMemoryManager()); + *dest = 0; + *destlen = 0; + } + else + { + len = (len>RTCP_SDES_MAXITEMLENGTH)?RTCP_SDES_MAXITEMLENGTH:len; + uint8_t *str2 = RTPNew(GetMemoryManager(),RTPMEM_TYPE_BUFFER_SDESITEM) uint8_t[len]; + if (str2 == 0) + return ERR_RTP_OUTOFMEM; + memcpy(str2,s,len); + *destlen = len; + if (*dest) + RTPDeleteByteArray((*dest),GetMemoryManager()); + *dest = str2; + } + return 0; + } + private: + uint8_t *str; + size_t length; + }; + + SDESItem nonprivateitems[RTCP_SDES_NUMITEMS_NONPRIVATE]; + +#ifdef RTP_SUPPORT_SDESPRIV + class SDESPrivateItem : public SDESItem + { + public: + SDESPrivateItem(RTPMemoryManager *mgr) : SDESItem(mgr) + { + prefixlen = 0; + prefix = 0; + } + ~SDESPrivateItem() + { + if (prefix) + RTPDeleteByteArray(prefix,GetMemoryManager()); + } + uint8_t *GetPrefix(size_t *len) const { *len = prefixlen; return prefix; } + int SetPrefix(const uint8_t *s,size_t len) { return SetString(&prefix,&prefixlen,s,len); } + private: + uint8_t *prefix; + size_t prefixlen; + }; + + std::list privitems; + std::list::const_iterator curitem; +#endif // RTP_SUPPORT_SDESPRIV +}; + +} // end namespace + +#endif // RTCPSDESINFO_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtcpsdespacket.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtcpsdespacket.h new file mode 100644 index 0000000..659e8d1 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtcpsdespacket.h @@ -0,0 +1,386 @@ +/* + + 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 rtcpsdespacket.h + */ + +#ifndef RTCPSDESPACKET_H + +#define RTCPSDESPACKET_H + +#include "rtpconfig.h" +#include "rtcppacket.h" +#include "rtpstructs.h" +#include "rtpdefines.h" +#ifdef RTP_SUPPORT_NETINET_IN + #include +#endif // RTP_SUPPORT_NETINET_IN + +namespace jrtplib +{ + + class RTCPCompoundPacket; + +/** Describes an RTCP source description packet. */ +class JRTPLIB_IMPORTEXPORT RTCPSDESPacket : public RTCPPacket +{ +public: + /** Identifies the type of an SDES item. */ + enum ItemType + { + None, /**< Used when the iteration over the items has finished. */ + CNAME, /**< Used for a CNAME (canonical name) item. */ + NAME, /**< Used for a NAME item. */ + EMAIL, /**< Used for an EMAIL item. */ + PHONE, /**< Used for a PHONE item. */ + LOC, /**< Used for a LOC (location) item. */ + TOOL, /**< Used for a TOOL item. */ + NOTE, /**< Used for a NOTE item. */ + PRIV, /**< Used for a PRIV item. */ + Unknown /**< Used when there is an item present, but the type is not recognized. */ + }; + + /** Creates an instance based on the data in \c data with length \c datalen. + * Creates an instance based on the data in \c data with length \c datalen. Since the \c data pointer + * is referenced inside the class (no copy of the data is made) one must make sure that the memory it + * points to is valid as long as the class instance exists. + */ + RTCPSDESPacket(uint8_t *data,size_t datalen); + ~RTCPSDESPacket() { } + + /** Returns the number of SDES chunks in the SDES packet. + * Returns the number of SDES chunks in the SDES packet. Each chunk has its own SSRC identifier. + */ + int GetChunkCount() const; + + /** Starts the iteration over the chunks. + * Starts the iteration. If no SDES chunks are present, the function returns \c false. Otherwise, + * it returns \c true and sets the current chunk to be the first chunk. + */ + bool GotoFirstChunk(); + + /** Sets the current chunk to the next available chunk. + * Sets the current chunk to the next available chunk. If no next chunk is present, this function returns + * \c false, otherwise it returns \c true. + */ + bool GotoNextChunk(); + + /** Returns the SSRC identifier of the current chunk. */ + uint32_t GetChunkSSRC() const; + + /** Starts the iteration over the SDES items in the current chunk. + * Starts the iteration over the SDES items in the current chunk. If no SDES items are + * present, the function returns \c false. Otherwise, the function sets the current item + * to be the first one and returns \c true. + */ + bool GotoFirstItem(); + + /** Advances the iteration to the next item in the current chunk. + * If there's another item in the chunk, the current item is set to be the next one and the function + * returns \c true. Otherwise, the function returns \c false. + */ + bool GotoNextItem(); + + /** Returns the SDES item type of the current item in the current chunk. */ + ItemType GetItemType() const; + + /** Returns the item length of the current item in the current chunk. */ + size_t GetItemLength() const; + + /** Returns the item data of the current item in the current chunk. */ + uint8_t *GetItemData(); + +#ifdef RTP_SUPPORT_SDESPRIV + /** If the current item is an SDES PRIV item, this function returns the length of the + * prefix string of the private item. + */ + size_t GetPRIVPrefixLength() const; + + /** If the current item is an SDES PRIV item, this function returns actual data of the + * prefix string. + */ + uint8_t *GetPRIVPrefixData(); + + /** If the current item is an SDES PRIV item, this function returns the length of the + * value string of the private item. + */ + size_t GetPRIVValueLength() const; + + /** If the current item is an SDES PRIV item, this function returns actual value data of the + * private item. + */ + uint8_t *GetPRIVValueData(); +#endif // RTP_SUPPORT_SDESPRIV + +#ifdef RTPDEBUG + void Dump(); +#endif // RTPDEBUG +private: + uint8_t *currentchunk; + int curchunknum; + size_t itemoffset; +}; + +inline int RTCPSDESPacket::GetChunkCount() const +{ + if (!knownformat) + return 0; + RTCPCommonHeader *hdr = (RTCPCommonHeader *)data; + return ((int)hdr->count); +} + +inline bool RTCPSDESPacket::GotoFirstChunk() +{ + if (GetChunkCount() == 0) + { + currentchunk = 0; + return false; + } + currentchunk = data+sizeof(RTCPCommonHeader); + curchunknum = 1; + itemoffset = sizeof(uint32_t); + return true; +} + +inline bool RTCPSDESPacket::GotoNextChunk() +{ + if (!knownformat) + return false; + if (currentchunk == 0) + return false; + if (curchunknum == GetChunkCount()) + return false; + + size_t offset = sizeof(uint32_t); + RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+sizeof(uint32_t)); + + while (sdeshdr->sdesid != 0) + { + offset += sizeof(RTCPSDESHeader); + offset += (size_t)(sdeshdr->length); + sdeshdr = (RTCPSDESHeader *)(currentchunk+offset); + } + offset++; // for the zero byte + if ((offset&0x03) != 0) + offset += (4-(offset&0x03)); + currentchunk += offset; + curchunknum++; + itemoffset = sizeof(uint32_t); + return true; +} + +inline uint32_t RTCPSDESPacket::GetChunkSSRC() const +{ + if (!knownformat) + return 0; + if (currentchunk == 0) + return 0; + uint32_t *ssrc = (uint32_t *)currentchunk; + return ntohl(*ssrc); +} + +inline bool RTCPSDESPacket::GotoFirstItem() +{ + if (!knownformat) + return false; + if (currentchunk == 0) + return false; + itemoffset = sizeof(uint32_t); + RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+itemoffset); + if (sdeshdr->sdesid == 0) + return false; + return true; +} + +inline bool RTCPSDESPacket::GotoNextItem() +{ + if (!knownformat) + return false; + if (currentchunk == 0) + return false; + + RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+itemoffset); + if (sdeshdr->sdesid == 0) + return false; + + size_t offset = itemoffset; + offset += sizeof(RTCPSDESHeader); + offset += (size_t)(sdeshdr->length); + sdeshdr = (RTCPSDESHeader *)(currentchunk+offset); + if (sdeshdr->sdesid == 0) + return false; + itemoffset = offset; + return true; +} + +inline RTCPSDESPacket::ItemType RTCPSDESPacket::GetItemType() const +{ + if (!knownformat) + return None; + if (currentchunk == 0) + return None; + RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+itemoffset); + switch (sdeshdr->sdesid) + { + case 0: + return None; + case RTCP_SDES_ID_CNAME: + return CNAME; + case RTCP_SDES_ID_NAME: + return NAME; + case RTCP_SDES_ID_EMAIL: + return EMAIL; + case RTCP_SDES_ID_PHONE: + return PHONE; + case RTCP_SDES_ID_LOCATION: + return LOC; + case RTCP_SDES_ID_TOOL: + return TOOL; + case RTCP_SDES_ID_NOTE: + return NOTE; + case RTCP_SDES_ID_PRIVATE: + return PRIV; + default: + return Unknown; + } + return Unknown; +} + +inline size_t RTCPSDESPacket::GetItemLength() const +{ + if (!knownformat) + return None; + if (currentchunk == 0) + return None; + RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+itemoffset); + if (sdeshdr->sdesid == 0) + return 0; + return (size_t)(sdeshdr->length); +} + +inline uint8_t *RTCPSDESPacket::GetItemData() +{ + if (!knownformat) + return 0; + if (currentchunk == 0) + return 0; + RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+itemoffset); + if (sdeshdr->sdesid == 0) + return 0; + return (currentchunk+itemoffset+sizeof(RTCPSDESHeader)); +} + +#ifdef RTP_SUPPORT_SDESPRIV +inline size_t RTCPSDESPacket::GetPRIVPrefixLength() const +{ + if (!knownformat) + return 0; + if (currentchunk == 0) + return 0; + RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+itemoffset); + if (sdeshdr->sdesid != RTCP_SDES_ID_PRIVATE) + return 0; + if (sdeshdr->length == 0) + return 0; + uint8_t *preflen = currentchunk+itemoffset+sizeof(RTCPSDESHeader); + size_t prefixlength = (size_t)(*preflen); + if (prefixlength > (size_t)((sdeshdr->length)-1)) + return 0; + return prefixlength; +} + +inline uint8_t *RTCPSDESPacket::GetPRIVPrefixData() +{ + if (!knownformat) + return 0; + if (currentchunk == 0) + return 0; + RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+itemoffset); + if (sdeshdr->sdesid != RTCP_SDES_ID_PRIVATE) + return 0; + if (sdeshdr->length == 0) + return 0; + uint8_t *preflen = currentchunk+itemoffset+sizeof(RTCPSDESHeader); + size_t prefixlength = (size_t)(*preflen); + if (prefixlength > (size_t)((sdeshdr->length)-1)) + return 0; + if (prefixlength == 0) + return 0; + return (currentchunk+itemoffset+sizeof(RTCPSDESHeader)+1); +} + +inline size_t RTCPSDESPacket::GetPRIVValueLength() const +{ + if (!knownformat) + return 0; + if (currentchunk == 0) + return 0; + RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+itemoffset); + if (sdeshdr->sdesid != RTCP_SDES_ID_PRIVATE) + return 0; + if (sdeshdr->length == 0) + return 0; + uint8_t *preflen = currentchunk+itemoffset+sizeof(RTCPSDESHeader); + size_t prefixlength = (size_t)(*preflen); + if (prefixlength > (size_t)((sdeshdr->length)-1)) + return 0; + return ((size_t)(sdeshdr->length))-prefixlength-1; +} + +inline uint8_t *RTCPSDESPacket::GetPRIVValueData() +{ + if (!knownformat) + return 0; + if (currentchunk == 0) + return 0; + RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+itemoffset); + if (sdeshdr->sdesid != RTCP_SDES_ID_PRIVATE) + return 0; + if (sdeshdr->length == 0) + return 0; + uint8_t *preflen = currentchunk+itemoffset+sizeof(RTCPSDESHeader); + size_t prefixlength = (size_t)(*preflen); + if (prefixlength > (size_t)((sdeshdr->length)-1)) + return 0; + size_t valuelen = ((size_t)(sdeshdr->length))-prefixlength-1; + if (valuelen == 0) + return 0; + return (currentchunk+itemoffset+sizeof(RTCPSDESHeader)+1+prefixlength); +} + +#endif // RTP_SUPPORT_SDESPRIV + +} // end namespace + +#endif // RTCPSDESPACKET_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtcpsrpacket.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtcpsrpacket.h new file mode 100644 index 0000000..5be9365 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtcpsrpacket.h @@ -0,0 +1,252 @@ +/* + + 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 rtcpsrpacket.h + */ + +#ifndef RTCPSRPACKET_H + +#define RTCPSRPACKET_H + +#include "rtpconfig.h" +#include "rtcppacket.h" +#include "rtptimeutilities.h" +#include "rtpstructs.h" +#ifdef RTP_SUPPORT_NETINET_IN + #include +#endif // RTP_SUPPORT_NETINET_IN + +namespace jrtplib +{ + +class RTCPCompoundPacket; + +/** Describes an RTCP sender report packet. */ +class JRTPLIB_IMPORTEXPORT RTCPSRPacket : public RTCPPacket +{ +public: + /** Creates an instance based on the data in \c data with length \c datalen. + * Creates an instance based on the data in \c data with length \c datalen. Since the \c data pointer + * is referenced inside the class (no copy of the data is made) one must make sure that the memory it + * points to is valid as long as the class instance exists. + */ + RTCPSRPacket(uint8_t *data,size_t datalength); + ~RTCPSRPacket() { } + + /** Returns the SSRC of the participant who sent this packet. */ + uint32_t GetSenderSSRC() const; + + /** Returns the NTP timestamp contained in the sender report. */ + RTPNTPTime GetNTPTimestamp() const; + + /** Returns the RTP timestamp contained in the sender report. */ + uint32_t GetRTPTimestamp() const; + + /** Returns the sender's packet count contained in the sender report. */ + uint32_t GetSenderPacketCount() const; + + /** Returns the sender's octet count contained in the sender report. */ + uint32_t GetSenderOctetCount() const; + + /** Returns the number of reception report blocks present in this packet. */ + int GetReceptionReportCount() const; + + /** Returns the SSRC of the reception report block described by \c index which may have a value + * from 0 to GetReceptionReportCount()-1 (note that no check is performed to see if \c index is + * valid). + */ + uint32_t GetSSRC(int index) const; + + /** Returns the `fraction lost' field of the reception report described by \c index which may have + * a value from 0 to GetReceptionReportCount()-1 (note that no check is performed to see if \c index is + * valid). + */ + uint8_t GetFractionLost(int index) const; + + /** Returns the number of lost packets in the reception report block described by \c index which may have + * a value from 0 to GetReceptionReportCount()-1 (note that no check is performed to see if \c index is + * valid). + */ + int32_t GetLostPacketCount(int index) const; + + /** Returns the extended highest sequence number of the reception report block described by \c index which may have + * a value from 0 to GetReceptionReportCount()-1 (note that no check is performed to see if \c index is + * valid). + */ + uint32_t GetExtendedHighestSequenceNumber(int index) const; + + /** Returns the jitter field of the reception report block described by \c index which may have + * a value from 0 to GetReceptionReportCount()-1 (note that no check is performed to see if \c index is + * valid). + */ + uint32_t GetJitter(int index) const; + + /** Returns the LSR field of the reception report block described by \c index which may have + * a value from 0 to GetReceptionReportCount()-1 (note that no check is performed to see if \c index is + * valid). + */ + uint32_t GetLSR(int index) const; + + /** Returns the DLSR field of the reception report block described by \c index which may have + * a value from 0 to GetReceptionReportCount()-1 (note that no check is performed to see if \c index is + * valid). + */ + uint32_t GetDLSR(int index) const; + +#ifdef RTPDEBUG + void Dump(); +#endif // RTPDEBUG +private: + RTCPReceiverReport *GotoReport(int index) const; +}; + +inline uint32_t RTCPSRPacket::GetSenderSSRC() const +{ + if (!knownformat) + return 0; + + uint32_t *ssrcptr = (uint32_t *)(data+sizeof(RTCPCommonHeader)); + return ntohl(*ssrcptr); +} + +inline RTPNTPTime RTCPSRPacket::GetNTPTimestamp() const +{ + if (!knownformat) + return RTPNTPTime(0,0); + + RTCPSenderReport *sr = (RTCPSenderReport *)(data+sizeof(RTCPCommonHeader)+sizeof(uint32_t)); + return RTPNTPTime(ntohl(sr->ntptime_msw),ntohl(sr->ntptime_lsw)); +} + +inline uint32_t RTCPSRPacket::GetRTPTimestamp() const +{ + if (!knownformat) + return 0; + RTCPSenderReport *sr = (RTCPSenderReport *)(data+sizeof(RTCPCommonHeader)+sizeof(uint32_t)); + return ntohl(sr->rtptimestamp); +} + +inline uint32_t RTCPSRPacket::GetSenderPacketCount() const +{ + if (!knownformat) + return 0; + RTCPSenderReport *sr = (RTCPSenderReport *)(data+sizeof(RTCPCommonHeader)+sizeof(uint32_t)); + return ntohl(sr->packetcount); +} + +inline uint32_t RTCPSRPacket::GetSenderOctetCount() const +{ + if (!knownformat) + return 0; + RTCPSenderReport *sr = (RTCPSenderReport *)(data+sizeof(RTCPCommonHeader)+sizeof(uint32_t)); + return ntohl(sr->octetcount); +} + +inline int RTCPSRPacket::GetReceptionReportCount() const +{ + if (!knownformat) + return 0; + RTCPCommonHeader *hdr = (RTCPCommonHeader *)data; + return ((int)hdr->count); +} + +inline RTCPReceiverReport *RTCPSRPacket::GotoReport(int index) const +{ + RTCPReceiverReport *r = (RTCPReceiverReport *)(data+sizeof(RTCPCommonHeader)+sizeof(uint32_t)+sizeof(RTCPSenderReport)+index*sizeof(RTCPReceiverReport)); + return r; +} + +inline uint32_t RTCPSRPacket::GetSSRC(int index) const +{ + if (!knownformat) + return 0; + RTCPReceiverReport *r = GotoReport(index); + return ntohl(r->ssrc); +} + +inline uint8_t RTCPSRPacket::GetFractionLost(int index) const +{ + if (!knownformat) + return 0; + RTCPReceiverReport *r = GotoReport(index); + return r->fractionlost; +} + +inline int32_t RTCPSRPacket::GetLostPacketCount(int index) const +{ + if (!knownformat) + return 0; + RTCPReceiverReport *r = GotoReport(index); + uint32_t count = ((uint32_t)r->packetslost[2])|(((uint32_t)r->packetslost[1])<<8)|(((uint32_t)r->packetslost[0])<<16); + if ((count&0x00800000) != 0) // test for negative number + count |= 0xFF000000; + int32_t *count2 = (int32_t *)(&count); + return (*count2); +} + +inline uint32_t RTCPSRPacket::GetExtendedHighestSequenceNumber(int index) const +{ + if (!knownformat) + return 0; + RTCPReceiverReport *r = GotoReport(index); + return ntohl(r->exthighseqnr); +} + +inline uint32_t RTCPSRPacket::GetJitter(int index) const +{ + if (!knownformat) + return 0; + RTCPReceiverReport *r = GotoReport(index); + return ntohl(r->jitter); +} + +inline uint32_t RTCPSRPacket::GetLSR(int index) const +{ + if (!knownformat) + return 0; + RTCPReceiverReport *r = GotoReport(index); + return ntohl(r->lsr); +} + +inline uint32_t RTCPSRPacket::GetDLSR(int index) const +{ + if (!knownformat) + return 0; + RTCPReceiverReport *r = GotoReport(index); + return ntohl(r->dlsr); +} + +} // end namespace + +#endif // RTCPSRPACKET_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtcpunknownpacket.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtcpunknownpacket.h new file mode 100644 index 0000000..b4538a8 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtcpunknownpacket.h @@ -0,0 +1,73 @@ +/* + + 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 rtcpunknownpacket.h + */ + +#ifndef RTCPUNKNOWNPACKET_H + +#define RTCPUNKNOWNPACKET_H + +#include "rtpconfig.h" +#include "rtcppacket.h" + +namespace jrtplib +{ + +class RTCPCompoundPacket; + +/** Describes an RTCP packet of unknown type. + * Describes an RTCP packet of unknown type. This class doesn't have any extra member functions besides + * the ones it inherited. Note that since an unknown packet type doesn't have any format to check + * against, the IsKnownFormat function will trivially return \c true. + */ +class JRTPLIB_IMPORTEXPORT RTCPUnknownPacket : public RTCPPacket +{ +public: + /** Creates an instance based on the data in \c data with length \c datalen. + * Creates an instance based on the data in \c data with length \c datalen. Since the \c data pointer + * is referenced inside the class (no copy of the data is made) one must make sure that the memory it + * points to is valid as long as the class instance exists. + */ + RTCPUnknownPacket(uint8_t *data,size_t datalen) : RTCPPacket(Unknown,data,datalen) + { + // Since we don't expect a format, we'll trivially put knownformat = true + knownformat = true; + } + ~RTCPUnknownPacket() { } +}; + +} // end namespace + +#endif // RTCPUNKNOWNPACKET_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpabortdescriptors.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpabortdescriptors.h new file mode 100644 index 0000000..632235d --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpabortdescriptors.h @@ -0,0 +1,104 @@ +/* + + 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 rtpabortdescriptors.h + */ + +#ifndef RTPABORTDESCRIPTORS_H + +#define RTPABORTDESCRIPTORS_H + +#include "rtpconfig.h" +#include "rtpsocketutil.h" + +namespace jrtplib +{ + +/** + * Helper class for several RTPTransmitter instances, to be able to cancel a + * call to 'select', 'poll' or 'WSAPoll'. + * + * This is a helper class for several RTPTransmitter instances. Typically a + * call to 'select' (or 'poll' or 'WSAPoll', depending on the platform) is used + * to wait for incoming data for a certain time. To be able to cancel this wait + * from another thread, this class provides a socket descriptor that's compatible + * with e.g. the 'select' call, and to which data can be sent using + * RTPAbortDescriptors::SendAbortSignal. If the descriptor is included in the + * 'select' call, the function will detect incoming data and the function stops + * waiting for incoming data. + * + * The class can be useful in case you'd like to create an implementation which + * uses a single poll thread for several RTPSession and RTPTransmitter instances. + * This idea is further illustrated in `example8.cpp`. + */ +class JRTPLIB_IMPORTEXPORT RTPAbortDescriptors +{ + JRTPLIB_NO_COPY(RTPAbortDescriptors) +public: + RTPAbortDescriptors(); + ~RTPAbortDescriptors(); + + /** Initializes this instance. */ + int Init(); + + /** Returns the socket descriptor that can be included in a call to + * 'select' (for example).*/ + SocketType GetAbortSocket() const { return m_descriptors[0]; } + + /** Returns a flag indicating if this instance was initialized. */ + bool IsInitialized() const { return m_init; } + + /** De-initializes this instance. */ + void Destroy(); + + /** Send a signal to the socket that's returned by RTPAbortDescriptors::GetAbortSocket, + * causing the 'select' call to detect that data is available, making the call + * end. */ + int SendAbortSignal(); + + /** For each RTPAbortDescriptors::SendAbortSignal function that's called, a call + * to this function can be made to clear the state again. */ + int ReadSignallingByte(); + + /** Similar to ReadSignallingByte::ReadSignallingByte, this function clears the signalling + * state, but this also works independently from the amount of times that + * RTPAbortDescriptors::SendAbortSignal was called. */ + int ClearAbortSignal(); +private: + SocketType m_descriptors[2]; + bool m_init; +}; + +} // end namespace + +#endif // RTPABORTDESCRIPTORS_H diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpaddress.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpaddress.h new file mode 100644 index 0000000..978e420 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpaddress.h @@ -0,0 +1,100 @@ +/* + + 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 rtpaddress.h + */ + +#ifndef RTPADDRESS_H + +#define RTPADDRESS_H + +#include "rtpconfig.h" +#include + +namespace jrtplib +{ + +class RTPMemoryManager; + +/** This class is an abstract class which is used to specify destinations, multicast groups etc. */ +class JRTPLIB_IMPORTEXPORT RTPAddress +{ +public: + /** Identifies the actual implementation being used. */ + enum AddressType + { + IPv4Address, /**< Used by the UDP over IPv4 transmitter. */ + IPv6Address, /**< Used by the UDP over IPv6 transmitter. */ + ByteAddress, /**< A very general type of address, consisting of a port number and a number of bytes representing the host address. */ + UserDefinedAddress, /**< Can be useful for a user-defined transmitter. */ + TCPAddress /**< Used by the TCP transmitter. */ + }; + + /** Returns the type of address the actual implementation represents. */ + AddressType GetAddressType() const { return addresstype; } + + /** Creates a copy of the RTPAddress instance. + * Creates a copy of the RTPAddress instance. If \c mgr is not NULL, the + * corresponding memory manager will be used to allocate the memory for the address + * copy. + */ + virtual RTPAddress *CreateCopy(RTPMemoryManager *mgr) const = 0; + + /** Checks if the address \c addr is the same address as the one this instance represents. + * Checks if the address \c addr is the same address as the one this instance represents. + * Implementations must be able to handle a NULL argument. + */ + virtual bool IsSameAddress(const RTPAddress *addr) const = 0; + + /** Checks if the address \c addr represents the same host as this instance. + * Checks if the address \c addr represents the same host as this instance. Implementations + * must be able to handle a NULL argument. + */ + virtual bool IsFromSameHost(const RTPAddress *addr) const = 0; + +#ifdef RTPDEBUG + virtual std::string GetAddressString() const = 0; +#endif // RTPDEBUG + + virtual ~RTPAddress() { } +protected: + // only allow subclasses to be created + RTPAddress(const AddressType t) : addresstype(t) { } +private: + const AddressType addresstype; +}; + +} // end namespace + +#endif // RTPADDRESS_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpbyteaddress.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpbyteaddress.h new file mode 100644 index 0000000..a521355 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpbyteaddress.h @@ -0,0 +1,93 @@ +/* + + 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 rtpbyteaddress.h + */ + +#ifndef RTPBYTEADDRESS_H + +#define RTPBYTEADDRESS_H + +#include "rtpconfig.h" +#include "rtpaddress.h" +#include "rtptypes.h" +#include + +#define RTPBYTEADDRESS_MAXLENGTH 128 + +namespace jrtplib +{ + +class RTPMemoryManager; + +/** A very general kind of address consisting of a port number and a number of bytes describing the host address. + * A very general kind of address, consisting of a port number and a number of bytes describing the host address. + */ +class JRTPLIB_IMPORTEXPORT RTPByteAddress : public RTPAddress +{ +public: + /** Creates an instance of the class using \c addrlen bytes of \c hostaddress as host identification, + * and using \c port as the port number. */ + RTPByteAddress(const uint8_t hostaddress[RTPBYTEADDRESS_MAXLENGTH], size_t addrlen, uint16_t port = 0) : RTPAddress(ByteAddress) { if (addrlen > RTPBYTEADDRESS_MAXLENGTH) addrlen = RTPBYTEADDRESS_MAXLENGTH; memcpy(RTPByteAddress::hostaddress, hostaddress, addrlen); RTPByteAddress::addresslength = addrlen; RTPByteAddress::port = port; } + + /** Sets the host address to the first \c addrlen bytes of \c hostaddress. */ + void SetHostAddress(const uint8_t hostaddress[RTPBYTEADDRESS_MAXLENGTH], size_t addrlen) { if (addrlen > RTPBYTEADDRESS_MAXLENGTH) addrlen = RTPBYTEADDRESS_MAXLENGTH; memcpy(RTPByteAddress::hostaddress, hostaddress, addrlen); RTPByteAddress::addresslength = addrlen; } + + /** Sets the port number to \c port. */ + void SetPort(uint16_t port) { RTPByteAddress::port = port; } + + /** Returns a pointer to the stored host address. */ + const uint8_t *GetHostAddress() const { return hostaddress; } + + /** Returns the length in bytes of the stored host address. */ + size_t GetHostAddressLength() const { return addresslength; } + + /** Returns the port number stored in this instance. */ + uint16_t GetPort() const { return port; } + + RTPAddress *CreateCopy(RTPMemoryManager *mgr) const; + bool IsSameAddress(const RTPAddress *addr) const; + bool IsFromSameHost(const RTPAddress *addr) const; +#ifdef RTPDEBUG + std::string GetAddressString() const; +#endif // RTPDEBUG +private: + uint8_t hostaddress[RTPBYTEADDRESS_MAXLENGTH]; + size_t addresslength; + uint16_t port; +}; + +} // end namespace + +#endif // RTPBYTEADDRESS_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpcollisionlist.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpcollisionlist.h new file mode 100644 index 0000000..f47920e --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpcollisionlist.h @@ -0,0 +1,95 @@ +/* + + 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 rtpcollisionlist.h + */ + +#ifndef RTPCOLLISIONLIST_H + +#define RTPCOLLISIONLIST_H + +#include "rtpconfig.h" +#include "rtpaddress.h" +#include "rtptimeutilities.h" +#include "rtpmemoryobject.h" +#include + +namespace jrtplib +{ + +class RTPAddress; + +/** This class represents a list of addresses from which SSRC collisions were detected. */ +class JRTPLIB_IMPORTEXPORT RTPCollisionList : public RTPMemoryObject +{ +public: + /** Constructs an instance, optionally installing a memory manager. */ + RTPCollisionList(RTPMemoryManager *mgr = 0); + ~RTPCollisionList() { Clear(); } + + /** Clears the list of addresses. */ + void Clear(); + + /** Updates the entry for address \c addr to indicate that a collision was detected at time \c receivetime. + * Updates the entry for address \c addr to indicate that a collision was detected at time \c receivetime. + * If the entry did not exist yet, the flag \c created is set to \c true, otherwise it is set to \c false. + */ + int UpdateAddress(const RTPAddress *addr,const RTPTime &receivetime,bool *created); + + /** Returns \c true} if the address \c addr appears in the list. */ + bool HasAddress(const RTPAddress *addr) const; + + /** Assuming that the current time is given by \c currenttime, this function times out entries which + * haven't been updated in the previous time interval specified by \c timeoutdelay. + */ + void Timeout(const RTPTime ¤ttime,const RTPTime &timeoutdelay); +#ifdef RTPDEBUG + void Dump(); +#endif // RTPDEBUG +private: + class AddressAndTime + { + public: + AddressAndTime(RTPAddress *a,const RTPTime &t) : addr(a),recvtime(t) { } + + RTPAddress *addr; + RTPTime recvtime; + }; + + std::list addresslist; +}; + +} // end namespace + +#endif // RTPCOLLISIONLIST_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpconfig.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpconfig.h new file mode 100644 index 0000000..69438f3 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpconfig.h @@ -0,0 +1,118 @@ +/* + + 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. + +*/ + +#ifndef RTPCONFIG_UNIX_H + +#define RTPCONFIG_UNIX_H + +#ifndef JRTPLIB_UNUSED +/** + * Provide a macro to use for marking method parameters as unused. + */ +#define JRTPLIB_UNUSED(x) (void)(x) +#endif // JRTPLIB_UNUSED + +#define JRTPLIB_IMPORT +#define JRTPLIB_EXPORT +#ifdef JRTPLIB_COMPILING + #define JRTPLIB_IMPORTEXPORT JRTPLIB_EXPORT +#else + #define JRTPLIB_IMPORTEXPORT JRTPLIB_IMPORT +#endif // JRTPLIB_COMPILING + +#define JRTPLIB_NO_COPY(ClassName) \ + private: \ + ClassName(const ClassName &); \ + ClassName &operator=(const ClassName &); + +// Don't have + +// Don't have + +// Little endian system + +#define RTP_SOCKLENTYPE_UINT + +// No sa_len member in struct sockaddr + +#define RTP_SUPPORT_IPV4MULTICAST + +// No support for JThread was enabled + +#define RTP_SUPPORT_SDESPRIV + +#define RTP_SUPPORT_PROBATION + +#define RTP_SUPPORT_GETLOGINR + +#define RTP_SUPPORT_IPV6 + +#define RTP_SUPPORT_IPV6MULTICAST + +#define RTP_SUPPORT_IFADDRS + +#define RTP_SUPPORT_SENDAPP + +#define RTP_SUPPORT_MEMORYMANAGEMENT + +// No support for sending unknown RTCP packets + +#define RTP_SUPPORT_NETINET_IN + +// Not using winsock sockets + +// No QueryPerformanceCounter support + +// No ui64 suffix + +// Stdio snprintf version + +#define RTP_HAVE_ARRAYALLOC + +// No rand_s support + +// No strncpy_s support + +// No SRTP support + +// No SRTP2 support + +#define RTP_HAVE_CLOCK_GETTIME + +#define RTP_HAVE_POLL + +// No 'WSAPoll' support + +#define RTP_HAVE_MSG_NOSIGNAL + +#endif // RTPCONFIG_UNIX_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpdebug.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpdebug.h new file mode 100644 index 0000000..2deb465 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpdebug.h @@ -0,0 +1,52 @@ +/* + + 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. + +*/ + +#ifndef RTPDEBUG_H + +#define RTPDEBUG_H + +#include "rtpconfig.h" + +#ifdef RTPDEBUG + #include "rtptypes.h" + + void *operator new(size_t s,char filename[],int line); +#ifdef RTP_HAVE_ARRAYALLOC + void *operator new[](size_t s,char filename[],int line); + #define new new ((char*)__FILE__,__LINE__) +#else + #define new new ((char*)__FILE__,__LINE__) +#endif // RTP_HAVE_ARRAYALLOC +#endif // RTPDEBUG + +#endif // RTPDEBUG_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpdefines.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpdefines.h new file mode 100644 index 0000000..a18c056 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpdefines.h @@ -0,0 +1,76 @@ +/* + + 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. + +*/ + +#ifndef RTPDEFINES_H + +#define RTPDEFINES_H + +#define RTP_VERSION 2 +#define RTP_MAXCSRCS 15 +#define RTP_MINPACKETSIZE 600 +#define RTP_DEFAULTPACKETSIZE 1400 +#define RTP_PROBATIONCOUNT 2 +#define RTP_MAXPRIVITEMS 256 +#define RTP_SENDERTIMEOUTMULTIPLIER 2 +#define RTP_BYETIMEOUTMULTIPLIER 1 +#define RTP_MEMBERTIMEOUTMULTIPLIER 5 +#define RTP_COLLISIONTIMEOUTMULTIPLIER 10 +#define RTP_NOTETTIMEOUTMULTIPLIER 25 +#define RTP_DEFAULTSESSIONBANDWIDTH 10000.0 + +#define RTP_RTCPTYPE_SR 200 +#define RTP_RTCPTYPE_RR 201 +#define RTP_RTCPTYPE_SDES 202 +#define RTP_RTCPTYPE_BYE 203 +#define RTP_RTCPTYPE_APP 204 + +#define RTCP_SDES_ID_CNAME 1 +#define RTCP_SDES_ID_NAME 2 +#define RTCP_SDES_ID_EMAIL 3 +#define RTCP_SDES_ID_PHONE 4 +#define RTCP_SDES_ID_LOCATION 5 +#define RTCP_SDES_ID_TOOL 6 +#define RTCP_SDES_ID_NOTE 7 +#define RTCP_SDES_ID_PRIVATE 8 +#define RTCP_SDES_NUMITEMS_NONPRIVATE 7 +#define RTCP_SDES_MAXITEMLENGTH 255 + +#define RTCP_BYE_MAXREASONLENGTH 255 +#define RTCP_DEFAULTMININTERVAL 5.0 +#define RTCP_DEFAULTBANDWIDTHFRACTION 0.05 +#define RTCP_DEFAULTSENDERFRACTION 0.25 +#define RTCP_DEFAULTHALFATSTARTUP true +#define RTCP_DEFAULTIMMEDIATEBYE true +#define RTCP_DEFAULTSRBYE true + +#endif // RTPDEFINES_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtperrors.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtperrors.h new file mode 100644 index 0000000..de9832c --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtperrors.h @@ -0,0 +1,251 @@ +/* + + 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 rtperrors.h + */ + +#ifndef RTPERRORS_H + +#define RTPERRORS_H + +#include "rtpconfig.h" +#include + +namespace jrtplib +{ + +/** Returns a string describing the error code \c errcode. */ +std::string JRTPLIB_IMPORTEXPORT RTPGetErrorString(int errcode); + +} // end namespace + +#define ERR_RTP_OUTOFMEM -1 +#define ERR_RTP_NOTHREADSUPPORT -2 +#define ERR_RTP_COLLISIONLIST_BADADDRESS -3 +#define ERR_RTP_HASHTABLE_ELEMENTALREADYEXISTS -4 +#define ERR_RTP_HASHTABLE_ELEMENTNOTFOUND -5 +#define ERR_RTP_HASHTABLE_FUNCTIONRETURNEDINVALIDHASHINDEX -6 +#define ERR_RTP_HASHTABLE_NOCURRENTELEMENT -7 +#define ERR_RTP_KEYHASHTABLE_FUNCTIONRETURNEDINVALIDHASHINDEX -8 +#define ERR_RTP_KEYHASHTABLE_KEYALREADYEXISTS -9 +#define ERR_RTP_KEYHASHTABLE_KEYNOTFOUND -10 +#define ERR_RTP_KEYHASHTABLE_NOCURRENTELEMENT -11 +#define ERR_RTP_PACKBUILD_ALREADYINIT -12 +#define ERR_RTP_PACKBUILD_CSRCALREADYINLIST -13 +#define ERR_RTP_PACKBUILD_CSRCLISTFULL -14 +#define ERR_RTP_PACKBUILD_CSRCNOTINLIST -15 +#define ERR_RTP_PACKBUILD_DEFAULTMARKNOTSET -16 +#define ERR_RTP_PACKBUILD_DEFAULTPAYLOADTYPENOTSET -17 +#define ERR_RTP_PACKBUILD_DEFAULTTSINCNOTSET -18 +#define ERR_RTP_PACKBUILD_INVALIDMAXPACKETSIZE -19 +#define ERR_RTP_PACKBUILD_NOTINIT -20 +#define ERR_RTP_PACKET_BADPAYLOADTYPE -21 +#define ERR_RTP_PACKET_DATAEXCEEDSMAXSIZE -22 +#define ERR_RTP_PACKET_EXTERNALBUFFERNULL -23 +#define ERR_RTP_PACKET_ILLEGALBUFFERSIZE -24 +#define ERR_RTP_PACKET_INVALIDPACKET -25 +#define ERR_RTP_PACKET_TOOMANYCSRCS -26 +#define ERR_RTP_POLLTHREAD_ALREADYRUNNING -27 +#define ERR_RTP_POLLTHREAD_CANTINITMUTEX -28 +#define ERR_RTP_POLLTHREAD_CANTSTARTTHREAD -29 +#define ERR_RTP_RTCPCOMPOUND_INVALIDPACKET -30 +#define ERR_RTP_RTCPCOMPPACKBUILDER_ALREADYBUILDING -31 +#define ERR_RTP_RTCPCOMPPACKBUILDER_ALREADYBUILT -32 +#define ERR_RTP_RTCPCOMPPACKBUILDER_ALREADYGOTREPORT -33 +#define ERR_RTP_RTCPCOMPPACKBUILDER_APPDATALENTOOBIG -34 +#define ERR_RTP_RTCPCOMPPACKBUILDER_BUFFERSIZETOOSMALL -35 +#define ERR_RTP_RTCPCOMPPACKBUILDER_ILLEGALAPPDATALENGTH -36 +#define ERR_RTP_RTCPCOMPPACKBUILDER_ILLEGALSUBTYPE -37 +#define ERR_RTP_RTCPCOMPPACKBUILDER_INVALIDITEMTYPE -38 +#define ERR_RTP_RTCPCOMPPACKBUILDER_MAXPACKETSIZETOOSMALL -39 +#define ERR_RTP_RTCPCOMPPACKBUILDER_NOCURRENTSOURCE -40 +#define ERR_RTP_RTCPCOMPPACKBUILDER_NOREPORTPRESENT -41 +#define ERR_RTP_RTCPCOMPPACKBUILDER_NOTBUILDING -42 +#define ERR_RTP_RTCPCOMPPACKBUILDER_NOTENOUGHBYTESLEFT -43 +#define ERR_RTP_RTCPCOMPPACKBUILDER_REPORTNOTSTARTED -44 +#define ERR_RTP_RTCPCOMPPACKBUILDER_TOOMANYSSRCS -45 +#define ERR_RTP_RTCPCOMPPACKBUILDER_TOTALITEMLENGTHTOOBIG -46 +#define ERR_RTP_RTCPPACKETBUILDER_ALREADYINIT -47 +#define ERR_RTP_RTCPPACKETBUILDER_ILLEGALMAXPACKSIZE -48 +#define ERR_RTP_RTCPPACKETBUILDER_ILLEGALTIMESTAMPUNIT -49 +#define ERR_RTP_RTCPPACKETBUILDER_NOTINIT -50 +#define ERR_RTP_RTCPPACKETBUILDER_PACKETFILLEDTOOSOON -51 +#define ERR_RTP_SCHEDPARAMS_BADFRACTION -52 +#define ERR_RTP_SCHEDPARAMS_BADMINIMUMINTERVAL -53 +#define ERR_RTP_SCHEDPARAMS_INVALIDBANDWIDTH -54 +#define ERR_RTP_SDES_LENGTHTOOBIG -55 +#define ERR_RTP_SDES_MAXPRIVITEMS -56 +#define ERR_RTP_SDES_PREFIXNOTFOUND -57 +#define ERR_RTP_SESSION_ALREADYCREATED -58 +#define ERR_RTP_SESSION_CANTGETLOGINNAME -59 +#define ERR_RTP_SESSION_CANTINITMUTEX -60 +#define ERR_RTP_SESSION_MAXPACKETSIZETOOSMALL -61 +#define ERR_RTP_SESSION_NOTCREATED -62 +#define ERR_RTP_SESSION_UNSUPPORTEDTRANSMISSIONPROTOCOL -63 +#define ERR_RTP_SESSION_USINGPOLLTHREAD -64 +#define ERR_RTP_SOURCES_ALREADYHAVEOWNSSRC -65 +#define ERR_RTP_SOURCES_DONTHAVEOWNSSRC -66 +#define ERR_RTP_SOURCES_ILLEGALSDESTYPE -67 +#define ERR_RTP_SOURCES_SSRCEXISTS -68 +#define ERR_RTP_TRANS_BUFFERLENGTHTOOSMALL -69 +#define ERR_RTP_UDPV4TRANS_ALREADYCREATED -70 +#define ERR_RTP_UDPV4TRANS_ALREADYINIT -71 +#define ERR_RTP_UDPV4TRANS_ALREADYWAITING -72 +#define ERR_RTP_UDPV4TRANS_CANTBINDRTCPSOCKET -73 +#define ERR_RTP_UDPV4TRANS_CANTBINDRTPSOCKET -74 +#define ERR_RTP_UDPV4TRANS_CANTCREATESOCKET -75 +#define ERR_RTP_UDPV4TRANS_CANTINITMUTEX -76 +#define ERR_RTP_UDPV4TRANS_CANTSETRTCPRECEIVEBUF -77 +#define ERR_RTP_UDPV4TRANS_CANTSETRTCPTRANSMITBUF -78 +#define ERR_RTP_UDPV4TRANS_CANTSETRTPRECEIVEBUF -79 +#define ERR_RTP_UDPV4TRANS_CANTSETRTPTRANSMITBUF -80 +#define ERR_RTP_UDPV4TRANS_COULDNTJOINMULTICASTGROUP -81 +#define ERR_RTP_UDPV4TRANS_DIFFERENTRECEIVEMODE -82 +#define ERR_RTP_UDPV4TRANS_ILLEGALPARAMETERS -83 +#define ERR_RTP_UDPV4TRANS_INVALIDADDRESSTYPE -84 +#define ERR_RTP_UDPV4TRANS_NOLOCALIPS -85 +#define ERR_RTP_UDPV4TRANS_NOMULTICASTSUPPORT -86 +#define ERR_RTP_UDPV4TRANS_NOSUCHENTRY -87 +#define ERR_RTP_UDPV4TRANS_NOTAMULTICASTADDRESS -88 +#define ERR_RTP_UDPV4TRANS_NOTCREATED -89 +#define ERR_RTP_UDPV4TRANS_NOTINIT -90 +#define ERR_RTP_UDPV4TRANS_NOTWAITING -91 +#define ERR_RTP_UDPV4TRANS_PORTBASENOTEVEN -92 +#define ERR_RTP_UDPV4TRANS_SPECIFIEDSIZETOOBIG -93 +#define ERR_RTP_UDPV6TRANS_ALREADYCREATED -94 +#define ERR_RTP_UDPV6TRANS_ALREADYINIT -95 +#define ERR_RTP_UDPV6TRANS_ALREADYWAITING -96 +#define ERR_RTP_UDPV6TRANS_CANTBINDRTCPSOCKET -97 +#define ERR_RTP_UDPV6TRANS_CANTBINDRTPSOCKET -98 +#define ERR_RTP_UDPV6TRANS_CANTCREATESOCKET -99 +#define ERR_RTP_UDPV6TRANS_CANTINITMUTEX -100 +#define ERR_RTP_UDPV6TRANS_CANTSETRTCPRECEIVEBUF -101 +#define ERR_RTP_UDPV6TRANS_CANTSETRTCPTRANSMITBUF -102 +#define ERR_RTP_UDPV6TRANS_CANTSETRTPRECEIVEBUF -103 +#define ERR_RTP_UDPV6TRANS_CANTSETRTPTRANSMITBUF -104 +#define ERR_RTP_UDPV6TRANS_COULDNTJOINMULTICASTGROUP -105 +#define ERR_RTP_UDPV6TRANS_DIFFERENTRECEIVEMODE -106 +#define ERR_RTP_UDPV6TRANS_ILLEGALPARAMETERS -107 +#define ERR_RTP_UDPV6TRANS_INVALIDADDRESSTYPE -108 +#define ERR_RTP_UDPV6TRANS_NOLOCALIPS -109 +#define ERR_RTP_UDPV6TRANS_NOMULTICASTSUPPORT -110 +#define ERR_RTP_UDPV6TRANS_NOSUCHENTRY -111 +#define ERR_RTP_UDPV6TRANS_NOTAMULTICASTADDRESS -112 +#define ERR_RTP_UDPV6TRANS_NOTCREATED -113 +#define ERR_RTP_UDPV6TRANS_NOTINIT -114 +#define ERR_RTP_UDPV6TRANS_NOTWAITING -115 +#define ERR_RTP_UDPV6TRANS_PORTBASENOTEVEN -116 +#define ERR_RTP_UDPV6TRANS_SPECIFIEDSIZETOOBIG -117 +#define ERR_RTP_INTERNALSOURCEDATA_INVALIDPROBATIONTYPE -118 +#define ERR_RTP_SESSION_USERDEFINEDTRANSMITTERNULL -119 +#define ERR_RTP_FAKETRANS_ALREADYCREATED -120 +#define ERR_RTP_FAKETRANS_ALREADYINIT -121 +#define ERR_RTP_FAKETRANS_CANTINITMUTEX -122 +#define ERR_RTP_FAKETRANS_COULDNTJOINMULTICASTGROUP -123 +#define ERR_RTP_FAKETRANS_DIFFERENTRECEIVEMODE -124 +#define ERR_RTP_FAKETRANS_ILLEGALPARAMETERS -125 +#define ERR_RTP_FAKETRANS_INVALIDADDRESSTYPE -126 +#define ERR_RTP_FAKETRANS_NOLOCALIPS -127 +#define ERR_RTP_FAKETRANS_NOMULTICASTSUPPORT -128 +#define ERR_RTP_FAKETRANS_NOSUCHENTRY -129 +#define ERR_RTP_FAKETRANS_NOTAMULTICASTADDRESS -130 +#define ERR_RTP_FAKETRANS_NOTCREATED -131 +#define ERR_RTP_FAKETRANS_NOTINIT -132 +#define ERR_RTP_FAKETRANS_PORTBASENOTEVEN -133 +#define ERR_RTP_FAKETRANS_SPECIFIEDSIZETOOBIG -134 +#define ERR_RTP_FAKETRANS_WAITNOTIMPLEMENTED -135 +#define ERR_RTP_RTPRANDOMURANDOM_CANTOPEN -136 +#define ERR_RTP_RTPRANDOMURANDOM_ALREADYOPEN -137 +#define ERR_RTP_RTPRANDOMRANDS_NOTSUPPORTED -138 +#define ERR_RTP_EXTERNALTRANS_ALREADYCREATED -139 +#define ERR_RTP_EXTERNALTRANS_ALREADYINIT -140 +#define ERR_RTP_EXTERNALTRANS_ALREADYWAITING -141 +#define ERR_RTP_EXTERNALTRANS_BADRECEIVEMODE -142 +#define ERR_RTP_EXTERNALTRANS_CANTINITMUTEX -143 +#define ERR_RTP_EXTERNALTRANS_ILLEGALPARAMETERS -144 +#define ERR_RTP_EXTERNALTRANS_NOACCEPTLIST -145 +#define ERR_RTP_EXTERNALTRANS_NODESTINATIONSSUPPORTED -146 +#define ERR_RTP_EXTERNALTRANS_NOIGNORELIST -147 +#define ERR_RTP_EXTERNALTRANS_NOMULTICASTSUPPORT -148 +#define ERR_RTP_EXTERNALTRANS_NOSENDER -149 +#define ERR_RTP_EXTERNALTRANS_NOTCREATED -150 +#define ERR_RTP_EXTERNALTRANS_NOTINIT -151 +#define ERR_RTP_EXTERNALTRANS_NOTWAITING -152 +#define ERR_RTP_EXTERNALTRANS_SENDERROR -153 +#define ERR_RTP_EXTERNALTRANS_SPECIFIEDSIZETOOBIG -154 +#define ERR_RTP_UDPV4TRANS_CANTGETSOCKETPORT -155 +#define ERR_RTP_UDPV4TRANS_NOTANIPV4SOCKET -156 +#define ERR_RTP_UDPV4TRANS_SOCKETPORTNOTSET -157 +#define ERR_RTP_UDPV4TRANS_CANTGETSOCKETTYPE -158 +#define ERR_RTP_UDPV4TRANS_INVALIDSOCKETTYPE -159 +#define ERR_RTP_UDPV4TRANS_CANTGETVALIDSOCKET -160 +#define ERR_RTP_UDPV4TRANS_TOOMANYATTEMPTSCHOOSINGSOCKET -161 +#define ERR_RTP_RTPSESSION_CHANGEREQUESTEDBUTNOTIMPLEMENTED -162 +#define ERR_RTP_SECURESESSION_CONTEXTALREADYINITIALIZED -163 +#define ERR_RTP_SECURESESSION_CANTINITIALIZE_SRTPCONTEXT -164 +#define ERR_RTP_SECURESESSION_CANTINITMUTEX -165 +#define ERR_RTP_SECURESESSION_CONTEXTNOTINITIALIZED -166 +#define ERR_RTP_SECURESESSION_NOTENOUGHDATATOENCRYPT -167 +#define ERR_RTP_SECURESESSION_CANTENCRYPTRTPDATA -168 +#define ERR_RTP_SECURESESSION_CANTENCRYPTRTCPDATA -169 +#define ERR_RTP_SECURESESSION_NOTENOUGHDATATODECRYPT -170 +#define ERR_RTP_SECURESESSION_CANTDECRYPTRTPDATA -171 +#define ERR_RTP_SECURESESSION_CANTDECRYPTRTCPDATA -172 +#define ERR_RTP_ABORTDESC_ALREADYINIT -173 +#define ERR_RTP_ABORTDESC_NOTINIT -174 +#define ERR_RTP_ABORTDESC_CANTCREATEABORTDESCRIPTORS -175 +#define ERR_RTP_ABORTDESC_CANTCREATEPIPE -176 +#define ERR_RTP_SESSION_THREADSAFETYCONFLICT -177 +#define ERR_RTP_SELECT_ERRORINSELECT -178 +#define ERR_RTP_SELECT_SOCKETDESCRIPTORTOOLARGE -179 +#define ERR_RTP_SELECT_ERRORINPOLL -180 +#define ERR_RTP_TCPTRANS_NOTINIT -181 +#define ERR_RTP_TCPTRANS_ALREADYINIT -182 +#define ERR_RTP_TCPTRANS_ALREADYCREATED -183 +#define ERR_RTP_TCPTRANS_ILLEGALPARAMETERS -184 +#define ERR_RTP_TCPTRANS_CANTINITMUTEX -185 +#define ERR_RTP_TCPTRANS_ALREADYWAITING -186 +#define ERR_RTP_TCPTRANS_NOTCREATED -187 +#define ERR_RTP_TCPTRANS_INVALIDADDRESSTYPE -188 +#define ERR_RTP_TCPTRANS_NOSOCKETSPECIFIED -189 +#define ERR_RTP_TCPTRANS_NOMULTICASTSUPPORT -190 +#define ERR_RTP_TCPTRANS_RECEIVEMODENOTSUPPORTED -191 +#define ERR_RTP_TCPTRANS_SPECIFIEDSIZETOOBIG -192 +#define ERR_RTP_TCPTRANS_NOTWAITING -193 +#define ERR_RTP_TCPTRANS_SOCKETALREADYINDESTINATIONS -194 +#define ERR_RTP_TCPTRANS_SOCKETNOTFOUNDINDESTINATIONS -195 +#define ERR_RTP_TCPTRANS_ERRORINSEND -196 +#define ERR_RTP_TCPTRANS_ERRORINRECV -197 + +#endif // RTPERRORS_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpexternaltransmitter.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpexternaltransmitter.h new file mode 100644 index 0000000..e5ff8d4 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpexternaltransmitter.h @@ -0,0 +1,235 @@ +/* + + 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 rtpexternaltransmitter.h + */ + +#ifndef RTPEXTERNALTRANSMITTER_H + +#define RTPEXTERNALTRANSMITTER_H + +#include "rtpconfig.h" +#include "rtptransmitter.h" +#include "rtpabortdescriptors.h" +#include + +#ifdef RTP_SUPPORT_THREAD + #include +#endif // RTP_SUPPORT_THREAD + +namespace jrtplib +{ + +class RTPExternalTransmitter; + +/** Base class to specify a mechanism to transmit RTP packets outside of this library. + * Base class to specify a mechanism to transmit RTP packets outside of this library. When + * you want to use your own mechanism to transmit RTP packets, you need to specify that + * you'll be using the external transmission component, and derive a class from this base + * class. An instance should then be specified in the RTPExternalTransmissionParams object, + * so that the transmitter will call the \c SendRTP, \c SendRTCP and \c ComesFromThisSender + * methods of this instance when needed. + */ +class JRTPLIB_IMPORTEXPORT RTPExternalSender +{ +public: + RTPExternalSender() { } + virtual ~RTPExternalSender() { } + + /** This member function will be called when RTP data needs to be transmitted. */ + virtual bool SendRTP(const void *data, size_t len) = 0; + + /** This member function will be called when an RTCP packet needs to be transmitted. */ + virtual bool SendRTCP(const void *data, size_t len) = 0; + + /** Used to identify if an RTPAddress instance originated from this sender (to be able to detect own packets). */ + virtual bool ComesFromThisSender(const RTPAddress *a) = 0; +}; + +/** Interface to inject incoming RTP and RTCP packets into the library. + * Interface to inject incoming RTP and RTCP packets into the library. When you have your own + * mechanism to receive incoming RTP/RTCP data, you'll need to pass these packets to the library. + * By first retrieving the RTPExternalTransmissionInfo instance for the external transmitter you'll + * be using, you can obtain the associated RTPExternalPacketInjecter instance. By calling it's + * member functions, you can then inject RTP or RTCP data into the library for further processing. + */ +class JRTPLIB_IMPORTEXPORT RTPExternalPacketInjecter +{ +public: + RTPExternalPacketInjecter(RTPExternalTransmitter *trans) { transmitter = trans; } + ~RTPExternalPacketInjecter() { } + + /** This function can be called to insert an RTP packet into the transmission component. */ + void InjectRTP(const void *data, size_t len, const RTPAddress &a); + + /** This function can be called to insert an RTCP packet into the transmission component. */ + void InjectRTCP(const void *data, size_t len, const RTPAddress &a); + + /** Use this function to inject an RTP or RTCP packet and the transmitter will try to figure out which type of packet it is. */ + void InjectRTPorRTCP(const void *data, size_t len, const RTPAddress &a); +private: + RTPExternalTransmitter *transmitter; +}; + +/** Parameters to initialize a transmitter of type RTPExternalTransmitter. */ +class JRTPLIB_IMPORTEXPORT RTPExternalTransmissionParams : public RTPTransmissionParams +{ +public: + /** Using this constructor you can specify which RTPExternalSender object you'll be using + * and how much the additional header overhead for each packet will be. */ + RTPExternalTransmissionParams(RTPExternalSender *s, int headeroverhead):RTPTransmissionParams(RTPTransmitter::ExternalProto) { sender = s; headersize = headeroverhead; } + + RTPExternalSender *GetSender() const { return sender; } + int GetAdditionalHeaderSize() const { return headersize; } +private: + RTPExternalSender *sender; + int headersize; +}; + +/** Additional information about the external transmission component. */ +class JRTPLIB_IMPORTEXPORT RTPExternalTransmissionInfo : public RTPTransmissionInfo +{ +public: + RTPExternalTransmissionInfo(RTPExternalPacketInjecter *p) : RTPTransmissionInfo(RTPTransmitter::ExternalProto) { packetinjector = p; } + + /** Tells you which RTPExternalPacketInjecter you need to use to pass RTP or RTCP + * data on to the transmission component. */ + RTPExternalPacketInjecter *GetPacketInjector() const { return packetinjector; } +private: + RTPExternalPacketInjecter *packetinjector; +}; + +/** A transmission component which will use user specified functions to transmit the data and + * which will expose functions to inject received RTP or RTCP data into this component. + * A transmission component which will use user specified functions to transmit the data and + * which will expose functions to inject received RTP or RTCP data into this component. Use + * a class derived from RTPExternalSender to specify the functions which need to be used for + * sending the data. Obtain the RTPExternalTransmissionInfo object associated with this + * transmitter to obtain the functions needed to pass RTP/RTCP packets on to the transmitter. + */ +class JRTPLIB_IMPORTEXPORT RTPExternalTransmitter : public RTPTransmitter +{ + JRTPLIB_NO_COPY(RTPExternalTransmitter) +public: + RTPExternalTransmitter(RTPMemoryManager *mgr); + ~RTPExternalTransmitter(); + + 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 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(); +#ifdef RTPDEBUG + void Dump(); +#endif // RTPDEBUG + + void InjectRTP(const void *data, size_t len, const RTPAddress &a); + void InjectRTCP(const void *data, size_t len, const RTPAddress &a); + void InjectRTPorRTCP(const void *data, size_t len, const RTPAddress &a); +private: + void FlushPackets(); + + bool init; + bool created; + bool waitingfordata; + RTPExternalSender *sender; + RTPExternalPacketInjecter packetinjector; + + std::list rawpacketlist; + + uint8_t *localhostname; + size_t localhostnamelength; + + size_t maxpacksize; + int headersize; + + RTPAbortDescriptors m_abortDesc; + int m_abortCount; +#ifdef RTP_SUPPORT_THREAD + jthread::JMutex mainmutex,waitmutex; + int threadsafe; +#endif // RTP_SUPPORT_THREAD +}; + +inline void RTPExternalPacketInjecter::InjectRTP(const void *data, size_t len, const RTPAddress &a) +{ + transmitter->InjectRTP(data, len, a); +} + +inline void RTPExternalPacketInjecter::InjectRTCP(const void *data, size_t len, const RTPAddress &a) +{ + transmitter->InjectRTCP(data, len, a); +} + +inline void RTPExternalPacketInjecter::InjectRTPorRTCP(const void *data, size_t len, const RTPAddress &a) +{ + transmitter->InjectRTPorRTCP(data, len, a); +} + +} // end namespace + +#endif // RTPTCPSOCKETTRANSMITTER_H + + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpfaketransmitter.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpfaketransmitter.h new file mode 100644 index 0000000..a953f05 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpfaketransmitter.h @@ -0,0 +1,247 @@ +/* + + This class allows for jrtp to process packets without sending them out + anywhere. + The incoming messages are handed in to jrtp through the TransmissionParams + and can be retreived from jrtp through the normal polling mecanisms. + The outgoing RTP/RTCP packets are given to jrtp through the normal + session->SendPacket() and those packets are handed back out to the + client through a callback function (packet_ready_cb). + + example usage : Allows for integration of RTP into gstreamer. + + Copyright (c) 2005 Philippe Khalaf + + This file is a part of JRTPLIB + Copyright (c) 1999-2004 Jori Liesenborgs + + Contact: jori.liesenborgs@gmail.com + + This library was developed at the "Expertisecentrum Digitale Media" + (http://www.edm.luc.ac.be), a research center of the "Limburgs Universitair + Centrum" (http://www.luc.ac.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. + +*/ + +#ifndef RTPFAKETRANSMITTER_H + +#define RTPFAKETRANSMITTER_H + +#include "rtpconfig.h" + +#include "rtptransmitter.h" +#include "rtpipv4destination.h" +#include "rtphashtable.h" +#include "rtpkeyhashtable.h" +#include + +#ifdef RTP_SUPPORT_THREAD + #include +#endif // RTP_SUPPORT_THREAD + +#define RTPFAKETRANS_HASHSIZE 8317 +#define RTPFAKETRANS_DEFAULTPORTBASE 5000 + +namespace jrtplib +{ + +// Definition of a callback that is called when a packet is ready for sending +// params (*data, data_len, dest_addr, dest_port, rtp [1 if rtp, 0 if rtcp]) +typedef void(*packet_ready_cb)(void*, uint8_t*, uint16_t, uint32_t, uint16_t, int rtp); + +class RTPFakeTransmissionParams : public RTPTransmissionParams +{ +public: + RTPFakeTransmissionParams():RTPTransmissionParams(RTPTransmitter::UserDefinedProto) { portbase = RTPFAKETRANS_DEFAULTPORTBASE; bindIP = 0; multicastTTL = 1; currentdata = NULL;} + void SetBindIP(uint32_t ip) { bindIP = ip; } + void SetPortbase(uint16_t pbase) { portbase = pbase; } + void SetMulticastTTL(uint8_t mcastTTL) { multicastTTL = mcastTTL; } + void SetLocalIPList(std::list &iplist) { localIPs = iplist; } + void ClearLocalIPList() { localIPs.clear(); } + void SetCurrentData(uint8_t *data) { currentdata = data; } + void SetCurrentDataLen(uint16_t len) { currentdatalen = len; } + void SetCurrentDataAddr(uint32_t addr) { currentdataaddr = addr; } + void SetCurrentDataPort(uint16_t port) { currentdataport = port; } + void SetCurrentDataType(bool type) { currentdatatype = type; } + void SetPacketReadyCB(packet_ready_cb cb) { packetreadycb = cb; }; + void SetPacketReadyCBData(void *data) { packetreadycbdata = data; }; + uint32_t GetBindIP() const { return bindIP; } + uint16_t GetPortbase() const { return portbase; } + uint8_t GetMulticastTTL() const { return multicastTTL; } + const std::list &GetLocalIPList() const { return localIPs; } + uint8_t* GetCurrentData() const { return currentdata; } + uint16_t GetCurrentDataLen() const { return currentdatalen; } + uint32_t GetCurrentDataAddr() const { return currentdataaddr; } + uint16_t GetCurrentDataPort() const { return currentdataport; } + bool GetCurrentDataType() const { return currentdatatype; } + packet_ready_cb GetPacketReadyCB() const { return packetreadycb; } + void* GetPacketReadyCBData() const { return packetreadycbdata; } +private: + uint16_t portbase; + uint32_t bindIP; + std::list localIPs; + uint8_t multicastTTL; + uint8_t* currentdata; + uint16_t currentdatalen; + uint32_t currentdataaddr; + uint16_t currentdataport; + bool currentdatatype; + packet_ready_cb packetreadycb; + void *packetreadycbdata; +}; + +class RTPFakeTransmissionInfo : public RTPTransmissionInfo +{ +public: + RTPFakeTransmissionInfo(std::list iplist, + RTPFakeTransmissionParams *transparams) : + RTPTransmissionInfo(RTPTransmitter::UserDefinedProto) + { localIPlist = iplist; params = transparams; } + + ~RTPFakeTransmissionInfo() { } + std::list GetLocalIPList() const { return localIPlist; } + RTPFakeTransmissionParams* GetTransParams() { return params; } +private: + std::list localIPlist; + RTPFakeTransmissionParams *params; +}; + +class RTPFakeTrans_GetHashIndex_IPv4Dest +{ +public: + static int GetIndex(const RTPIPv4Destination &d) { return d.GetIP()%RTPFAKETRANS_HASHSIZE; } +}; + +class RTPFakeTrans_GetHashIndex_uint32_t +{ +public: + static int GetIndex(const uint32_t &k) { return k%RTPFAKETRANS_HASHSIZE; } +}; + +#define RTPFAKETRANS_HEADERSIZE (20+8) + +class RTPFakeTransmitter : public RTPTransmitter +{ +public: + RTPFakeTransmitter(RTPMemoryManager *mgr); + ~RTPFakeTransmitter(); + + 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 RTPFAKETRANS_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(); +#ifdef RTPDEBUG + void Dump(); +#endif // RTPDEBUG +private: + int CreateLocalIPList(); + bool GetLocalIPList_Interfaces(); + void GetLocalIPList_DNS(); + void AddLoopbackAddress(); + void FlushPackets(); + int FakePoll(); + int ProcessAddAcceptIgnoreEntry(uint32_t ip,uint16_t port); + int ProcessDeleteAcceptIgnoreEntry(uint32_t ip,uint16_t port); +#ifdef RTP_SUPPORT_IPV4MULTICAST + bool SetMulticastTTL(uint8_t ttl); +#endif // RTP_SUPPORT_IPV4MULTICAST + bool ShouldAcceptData(uint32_t srcip,uint16_t srcport); + void ClearAcceptIgnoreInfo(); + + RTPFakeTransmissionParams *params; + bool init; + bool created; + bool waitingfordata; + std::list localIPs; + uint16_t portbase; + uint8_t multicastTTL; + RTPTransmitter::ReceiveMode receivemode; + + uint8_t *localhostname; + size_t localhostnamelength; + + RTPHashTable destinations; +#ifdef RTP_SUPPORT_IPV4MULTICAST +// RTPHashTable multicastgroups; +#endif // RTP_SUPPORT_IPV4MULTICAST + std::list rawpacketlist; + + bool supportsmulticasting; + size_t maxpacksize; + + class PortInfo + { + public: + PortInfo() { all = false; } + + bool all; + std::list portlist; + }; + + RTPKeyHashTable acceptignoreinfo; + + int CreateAbortDescriptors(); + void DestroyAbortDescriptors(); + void AbortWaitInternal(); +#ifdef RTP_SUPPORT_THREAD + jthread::JMutex mainmutex,waitmutex; + int threadsafe; +#endif // RTP_SUPPORT_THREAD +}; + +} // end namespace + +#endif // RTPFAKETRANSMITTER_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtphashtable.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtphashtable.h new file mode 100644 index 0000000..53f54a1 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtphashtable.h @@ -0,0 +1,345 @@ +/* + + 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. + +*/ + +#ifndef RTPHASHTABLE_H + +#define RTPHASHTABLE_H + +/** + * \file rtphashtable.h + */ + +#include "rtperrors.h" +#include "rtpmemoryobject.h" + +#ifdef RTPDEBUG +#include +#endif // RTPDEBUG + +namespace jrtplib +{ + +//template +template +class RTPHashTable : public RTPMemoryObject +{ + JRTPLIB_NO_COPY(RTPHashTable) +public: + RTPHashTable(RTPMemoryManager *mgr = 0, int memtype = RTPMEM_TYPE_OTHER); + ~RTPHashTable() { Clear(); } + + void GotoFirstElement() { curhashelem = firsthashelem; } + void GotoLastElement() { curhashelem = lasthashelem; } + bool HasCurrentElement() { return (curhashelem == 0)?false:true; } + int DeleteCurrentElement(); + Element &GetCurrentElement() { return curhashelem->GetElement(); } + int GotoElement(const Element &e); + bool HasElement(const Element &e); + void GotoNextElement(); + void GotoPreviousElement(); + void Clear(); + + int AddElement(const Element &elem); + int DeleteElement(const Element &elem); + +#ifdef RTPDEBUG + void Dump(); +#endif // RTPDEBUG +private: + class HashElement + { + public: + HashElement(const Element &e,int index):element(e) { hashprev = 0; hashnext = 0; listnext = 0; listprev = 0; hashindex = index; } + int GetHashIndex() { return hashindex; } + Element &GetElement() { return element; } +#ifdef RTPDEBUG + void Dump() { std::cout << "\tHash index " << hashindex << " | Element " << element << std::endl; } +#endif // RTPDEBUG + private: + int hashindex; + Element element; + public: + HashElement *hashprev,*hashnext; + HashElement *listprev,*listnext; + }; + + HashElement *table[hashsize]; + HashElement *firsthashelem,*lasthashelem; + HashElement *curhashelem; +#ifdef RTP_SUPPORT_MEMORYMANAGEMENT + int memorytype; +#endif // RTP_SUPPORT_MEMORYMANAGEMENT +}; + +template +inline RTPHashTable::RTPHashTable(RTPMemoryManager *mgr,int memtype) : RTPMemoryObject(mgr) +{ + JRTPLIB_UNUSED(memtype); // possibly unused + + for (int i = 0 ; i < hashsize ; i++) + table[i] = 0; + firsthashelem = 0; + lasthashelem = 0; +#ifdef RTP_SUPPORT_MEMORYMANAGEMENT + memorytype = memtype; +#endif // RTP_SUPPORT_MEMORYMANAGEMENT +} + +template +inline int RTPHashTable::DeleteCurrentElement() +{ + if (curhashelem) + { + HashElement *tmp1,*tmp2; + int index; + + // First, relink elements in current hash bucket + + index = curhashelem->GetHashIndex(); + tmp1 = curhashelem->hashprev; + tmp2 = curhashelem->hashnext; + if (tmp1 == 0) // no previous element in hash bucket + { + table[index] = tmp2; + if (tmp2 != 0) + tmp2->hashprev = 0; + } + else // there is a previous element in the hash bucket + { + tmp1->hashnext = tmp2; + if (tmp2 != 0) + tmp2->hashprev = tmp1; + } + + // Relink elements in list + + tmp1 = curhashelem->listprev; + tmp2 = curhashelem->listnext; + if (tmp1 == 0) // curhashelem is first in list + { + firsthashelem = tmp2; + if (tmp2 != 0) + tmp2->listprev = 0; + else // curhashelem is also last in list + lasthashelem = 0; + } + else + { + tmp1->listnext = tmp2; + if (tmp2 != 0) + tmp2->listprev = tmp1; + else // curhashelem is last in list + lasthashelem = tmp1; + } + + // finally, with everything being relinked, we can delete curhashelem + RTPDelete(curhashelem,GetMemoryManager()); + curhashelem = tmp2; // Set to next element in the list + } + else + return ERR_RTP_HASHTABLE_NOCURRENTELEMENT; + return 0; +} + +template +inline int RTPHashTable::GotoElement(const Element &e) +{ + int index; + bool found; + + index = GetIndex::GetIndex(e); + if (index >= hashsize) + return ERR_RTP_HASHTABLE_FUNCTIONRETURNEDINVALIDHASHINDEX; + + curhashelem = table[index]; + found = false; + while(!found && curhashelem != 0) + { + if (curhashelem->GetElement() == e) + found = true; + else + curhashelem = curhashelem->hashnext; + } + if (!found) + return ERR_RTP_HASHTABLE_ELEMENTNOTFOUND; + return 0; +} + +template +inline bool RTPHashTable::HasElement(const Element &e) +{ + int index; + bool found; + HashElement *tmp; + + index = GetIndex::GetIndex(e); + if (index >= hashsize) + return false; + + tmp = table[index]; + found = false; + while(!found && tmp != 0) + { + if (tmp->GetElement() == e) + found = true; + else + tmp = tmp->hashnext; + } + return found; +} + +template +inline void RTPHashTable::GotoNextElement() +{ + if (curhashelem) + curhashelem = curhashelem->listnext; +} + +template +inline void RTPHashTable::GotoPreviousElement() +{ + if (curhashelem) + curhashelem = curhashelem->listprev; +} + +template +inline void RTPHashTable::Clear() +{ + HashElement *tmp1,*tmp2; + + for (int i = 0 ; i < hashsize ; i++) + table[i] = 0; + + tmp1 = firsthashelem; + while (tmp1 != 0) + { + tmp2 = tmp1->listnext; + RTPDelete(tmp1,GetMemoryManager()); + tmp1 = tmp2; + } + firsthashelem = 0; + lasthashelem = 0; +} + +template +inline int RTPHashTable::AddElement(const Element &elem) +{ + int index; + bool found; + HashElement *e,*newelem; + + index = GetIndex::GetIndex(elem); + if (index >= hashsize) + return ERR_RTP_HASHTABLE_FUNCTIONRETURNEDINVALIDHASHINDEX; + + e = table[index]; + found = false; + while(!found && e != 0) + { + if (e->GetElement() == elem) + found = true; + else + e = e->hashnext; + } + if (found) + return ERR_RTP_HASHTABLE_ELEMENTALREADYEXISTS; + + // Okay, the key doesn't exist, so we can add the new element in the hash table + + newelem = RTPNew(GetMemoryManager(),memorytype) HashElement(elem,index); + if (newelem == 0) + return ERR_RTP_OUTOFMEM; + + e = table[index]; + table[index] = newelem; + newelem->hashnext = e; + if (e != 0) + e->hashprev = newelem; + + // Now, we still got to add it to the linked list + + if (firsthashelem == 0) + { + firsthashelem = newelem; + lasthashelem = newelem; + } + else // there already are some elements in the list + { + lasthashelem->listnext = newelem; + newelem->listprev = lasthashelem; + lasthashelem = newelem; + } + return 0; +} + +template +inline int RTPHashTable::DeleteElement(const Element &elem) +{ + int status; + + status = GotoElement(elem); + if (status < 0) + return status; + return DeleteCurrentElement(); +} + +#ifdef RTPDEBUG +template +inline void RTPHashTable::Dump() +{ + HashElement *e; + + std::cout << "DUMPING TABLE CONTENTS:" << std::endl; + for (int i = 0 ; i < hashsize ; i++) + { + e = table[i]; + while (e != 0) + { + e->Dump(); + e = e->hashnext; + } + } + + std::cout << "DUMPING LIST CONTENTS:" << std::endl; + e = firsthashelem; + while (e != 0) + { + e->Dump(); + e = e->listnext; + } +} +#endif // RTPDEBUG + +} // end namespace + +#endif // RTPHASHTABLE_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpinternalsourcedata.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpinternalsourcedata.h new file mode 100644 index 0000000..deac7f0 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpinternalsourcedata.h @@ -0,0 +1,135 @@ +/* + + 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 rtpinternalsourcedata.h + */ + +#ifndef RTPINTERNALSOURCEDATA_H + +#define RTPINTERNALSOURCEDATA_H + +#include "rtpconfig.h" +#include "rtpsourcedata.h" +#include "rtpaddress.h" +#include "rtptimeutilities.h" +#include "rtpsources.h" + +namespace jrtplib +{ + +class JRTPLIB_IMPORTEXPORT RTPInternalSourceData : public RTPSourceData +{ +public: + RTPInternalSourceData(uint32_t ssrc, RTPSources::ProbationType probtype, RTPMemoryManager *mgr = 0); + ~RTPInternalSourceData(); + + int ProcessRTPPacket(RTPPacket *rtppack,const RTPTime &receivetime,bool *stored, RTPSources *sources); + void ProcessSenderInfo(const RTPNTPTime &ntptime,uint32_t rtptime,uint32_t packetcount, + uint32_t octetcount,const RTPTime &receivetime) { SRprevinf = SRinf; SRinf.Set(ntptime,rtptime,packetcount,octetcount,receivetime); stats.SetLastMessageTime(receivetime); } + void ProcessReportBlock(uint8_t fractionlost,int32_t lostpackets,uint32_t exthighseqnr, + uint32_t jitter,uint32_t lsr,uint32_t dlsr, + const RTPTime &receivetime) { RRprevinf = RRinf; RRinf.Set(fractionlost,lostpackets,exthighseqnr,jitter,lsr,dlsr,receivetime); stats.SetLastMessageTime(receivetime); } + void UpdateMessageTime(const RTPTime &receivetime) { stats.SetLastMessageTime(receivetime); } + int ProcessSDESItem(uint8_t sdesid,const uint8_t *data,size_t itemlen,const RTPTime &receivetime,bool *cnamecollis); +#ifdef RTP_SUPPORT_SDESPRIV + int ProcessPrivateSDESItem(const uint8_t *prefix,size_t prefixlen,const uint8_t *value,size_t valuelen,const RTPTime &receivetime); +#endif // RTP_SUPPORT_SDESPRIV + int ProcessBYEPacket(const uint8_t *reason,size_t reasonlen,const RTPTime &receivetime); + + int SetRTPDataAddress(const RTPAddress *a); + int SetRTCPDataAddress(const RTPAddress *a); + + void ClearSenderFlag() { issender = false; } + void SentRTPPacket() { if (!ownssrc) return; RTPTime t = RTPTime::CurrentTime(); issender = true; stats.SetLastRTPPacketTime(t); stats.SetLastMessageTime(t); } + void SetOwnSSRC() { ownssrc = true; validated = true; } + void SetCSRC() { validated = true; iscsrc = true; } + void ClearNote() { SDESinf.SetNote(0,0); } + +#ifdef RTP_SUPPORT_PROBATION +private: + RTPSources::ProbationType probationtype; +#endif // RTP_SUPPORT_PROBATION +}; + +inline int RTPInternalSourceData::SetRTPDataAddress(const RTPAddress *a) +{ + if (a == 0) + { + if (rtpaddr) + { + RTPDelete(rtpaddr,GetMemoryManager()); + rtpaddr = 0; + } + } + else + { + RTPAddress *newaddr = a->CreateCopy(GetMemoryManager()); + if (newaddr == 0) + return ERR_RTP_OUTOFMEM; + + if (rtpaddr && a != rtpaddr) + RTPDelete(rtpaddr,GetMemoryManager()); + rtpaddr = newaddr; + } + isrtpaddrset = true; + return 0; +} + +inline int RTPInternalSourceData::SetRTCPDataAddress(const RTPAddress *a) +{ + if (a == 0) + { + if (rtcpaddr) + { + RTPDelete(rtcpaddr,GetMemoryManager()); + rtcpaddr = 0; + } + } + else + { + RTPAddress *newaddr = a->CreateCopy(GetMemoryManager()); + if (newaddr == 0) + return ERR_RTP_OUTOFMEM; + + if (rtcpaddr && a != rtcpaddr) + RTPDelete(rtcpaddr,GetMemoryManager()); + rtcpaddr = newaddr; + } + isrtcpaddrset = true; + return 0; +} + +} // end namespace + +#endif // RTPINTERNALSOURCEDATA_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpipv4address.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpipv4address.h new file mode 100644 index 0000000..8db690b --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpipv4address.h @@ -0,0 +1,152 @@ +/* + + 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 rtpipv4address.h + */ + +#ifndef RTPIPV4ADDRESS_H + +#define RTPIPV4ADDRESS_H + +#include "rtpconfig.h" +#include "rtpaddress.h" +#include "rtptypes.h" + +namespace jrtplib +{ + +class RTPMemoryManager; + +/** Represents an IPv4 IP address and port. + * This class is used by the UDP over IPv4 transmission component. + * When an RTPIPv4Address 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 RTPIPv4Address : public RTPAddress +{ +public: + /** Creates an instance with IP address \c ip and port number \c port (both + * are interpreted in host byte order), and possibly sets the RTCP multiplex flag + * (see RTPIPv4Address::UseRTCPMultiplexingOnTransmission). */ + RTPIPv4Address(uint32_t ip = 0, uint16_t port = 0,bool rtcpmux = false):RTPAddress(IPv4Address) + { + RTPIPv4Address::ip = ip; + RTPIPv4Address::port = port; + if (rtcpmux) + rtcpsendport = port; + else + rtcpsendport = port+1; + } + + /** Creates an instance with IP address \c ip and port number \c port (both + * are interpreted in host byte order), and sets a specific port to + * send RTCP packets to (see RTPIPv4Address::GetRTCPSendPort). */ + RTPIPv4Address(uint32_t ip, uint16_t port, uint16_t rtcpsendport):RTPAddress(IPv4Address) + { + RTPIPv4Address::ip = ip; + RTPIPv4Address::port = port; + RTPIPv4Address::rtcpsendport = rtcpsendport; + } + + /** Creates an instance with IP address \c ip and port number \c port (\c port is + * interpreted in host byte order) and possibly sets the RTCP multiplex flag + * (see RTPIPv4Address::UseRTCPMultiplexingOnTransmission). */ + RTPIPv4Address(const uint8_t ip[4],uint16_t port = 0,bool rtcpmux = false):RTPAddress(IPv4Address) + { + RTPIPv4Address::ip = (uint32_t)ip[3]; + RTPIPv4Address::ip |= (((uint32_t)ip[2])<<8); + RTPIPv4Address::ip |= (((uint32_t)ip[1])<<16); + RTPIPv4Address::ip |= (((uint32_t)ip[0])<<24); + + RTPIPv4Address::port = port; + if (rtcpmux) + rtcpsendport = port; + else + rtcpsendport = port+1; + } + + /** Creates an instance with IP address \c ip and port number \c port (both + * are interpreted in host byte order), and sets a specific port to + * send RTCP packets to (see RTPIPv4Address::GetRTCPSendPort). */ + RTPIPv4Address(const uint8_t ip[4],uint16_t port,uint16_t rtcpsendport):RTPAddress(IPv4Address) + { + RTPIPv4Address::ip = (uint32_t)ip[3]; + RTPIPv4Address::ip |= (((uint32_t)ip[2])<<8); + RTPIPv4Address::ip |= (((uint32_t)ip[1])<<16); + RTPIPv4Address::ip |= (((uint32_t)ip[0])<<24); + + RTPIPv4Address::port = port; + RTPIPv4Address::rtcpsendport = rtcpsendport; + } + + ~RTPIPv4Address() { } + + /** Sets the IP address for this instance to \c ip which is assumed to be in host byte order. */ + void SetIP(uint32_t ip) { RTPIPv4Address::ip = ip; } + + /** Sets the IP address of this instance to \c ip. */ + void SetIP(const uint8_t ip[4]) { RTPIPv4Address::ip = (uint32_t)ip[3]; RTPIPv4Address::ip |= (((uint32_t)ip[2])<<8); RTPIPv4Address::ip |= (((uint32_t)ip[1])<<16); RTPIPv4Address::ip |= (((uint32_t)ip[0])<<24); } + + /** Sets the port number for this instance to \c port which is interpreted in host byte order. */ + void SetPort(uint16_t port) { RTPIPv4Address::port = port; } + + /** Returns the IP address contained in this instance in host byte order. */ + uint32_t GetIP() const { return ip; } + + /** Returns the port number of this instance in host byte order. */ + uint16_t GetPort() const { return port; } + + /** For outgoing packets, this indicates to which port RTCP packets will be sent (can, + * be the same port as the RTP packets in case RTCP multiplexing is used). */ + uint16_t GetRTCPSendPort() const { return rtcpsendport; } + + RTPAddress *CreateCopy(RTPMemoryManager *mgr) const; + + // Note that these functions are only used for received packets, and for those + // the rtcpsendport variable is not important and should be ignored. + bool IsSameAddress(const RTPAddress *addr) const; + bool IsFromSameHost(const RTPAddress *addr) const; +#ifdef RTPDEBUG + std::string GetAddressString() const; +#endif // RTPDEBUG +private: + uint32_t ip; + uint16_t port; + uint16_t rtcpsendport; +}; + +} // end namespace + +#endif // RTPIPV4ADDRESS_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpipv4destination.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpipv4destination.h new file mode 100644 index 0000000..1379d15 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpipv4destination.h @@ -0,0 +1,118 @@ +/* + + 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 rtpipv4destination.h + */ + +#ifndef RTPIPV4DESTINATION_H + +#define RTPIPV4DESTINATION_H + +#include "rtpconfig.h" +#include "rtptypes.h" +#include "rtpipv4address.h" +#ifndef RTP_SOCKETTYPE_WINSOCK + #include + #include + #include +#endif // RTP_SOCKETTYPE_WINSOCK +#include +#include + +namespace jrtplib +{ + +class JRTPLIB_IMPORTEXPORT RTPIPv4Destination +{ +public: + RTPIPv4Destination() + { + ip = 0; + memset(&rtpaddr,0,sizeof(struct sockaddr_in)); + memset(&rtcpaddr,0,sizeof(struct sockaddr_in)); + } + + RTPIPv4Destination(uint32_t ip,uint16_t rtpport,uint16_t rtcpport) + { + memset(&rtpaddr,0,sizeof(struct sockaddr_in)); + memset(&rtcpaddr,0,sizeof(struct sockaddr_in)); + + rtpaddr.sin_family = AF_INET; + rtpaddr.sin_port = htons(rtpport); + rtpaddr.sin_addr.s_addr = htonl(ip); + + rtcpaddr.sin_family = AF_INET; + rtcpaddr.sin_port = htons(rtcpport); + rtcpaddr.sin_addr.s_addr = htonl(ip); + + RTPIPv4Destination::ip = ip; + } + + bool operator==(const RTPIPv4Destination &src) const + { + if (rtpaddr.sin_addr.s_addr == src.rtpaddr.sin_addr.s_addr && rtpaddr.sin_port == src.rtpaddr.sin_port) + return true; + return false; + } + uint32_t GetIP() const { return ip; } + // nbo = network byte order + uint32_t GetIP_NBO() const { return rtpaddr.sin_addr.s_addr; } + uint16_t GetRTPPort_NBO() const { return rtpaddr.sin_port; } + uint16_t GetRTCPPort_NBO() const { return rtcpaddr.sin_port; } + const struct sockaddr_in *GetRTPSockAddr() const { return &rtpaddr; } + const struct sockaddr_in *GetRTCPSockAddr() const { return &rtcpaddr; } + std::string GetDestinationString() const; + + static bool AddressToDestination(const RTPAddress &addr, RTPIPv4Destination &dest) + { + if (addr.GetAddressType() != RTPAddress::IPv4Address) + return false; + + const RTPIPv4Address &address = (const RTPIPv4Address &)addr; + uint16_t rtpport = address.GetPort(); + uint16_t rtcpport = address.GetRTCPSendPort(); + + dest = RTPIPv4Destination(address.GetIP(),rtpport,rtcpport); + return true; + } + +private: + uint32_t ip; + struct sockaddr_in rtpaddr; + struct sockaddr_in rtcpaddr; +}; + +} // end namespace + +#endif // RTPIPV4DESTINATION_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpipv6address.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpipv6address.h new file mode 100644 index 0000000..e271e23 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpipv6address.h @@ -0,0 +1,110 @@ +/* + + 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 +#endif // RTP_SUPPORT_NETINET_IN + +namespace jrtplib +{ + +/** 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; +#ifdef RTPDEBUG + std::string GetAddressString() const; +#endif // RTPDEBUG +private: + in6_addr ip; + uint16_t port; +}; + +} // end namespace + +#endif // RTP_SUPPORT_IPV6 + +#endif // RTPIPV6ADDRESS_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpipv6destination.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpipv6destination.h new file mode 100644 index 0000000..f89170a --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpipv6destination.h @@ -0,0 +1,91 @@ +/* + + 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 +#include +#ifndef RTP_SOCKETTYPE_WINSOCK + #include + #include + #include +#endif // RTP_SOCKETTYPE_WINSOCK + +namespace jrtplib +{ + +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 + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpkeyhashtable.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpkeyhashtable.h new file mode 100644 index 0000000..e28be70 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpkeyhashtable.h @@ -0,0 +1,347 @@ +/* + + 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 rtpkeyhashtable.h + */ + +#ifndef RTPKEYHASHTABLE_H + +#define RTPKEYHASHTABLE_H + +#include "rtpconfig.h" +#include "rtperrors.h" +#include "rtpmemoryobject.h" + +#ifdef RTPDEBUG +#include +#endif // RTPDEBUG + +namespace jrtplib +{ + +template +class RTPKeyHashTable : public RTPMemoryObject +{ + JRTPLIB_NO_COPY(RTPKeyHashTable) +public: + RTPKeyHashTable(RTPMemoryManager *mgr = 0,int memtype = RTPMEM_TYPE_OTHER); + ~RTPKeyHashTable() { Clear(); } + + void GotoFirstElement() { curhashelem = firsthashelem; } + void GotoLastElement() { curhashelem = lasthashelem; } + bool HasCurrentElement() { return (curhashelem == 0)?false:true; } + int DeleteCurrentElement(); + Element &GetCurrentElement() { return curhashelem->GetElement(); } + Key &GetCurrentKey() { return curhashelem->GetKey(); } + int GotoElement(const Key &k); + bool HasElement(const Key &k); + void GotoNextElement(); + void GotoPreviousElement(); + void Clear(); + + int AddElement(const Key &k,const Element &elem); + int DeleteElement(const Key &k); + +#ifdef RTPDEBUG + void Dump(); +#endif // RTPDEBUG +private: + class HashElement + { + public: + HashElement(const Key &k,const Element &e,int index):key(k),element(e) { hashprev = 0; hashnext = 0; listnext = 0; listprev = 0; hashindex = index; } + int GetHashIndex() { return hashindex; } + Key &GetKey() { return key; } + Element &GetElement() { return element; } +#ifdef RTPDEBUG + void Dump() { std::cout << "\tHash index " << hashindex << " | Key " << key << " | Element " << element << std::endl; } +#endif // RTPDEBUG + private: + int hashindex; + Key key; + Element element; + public: + HashElement *hashprev,*hashnext; + HashElement *listprev,*listnext; + }; + + HashElement *table[hashsize]; + HashElement *firsthashelem,*lasthashelem; + HashElement *curhashelem; +#ifdef RTP_SUPPORT_MEMORYMANAGEMENT + int memorytype; +#endif // RTP_SUPPORT_MEMORYMANAGEMENT +}; + +template +inline RTPKeyHashTable::RTPKeyHashTable(RTPMemoryManager *mgr,int memtype) : RTPMemoryObject(mgr) +{ + JRTPLIB_UNUSED(memtype); // possibly unused + + for (int i = 0 ; i < hashsize ; i++) + table[i] = 0; + firsthashelem = 0; + lasthashelem = 0; +#ifdef RTP_SUPPORT_MEMORYMANAGEMENT + memorytype = memtype; +#endif // RTP_SUPPORT_MEMORYMANAGEMENT +} + +template +inline int RTPKeyHashTable::DeleteCurrentElement() +{ + if (curhashelem) + { + HashElement *tmp1,*tmp2; + int index; + + // First, relink elements in current hash bucket + + index = curhashelem->GetHashIndex(); + tmp1 = curhashelem->hashprev; + tmp2 = curhashelem->hashnext; + if (tmp1 == 0) // no previous element in hash bucket + { + table[index] = tmp2; + if (tmp2 != 0) + tmp2->hashprev = 0; + } + else // there is a previous element in the hash bucket + { + tmp1->hashnext = tmp2; + if (tmp2 != 0) + tmp2->hashprev = tmp1; + } + + // Relink elements in list + + tmp1 = curhashelem->listprev; + tmp2 = curhashelem->listnext; + if (tmp1 == 0) // curhashelem is first in list + { + firsthashelem = tmp2; + if (tmp2 != 0) + tmp2->listprev = 0; + else // curhashelem is also last in list + lasthashelem = 0; + } + else + { + tmp1->listnext = tmp2; + if (tmp2 != 0) + tmp2->listprev = tmp1; + else // curhashelem is last in list + lasthashelem = tmp1; + } + + // finally, with everything being relinked, we can delete curhashelem + RTPDelete(curhashelem,GetMemoryManager()); + curhashelem = tmp2; // Set to next element in list + } + else + return ERR_RTP_KEYHASHTABLE_NOCURRENTELEMENT; + return 0; +} + +template +inline int RTPKeyHashTable::GotoElement(const Key &k) +{ + int index; + bool found; + + index = GetIndex::GetIndex(k); + if (index >= hashsize) + return ERR_RTP_KEYHASHTABLE_FUNCTIONRETURNEDINVALIDHASHINDEX; + + curhashelem = table[index]; + found = false; + while(!found && curhashelem != 0) + { + if (curhashelem->GetKey() == k) + found = true; + else + curhashelem = curhashelem->hashnext; + } + if (!found) + return ERR_RTP_KEYHASHTABLE_KEYNOTFOUND; + return 0; +} + +template +inline bool RTPKeyHashTable::HasElement(const Key &k) +{ + int index; + bool found; + HashElement *tmp; + + index = GetIndex::GetIndex(k); + if (index >= hashsize) + return false; + + tmp = table[index]; + found = false; + while(!found && tmp != 0) + { + if (tmp->GetKey() == k) + found = true; + else + tmp = tmp->hashnext; + } + return found; +} + +template +inline void RTPKeyHashTable::GotoNextElement() +{ + if (curhashelem) + curhashelem = curhashelem->listnext; +} + +template +inline void RTPKeyHashTable::GotoPreviousElement() +{ + if (curhashelem) + curhashelem = curhashelem->listprev; +} + +template +inline void RTPKeyHashTable::Clear() +{ + HashElement *tmp1,*tmp2; + + for (int i = 0 ; i < hashsize ; i++) + table[i] = 0; + + tmp1 = firsthashelem; + while (tmp1 != 0) + { + tmp2 = tmp1->listnext; + RTPDelete(tmp1,GetMemoryManager()); + tmp1 = tmp2; + } + firsthashelem = 0; + lasthashelem = 0; +} + +template +inline int RTPKeyHashTable::AddElement(const Key &k,const Element &elem) +{ + int index; + bool found; + HashElement *e,*newelem; + + index = GetIndex::GetIndex(k); + if (index >= hashsize) + return ERR_RTP_KEYHASHTABLE_FUNCTIONRETURNEDINVALIDHASHINDEX; + + e = table[index]; + found = false; + while(!found && e != 0) + { + if (e->GetKey() == k) + found = true; + else + e = e->hashnext; + } + if (found) + return ERR_RTP_KEYHASHTABLE_KEYALREADYEXISTS; + + // Okay, the key doesn't exist, so we can add the new element in the hash table + + newelem = RTPNew(GetMemoryManager(),memorytype) HashElement(k,elem,index); + if (newelem == 0) + return ERR_RTP_OUTOFMEM; + + e = table[index]; + table[index] = newelem; + newelem->hashnext = e; + if (e != 0) + e->hashprev = newelem; + + // Now, we still got to add it to the linked list + + if (firsthashelem == 0) + { + firsthashelem = newelem; + lasthashelem = newelem; + } + else // there already are some elements in the list + { + lasthashelem->listnext = newelem; + newelem->listprev = lasthashelem; + lasthashelem = newelem; + } + return 0; +} + +template +inline int RTPKeyHashTable::DeleteElement(const Key &k) +{ + int status; + + status = GotoElement(k); + if (status < 0) + return status; + return DeleteCurrentElement(); +} + +#ifdef RTPDEBUG +template +inline void RTPKeyHashTable::Dump() +{ + HashElement *e; + + std::cout << "DUMPING TABLE CONTENTS:" << std::endl; + for (int i = 0 ; i < hashsize ; i++) + { + e = table[i]; + while (e != 0) + { + e->Dump(); + e = e->hashnext; + } + } + + std::cout << "DUMPING LIST CONTENTS:" << std::endl; + e = firsthashelem; + while (e != 0) + { + e->Dump(); + e = e->listnext; + } +} +#endif // RTPDEBUG + +} // end namespace + +#endif // RTPKEYHASHTABLE_H diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtplibraryversion.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtplibraryversion.h new file mode 100644 index 0000000..d65a754 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtplibraryversion.h @@ -0,0 +1,77 @@ +/* + + 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 rtplibraryversion.h + */ + +#ifndef RTPLIBRARYVERSION_H + +#define RTPLIBRARYVERSION_H + +#include "rtpconfig.h" +#include +#include + +namespace jrtplib +{ + +/** + * Used to provide information about the version of the library. + */ +class JRTPLIB_IMPORTEXPORT RTPLibraryVersion +{ +public: + /** Returns an instance of RTPLibraryVersion describing the version of the library. */ + static RTPLibraryVersion GetVersion(); +private: + RTPLibraryVersion(int major,int minor,int debug) { majornr = major; minornr = minor; debugnr = debug; } +public: + /** Returns the major version number. */ + int GetMajorNumber() const { return majornr; } + + /** Returns the minor version number. */ + int GetMinorNumber() const { return minornr; } + + /** Returns the debug version number. */ + int GetDebugNumber() const { return debugnr; } + + /** Returns a string describing the library version. */ + std::string GetVersionString() const; +private: + int debugnr,minornr,majornr; +}; + +} // end namespace + +#endif // RTPLIBRARYVERSION_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpmemorymanager.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpmemorymanager.h new file mode 100644 index 0000000..73c5883 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpmemorymanager.h @@ -0,0 +1,245 @@ +/* + + 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 rtpmemorymanager.h + */ + +#ifndef RTPMEMORYMANAGER_H + +#define RTPMEMORYMANAGER_H + +#include "rtpconfig.h" +#include "rtptypes.h" + +/** Used to indicate a general kind of memory block. */ +#define RTPMEM_TYPE_OTHER 0 + +/** Buffer to store an incoming RTP packet. */ +#define RTPMEM_TYPE_BUFFER_RECEIVEDRTPPACKET 1 + +/** Buffer to store an incoming RTCP packet. */ +#define RTPMEM_TYPE_BUFFER_RECEIVEDRTCPPACKET 2 + +/** Buffer to store an RTCP APP packet. */ +#define RTPMEM_TYPE_BUFFER_RTCPAPPPACKET 3 + +/** Buffer to store an RTCP BYE packet. */ +#define RTPMEM_TYPE_BUFFER_RTCPBYEPACKET 4 + +/** Buffer to store a BYE reason. */ +#define RTPMEM_TYPE_BUFFER_RTCPBYEREASON 5 + +/** Buffer to store an RTCP compound packet. */ +#define RTPMEM_TYPE_BUFFER_RTCPCOMPOUNDPACKET 6 + +/** Buffer to store an SDES block. */ +#define RTPMEM_TYPE_BUFFER_RTCPSDESBLOCK 7 + +/** Buffer to store an RTP packet. */ +#define RTPMEM_TYPE_BUFFER_RTPPACKET 8 + +/** Buffer used by an RTPPacketBuilder instance. */ +#define RTPMEM_TYPE_BUFFER_RTPPACKETBUILDERBUFFER 9 + +/** Buffer to store an SDES item. */ +#define RTPMEM_TYPE_BUFFER_SDESITEM 10 + +/** Hash element used in the accept/ignore table. */ +#define RTPMEM_TYPE_CLASS_ACCEPTIGNOREHASHELEMENT 11 + +/** Buffer to store a PortInfo instance, used by the UDP over IPv4 and IPv6 transmitters. */ +#define RTPMEM_TYPE_CLASS_ACCEPTIGNOREPORTINFO 12 + +/** Buffer to store a HashElement instance for the destination hash table. */ +#define RTPMEM_TYPE_CLASS_DESTINATIONLISTHASHELEMENT 13 + +/** Buffer to store a HashElement instance for the multicast hash table. */ +#define RTPMEM_TYPE_CLASS_MULTICASTHASHELEMENT 14 + +/** Buffer to store an instance of RTCPAPPPacket. */ +#define RTPMEM_TYPE_CLASS_RTCPAPPPACKET 15 + +/** Buffer to store an instance of RTCPBYEPacket. */ +#define RTPMEM_TYPE_CLASS_RTCPBYEPACKET 16 + +/** Buffer to store an instance of RTCPCompoundPacketBuilder. */ +#define RTPMEM_TYPE_CLASS_RTCPCOMPOUNDPACKETBUILDER 17 + +/** Buffer to store an RTCPReceiverReport instance. */ +#define RTPMEM_TYPE_CLASS_RTCPRECEIVERREPORT 18 + +/** Buffer to store an instance of RTCPRRPacket. */ +#define RTPMEM_TYPE_CLASS_RTCPRRPACKET 19 + +/** Buffer to store an instance of RTCPSDESPacket. */ +#define RTPMEM_TYPE_CLASS_RTCPSDESPACKET 20 + +/** Buffer to store an instance of RTCPSRPacket. */ +#define RTPMEM_TYPE_CLASS_RTCPSRPACKET 21 + +/** Buffer to store an instance of RTCPUnknownPacket. */ +#define RTPMEM_TYPE_CLASS_RTCPUNKNOWNPACKET 22 + +/** Buffer to store an instance of an RTPAddress derived class. */ +#define RTPMEM_TYPE_CLASS_RTPADDRESS 23 + +/** Buffer to store an instance of RTPInternalSourceData. */ +#define RTPMEM_TYPE_CLASS_RTPINTERNALSOURCEDATA 24 + +/** Buffer to store an RTPPacket instance. */ +#define RTPMEM_TYPE_CLASS_RTPPACKET 25 + +/** Buffer to store an RTPPollThread instance. */ +#define RTPMEM_TYPE_CLASS_RTPPOLLTHREAD 26 + +/** Buffer to store an RTPRawPacket instance. */ +#define RTPMEM_TYPE_CLASS_RTPRAWPACKET 27 + +/** Buffer to store an RTPTransmissionInfo derived class. */ +#define RTPMEM_TYPE_CLASS_RTPTRANSMISSIONINFO 28 + +/** Buffer to store an RTPTransmitter derived class. */ +#define RTPMEM_TYPE_CLASS_RTPTRANSMITTER 29 + +/** Buffer to store an SDESPrivateItem instance. */ +#define RTPMEM_TYPE_CLASS_SDESPRIVATEITEM 30 + +/** Buffer to store an SDESSource instance. */ +#define RTPMEM_TYPE_CLASS_SDESSOURCE 31 + +/** Buffer to store a HashElement instance for the source table. */ +#define RTPMEM_TYPE_CLASS_SOURCETABLEHASHELEMENT 32 + +/** Buffer that's used when encrypting a packet. */ +#define RTPMEM_TYPE_BUFFER_SRTPDATA 33 + +namespace jrtplib +{ + +/** A memory manager. */ +class JRTPLIB_IMPORTEXPORT RTPMemoryManager +{ +public: + RTPMemoryManager() { } + virtual ~RTPMemoryManager() { } + + /** Called to allocate \c numbytes of memory. + * Called to allocate \c numbytes of memory. The \c memtype parameter + * indicates what the purpose of the memory block is. Relevant values + * can be found in rtpmemorymanager.h . Note that the types starting with + * \c RTPMEM_TYPE_CLASS indicate fixed size buffers and that types starting + * with \c RTPMEM_TYPE_BUFFER indicate variable size buffers. + */ + virtual void *AllocateBuffer(size_t numbytes, int memtype) = 0; + + /** Frees the previously allocated memory block \c buffer */ + virtual void FreeBuffer(void *buffer) = 0; +}; + +} // end namespace + +#ifdef RTP_SUPPORT_MEMORYMANAGEMENT + +#include + +inline void *operator new(size_t numbytes, jrtplib::RTPMemoryManager *mgr, int memtype) +{ + if (mgr == 0) + return operator new(numbytes); + return mgr->AllocateBuffer(numbytes,memtype); +} + +inline void operator delete(void *buffer, jrtplib::RTPMemoryManager *mgr, int memtype) +{ + JRTPLIB_UNUSED(memtype); + if (mgr == 0) + operator delete(buffer); + else + mgr->FreeBuffer(buffer); +} + +#ifdef RTP_HAVE_ARRAYALLOC +inline void *operator new[](size_t numbytes, jrtplib::RTPMemoryManager *mgr, int memtype) +{ + if (mgr == 0) + return operator new[](numbytes); + return mgr->AllocateBuffer(numbytes,memtype); +} + +inline void operator delete[](void *buffer, jrtplib::RTPMemoryManager *mgr, int memtype) +{ + JRTPLIB_UNUSED(memtype); + if (mgr == 0) + operator delete[](buffer); + else + mgr->FreeBuffer(buffer); +} +#endif // RTP_HAVE_ARRAYALLOC + +namespace jrtplib +{ + +inline void RTPDeleteByteArray(uint8_t *buf, RTPMemoryManager *mgr) +{ + if (mgr == 0) + delete [] buf; + else + mgr->FreeBuffer(buf); +} + +template +inline void RTPDelete(ClassName *obj, RTPMemoryManager *mgr) +{ + if (mgr == 0) + delete obj; + else + { + obj->~ClassName(); + mgr->FreeBuffer(obj); + } +} + +} // end namespace + +#define RTPNew(a,b) new(a,b) + +#else + +#define RTPNew(a,b) new +#define RTPDelete(a,b) delete a +#define RTPDeleteByteArray(a,b) delete [] a; + +#endif // RTP_SUPPORT_MEMORYMANAGEMENT + +#endif // RTPMEMORYMANAGER_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpmemoryobject.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpmemoryobject.h new file mode 100644 index 0000000..2452bea --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpmemoryobject.h @@ -0,0 +1,74 @@ +/* + + 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 rtpmemoryobject.h + */ + +#ifndef RTPMEMORYOBJECT_H + +#define RTPMEMORYOBJECT_H + +#include "rtpconfig.h" +#include "rtpmemorymanager.h" + +namespace jrtplib +{ + +class JRTPLIB_IMPORTEXPORT RTPMemoryObject +{ +protected: +#ifdef RTP_SUPPORT_MEMORYMANAGEMENT + RTPMemoryObject(RTPMemoryManager *memmgr) : mgr(memmgr) { } +#else + RTPMemoryObject(RTPMemoryManager *memmgr) { JRTPLIB_UNUSED(memmgr); } +#endif // RTP_SUPPORT_MEMORYMANAGEMENT + virtual ~RTPMemoryObject() { } + +#ifdef RTP_SUPPORT_MEMORYMANAGEMENT + RTPMemoryManager *GetMemoryManager() const { return mgr; } + void SetMemoryManager(RTPMemoryManager *m) { mgr = m; } +#else + RTPMemoryManager *GetMemoryManager() const { return 0; } + void SetMemoryManager(RTPMemoryManager *m) { JRTPLIB_UNUSED(m); } +#endif // RTP_SUPPORT_MEMORYMANAGEMENT + +#ifdef RTP_SUPPORT_MEMORYMANAGEMENT +private: + RTPMemoryManager *mgr; +#endif // RTP_SUPPORT_MEMORYMANAGEMENT +}; + +} // end namespace + +#endif // RTPMEMORYOBJECT_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtppacket.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtppacket.h new file mode 100644 index 0000000..6811ad8 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtppacket.h @@ -0,0 +1,184 @@ +/* + + 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 rtppacket.h + */ + +#ifndef RTPPACKET_H + +#define RTPPACKET_H + +#include "rtpconfig.h" +#include "rtptypes.h" +#include "rtptimeutilities.h" +#include "rtpmemoryobject.h" + +namespace jrtplib +{ + +class RTPRawPacket; + +/** Represents an RTP Packet. + * The RTPPacket class can be used to parse a RTPRawPacket instance if it represents RTP data. + * The class can also be used to create a new RTP packet according to the parameters specified by + * the user. + */ +class JRTPLIB_IMPORTEXPORT RTPPacket : public RTPMemoryObject +{ + JRTPLIB_NO_COPY(RTPPacket) +public: + /** Creates an RTPPacket instance based upon the data in \c rawpack, optionally installing a memory manager. + * Creates an RTPPacket instance based upon the data in \c rawpack, optionally installing a memory manager. + * If successful, the data is moved from the raw packet to the RTPPacket instance. + */ + RTPPacket(RTPRawPacket &rawpack,RTPMemoryManager *mgr = 0); + + /** Creates a new buffer for an RTP packet and fills in the fields according to the specified parameters. + * Creates a new buffer for an RTP packet and fills in the fields according to the specified parameters. + * If \c maxpacksize is not equal to zero, an error is generated if the total packet size would exceed + * \c maxpacksize. The arguments of the constructor are self-explanatory. Note that the size of a header + * extension is specified in a number of 32-bit words. A memory manager can be installed. + */ + RTPPacket(uint8_t payloadtype,const void *payloaddata,size_t payloadlen,uint16_t seqnr, + uint32_t timestamp,uint32_t ssrc,bool gotmarker,uint8_t numcsrcs,const uint32_t *csrcs, + bool gotextension,uint16_t extensionid,uint16_t extensionlen_numwords,const void *extensiondata, + size_t maxpacksize, RTPMemoryManager *mgr = 0); + + /** This constructor is similar to the other constructor, but here data is stored in an external buffer + * \c buffer with size \c buffersize. */ + RTPPacket(uint8_t payloadtype,const void *payloaddata,size_t payloadlen,uint16_t seqnr, + uint32_t timestamp,uint32_t ssrc,bool gotmarker,uint8_t numcsrcs,const uint32_t *csrcs, + bool gotextension,uint16_t extensionid,uint16_t extensionlen_numwords,const void *extensiondata, + void *buffer,size_t buffersize,RTPMemoryManager *mgr = 0); + + virtual ~RTPPacket() { if (packet && !externalbuffer) RTPDeleteByteArray(packet,GetMemoryManager()); } + + /** If an error occurred in one of the constructors, this function returns the error code. */ + int GetCreationError() const { return error; } + + /** Returns \c true if the RTP packet has a header extension and \c false otherwise. */ + bool HasExtension() const { return hasextension; } + + /** Returns \c true if the marker bit was set and \c false otherwise. */ + bool HasMarker() const { return hasmarker; } + + /** Returns the number of CSRCs contained in this packet. */ + int GetCSRCCount() const { return numcsrcs; } + + /** Returns a specific CSRC identifier. + * Returns a specific CSRC identifier. The parameter \c num can go from 0 to GetCSRCCount()-1. + */ + uint32_t GetCSRC(int num) const; + + /** Returns the payload type of the packet. */ + uint8_t GetPayloadType() const { return payloadtype; } + + /** Returns the extended sequence number of the packet. + * Returns the extended sequence number of the packet. When the packet is just received, + * only the low $16$ bits will be set. The high 16 bits can be filled in later. + */ + uint32_t GetExtendedSequenceNumber() const { return extseqnr; } + + /** Returns the sequence number of this packet. */ + uint16_t GetSequenceNumber() const { return (uint16_t)(extseqnr&0x0000FFFF); } + + /** Sets the extended sequence number of this packet to \c seq. */ + void SetExtendedSequenceNumber(uint32_t seq) { extseqnr = seq; } + + /** Returns the timestamp of this packet. */ + uint32_t GetTimestamp() const { return timestamp; } + + /** Returns the SSRC identifier stored in this packet. */ + uint32_t GetSSRC() const { return ssrc; } + + /** Returns a pointer to the data of the entire packet. */ + uint8_t *GetPacketData() const { return packet; } + + /** Returns a pointer to the actual payload data. */ + uint8_t *GetPayloadData() const { return payload; } + + /** Returns the length of the entire packet. */ + size_t GetPacketLength() const { return packetlength; } + + /** Returns the payload length. */ + size_t GetPayloadLength() const { return payloadlength; } + + /** If a header extension is present, this function returns the extension identifier. */ + uint16_t GetExtensionID() const { return extid; } + + /** Returns the length of the header extension data. */ + uint8_t *GetExtensionData() const { return extension; } + + /** Returns the length of the header extension data. */ + size_t GetExtensionLength() const { return extensionlength; } +#ifdef RTPDEBUG + void Dump(); +#endif // RTPDEBUG + + /** Returns the time at which this packet was received. + * When an RTPPacket instance is created from an RTPRawPacket instance, the raw packet's + * reception time is stored in the RTPPacket instance. This function then retrieves that + * time. + */ + RTPTime GetReceiveTime() const { return receivetime; } +private: + void Clear(); + int ParseRawPacket(RTPRawPacket &rawpack); + int BuildPacket(uint8_t payloadtype,const void *payloaddata,size_t payloadlen,uint16_t seqnr, + uint32_t timestamp,uint32_t ssrc,bool gotmarker,uint8_t numcsrcs,const uint32_t *csrcs, + bool gotextension,uint16_t extensionid,uint16_t extensionlen_numwords,const void *extensiondata, + void *buffer,size_t maxsize); + + int error; + + bool hasextension,hasmarker; + int numcsrcs; + + uint8_t payloadtype; + uint32_t extseqnr,timestamp,ssrc; + uint8_t *packet,*payload; + size_t packetlength,payloadlength; + + uint16_t extid; + uint8_t *extension; + size_t extensionlength; + + bool externalbuffer; + + RTPTime receivetime; +}; + +} // end namespace + +#endif // RTPPACKET_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtppacketbuilder.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtppacketbuilder.h new file mode 100644 index 0000000..23a2041 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtppacketbuilder.h @@ -0,0 +1,275 @@ +/* + + 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 rtppacketbuilder.h + */ + +#ifndef RTPPACKETBUILDER_H + +#define RTPPACKETBUILDER_H + +#include "rtpconfig.h" +#include "rtperrors.h" +#include "rtpdefines.h" +#include "rtprandom.h" +#include "rtptimeutilities.h" +#include "rtptypes.h" +#include "rtpmemoryobject.h" + +namespace jrtplib +{ + +class RTPSources; + +/** This class can be used to build RTP packets and is a bit more high-level than the RTPPacket + * class: it generates an SSRC identifier, keeps track of timestamp and sequence number etc. + */ +class JRTPLIB_IMPORTEXPORT RTPPacketBuilder : public RTPMemoryObject +{ + JRTPLIB_NO_COPY(RTPPacketBuilder) +public: + /** Constructs an instance which will use \c rtprand for generating random numbers + * (used to initialize the SSRC value and sequence number), optionally installing a memory manager. + **/ + RTPPacketBuilder(RTPRandom &rtprand, RTPMemoryManager *mgr = 0); + ~RTPPacketBuilder(); + + /** Initializes the builder to only allow packets with a size below \c maxpacksize. */ + int Init(size_t maxpacksize); + + /** Cleans up the builder. */ + void Destroy(); + + /** Returns the number of packets which have been created with the current SSRC identifier. */ + uint32_t GetPacketCount() { if (!init) return 0; return numpackets; } + + /** Returns the number of payload octets which have been generated with this SSRC identifier. */ + uint32_t GetPayloadOctetCount() { if (!init) return 0; return numpayloadbytes; } + + /** Sets the maximum allowed packet size to \c maxpacksize. */ + int SetMaximumPacketSize(size_t maxpacksize); + + /** Adds a CSRC to the CSRC list which will be stored in the RTP packets. */ + int AddCSRC(uint32_t csrc); + + /** Deletes a CSRC from the list which will be stored in the RTP packets. */ + int DeleteCSRC(uint32_t csrc); + + /** Clears the CSRC list. */ + void ClearCSRCList(); + + /** Builds a packet with payload \c data and payload length \c len. + * Builds a packet with payload \c data and payload length \c len. The payload type, marker + * and timestamp increment used will be those that have been set using the \c SetDefault + * functions below. + */ + int BuildPacket(const void *data,size_t len); + + /** Builds a packet with payload \c data and payload length \c len. + * Builds a packet with payload \c data and payload length \c len. The payload type will be + * set to \c pt, the marker bit to \c mark and after building this packet, the timestamp will + * be incremented with \c timestamp. + */ + int BuildPacket(const void *data,size_t len, + uint8_t pt,bool mark,uint32_t timestampinc); + + /** Builds a packet with payload \c data and payload length \c len. + * Builds a packet with payload \c data and payload length \c len. The payload type, marker + * and timestamp increment used will be those that have been set using the \c SetDefault + * functions below. This packet will also contain an RTP header extension with identifier + * \c hdrextID and data \c hdrextdata. The length of the header extension data is given by + * \c numhdrextwords which expresses the length in a number of 32-bit words. + */ + int BuildPacketEx(const void *data,size_t len, + uint16_t hdrextID,const void *hdrextdata,size_t numhdrextwords); + + /** Builds a packet with payload \c data and payload length \c len. + * Builds a packet with payload \c data and payload length \c len. The payload type will be set + * to \c pt, the marker bit to \c mark and after building this packet, the timestamp will + * be incremented with \c timestamp. This packet will also contain an RTP header extension + * with identifier \c hdrextID and data \c hdrextdata. The length of the header extension + * data is given by \c numhdrextwords which expresses the length in a number of 32-bit words. + */ + int BuildPacketEx(const void *data,size_t len, + uint8_t pt,bool mark,uint32_t timestampinc, + uint16_t hdrextID,const void *hdrextdata,size_t numhdrextwords); + + /** Returns a pointer to the last built RTP packet data. */ + uint8_t *GetPacket() { if (!init) return 0; return buffer; } + + /** Returns the size of the last built RTP packet. */ + size_t GetPacketLength() { if (!init) return 0; return packetlength; } + + /** Sets the default payload type to \c pt. */ + int SetDefaultPayloadType(uint8_t pt); + + /** Sets the default marker bit to \c m. */ + int SetDefaultMark(bool m); + + /** Sets the default timestamp increment to \c timestampinc. */ + int SetDefaultTimestampIncrement(uint32_t timestampinc); + + /** This function increments the timestamp with the amount given by \c inc. + * This function increments the timestamp with the amount given by \c inc. This can be useful + * if, for example, a packet was not sent because it contained only silence. Then, this function + * should be called to increment the timestamp with the appropriate amount so that the next packets + * will still be played at the correct time at other hosts. + */ + int IncrementTimestamp(uint32_t inc); + + /** This function increments the timestamp with the amount given set by the SetDefaultTimestampIncrement + * member function. + * This function increments the timestamp with the amount given set by the SetDefaultTimestampIncrement + * member function. This can be useful if, for example, a packet was not sent because it contained only silence. + * Then, this function should be called to increment the timestamp with the appropriate amount so that the next + * packets will still be played at the correct time at other hosts. + */ + int IncrementTimestampDefault(); + + /** Creates a new SSRC to be used in generated packets. + * Creates a new SSRC to be used in generated packets. This will also generate new timestamp and + * sequence number offsets. + */ + uint32_t CreateNewSSRC(); + + /** Creates a new SSRC to be used in generated packets. + * Creates a new SSRC to be used in generated packets. This will also generate new timestamp and + * sequence number offsets. The source table \c sources is used to make sure that the chosen SSRC + * isn't used by another participant yet. + */ + uint32_t CreateNewSSRC(RTPSources &sources); + + /** Returns the current SSRC identifier. */ + uint32_t GetSSRC() const { if (!init) return 0; return ssrc; } + + /** Returns the current RTP timestamp. */ + uint32_t GetTimestamp() const { if (!init) return 0; return timestamp; } + + /** Returns the current sequence number. */ + uint16_t GetSequenceNumber() const { if (!init) return 0; return seqnr; } + + /** Returns the time at which a packet was generated. + * Returns the time at which a packet was generated. This is not necessarily the time at which + * the last RTP packet was generated: if the timestamp increment was zero, the time is not updated. + */ + RTPTime GetPacketTime() const { if (!init) return RTPTime(0,0); return lastwallclocktime; } + + /** Returns the RTP timestamp which corresponds to the time returned by the previous function. */ + uint32_t GetPacketTimestamp() const { if (!init) return 0; return lastrtptimestamp; } + + /** Sets a specific SSRC to be used. + * Sets a specific SSRC to be used. Does not create a new timestamp offset or sequence number + * offset. Does not reset the packet count or byte count. Think twice before using this! + */ + void AdjustSSRC(uint32_t s) { ssrc = s; } +private: + int PrivateBuildPacket(const void *data,size_t len, + uint8_t pt,bool mark,uint32_t timestampinc,bool gotextension, + uint16_t hdrextID = 0,const void *hdrextdata = 0,size_t numhdrextwords = 0); + + RTPRandom &rtprnd; + size_t maxpacksize; + uint8_t *buffer; + size_t packetlength; + + uint32_t numpayloadbytes; + uint32_t numpackets; + bool init; + + uint32_t ssrc; + uint32_t timestamp; + uint16_t seqnr; + + uint32_t defaulttimestampinc; + uint8_t defaultpayloadtype; + bool defaultmark; + + bool deftsset,defptset,defmarkset; + + uint32_t csrcs[RTP_MAXCSRCS]; + int numcsrcs; + + RTPTime lastwallclocktime; + uint32_t lastrtptimestamp; + uint32_t prevrtptimestamp; +}; + +inline int RTPPacketBuilder::SetDefaultPayloadType(uint8_t pt) +{ + if (!init) + return ERR_RTP_PACKBUILD_NOTINIT; + defptset = true; + defaultpayloadtype = pt; + return 0; +} + +inline int RTPPacketBuilder::SetDefaultMark(bool m) +{ + if (!init) + return ERR_RTP_PACKBUILD_NOTINIT; + defmarkset = true; + defaultmark = m; + return 0; +} + +inline int RTPPacketBuilder::SetDefaultTimestampIncrement(uint32_t timestampinc) +{ + if (!init) + return ERR_RTP_PACKBUILD_NOTINIT; + deftsset = true; + defaulttimestampinc = timestampinc; + return 0; +} + +inline int RTPPacketBuilder::IncrementTimestamp(uint32_t inc) +{ + if (!init) + return ERR_RTP_PACKBUILD_NOTINIT; + timestamp += inc; + return 0; +} + +inline int RTPPacketBuilder::IncrementTimestampDefault() +{ + if (!init) + return ERR_RTP_PACKBUILD_NOTINIT; + if (!deftsset) + return ERR_RTP_PACKBUILD_DEFAULTTSINCNOTSET; + timestamp += defaulttimestampinc; + return 0; +} + +} // end namespace + +#endif // RTPPACKETBUILDER_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtppollthread.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtppollthread.h new file mode 100644 index 0000000..91a7690 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtppollthread.h @@ -0,0 +1,80 @@ +/* + + 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 rtppollthread.h + */ + +#ifndef RTPPOLLTHREAD_H + +#define RTPPOLLTHREAD_H + +#include "rtpconfig.h" + +#ifdef RTP_SUPPORT_THREAD + +#include "rtptransmitter.h" + +#include +#include +#include + +namespace jrtplib +{ + +class RTPSession; +class RTCPScheduler; + +class JRTPLIB_IMPORTEXPORT RTPPollThread : private jthread::JThread +{ + JRTPLIB_NO_COPY(RTPPollThread) +public: + RTPPollThread(RTPSession &session,RTCPScheduler &rtcpsched); + ~RTPPollThread(); + int Start(RTPTransmitter *trans); + void Stop(); +private: + void *Thread(); + + bool stop; + jthread::JMutex stopmutex; + RTPTransmitter *transmitter; + + RTPSession &rtpsession; + RTCPScheduler &rtcpsched; +}; + +} // end namespace + +#endif // RTP_SUPPORT_THREAD + +#endif // RTPPOLLTHREAD_H diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtprandom.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtprandom.h new file mode 100644 index 0000000..237f44e --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtprandom.h @@ -0,0 +1,79 @@ +/* + + 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 rtprandom.h + */ + +#ifndef RTPRANDOM_H + +#define RTPRANDOM_H + +#include "rtpconfig.h" +#include "rtptypes.h" +#include + +#define RTPRANDOM_2POWMIN63 1.08420217248550443400745280086994171142578125e-19 + +namespace jrtplib +{ + +/** Interface for generating random numbers. */ +class JRTPLIB_IMPORTEXPORT RTPRandom +{ +public: + RTPRandom() { } + virtual ~RTPRandom() { } + + /** Returns a random eight bit value. */ + virtual uint8_t GetRandom8() = 0; + + /** Returns a random sixteen bit value. */ + virtual uint16_t GetRandom16() = 0; + + /** Returns a random thirty-two bit value. */ + virtual uint32_t GetRandom32() = 0; + + /** Returns a random number between $0.0$ and $1.0$. */ + virtual double GetRandomDouble() = 0; + + /** Can be used by subclasses to generate a seed for a random number generator. */ + uint32_t PickSeed(); + + /** Allocate a default random number generator based on your platform. */ + static RTPRandom *CreateDefaultRandomNumberGenerator(); +}; + +} // end namespace + +#endif // RTPRANDOM_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtprandomrand48.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtprandomrand48.h new file mode 100644 index 0000000..4a69626 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtprandomrand48.h @@ -0,0 +1,75 @@ +/* + + 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 rtprandomrand48.h + */ + +#ifndef RTPRANDOMRAND48_H + +#define RTPRANDOMRAND48_H + +#include "rtpconfig.h" +#include "rtprandom.h" +#ifdef RTP_SUPPORT_THREAD + #include +#endif // RTP_SUPPORT_THREAD +#include + +namespace jrtplib +{ + +/** A random number generator using the algorithm of the rand48 set of functions. */ +class JRTPLIB_IMPORTEXPORT RTPRandomRand48 : public RTPRandom +{ +public: + RTPRandomRand48(); + RTPRandomRand48(uint32_t seed); + ~RTPRandomRand48(); + + uint8_t GetRandom8(); + uint16_t GetRandom16(); + uint32_t GetRandom32(); + double GetRandomDouble(); +private: + void SetSeed(uint32_t seed); + +#ifdef RTP_SUPPORT_THREAD + jthread::JMutex mutex; +#endif // RTP_SUPPORT_THREAD + uint64_t state; +}; + +} // end namespace + +#endif // RTPRANDOMRAND48_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtprandomrands.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtprandomrands.h new file mode 100644 index 0000000..8ba76c4 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtprandomrands.h @@ -0,0 +1,70 @@ +/* + + 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 rtprandomrands.h + */ + +#ifndef RTPRANDOMRANDS_H + +#define RTPRANDOMRANDS_H + +#include "rtpconfig.h" +#include "rtprandom.h" + +namespace jrtplib +{ + +/** A random number generator which tries to use the \c rand_s function on the + * Win32 platform. + */ +class JRTPLIB_IMPORTEXPORT RTPRandomRandS : public RTPRandom +{ +public: + RTPRandomRandS(); + ~RTPRandomRandS(); + + /** Initialize the random number generator. */ + int Init(); + + uint8_t GetRandom8(); + uint16_t GetRandom16(); + uint32_t GetRandom32(); + double GetRandomDouble(); +private: + bool initialized; +}; + +} // end namespace + +#endif // RTPRANDOMRANDS_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtprandomurandom.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtprandomurandom.h new file mode 100644 index 0000000..bc11d2d --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtprandomurandom.h @@ -0,0 +1,68 @@ +/* + + 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 rtprandomurandom.h + */ + +#ifndef RTPRANDOMURANDOM_H + +#define RTPRANDOMURANDOM_H + +#include "rtpconfig.h" +#include "rtprandom.h" +#include + +namespace jrtplib +{ + +/** A random number generator which uses bytes delivered by the /dev/urandom device. */ +class JRTPLIB_IMPORTEXPORT RTPRandomURandom : public RTPRandom +{ +public: + RTPRandomURandom(); + ~RTPRandomURandom(); + + /** Initialize the random number generator. */ + int Init(); + + uint8_t GetRandom8(); + uint16_t GetRandom16(); + uint32_t GetRandom32(); + double GetRandomDouble(); +private: + FILE *device; +}; + +} // end namespace + +#endif // RTPRANDOMURANDOM_H diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtprawpacket.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtprawpacket.h new file mode 100644 index 0000000..73dd193 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtprawpacket.h @@ -0,0 +1,190 @@ +/* + + 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 rtprawpacket.h + */ + +#ifndef RTPRAWPACKET_H + +#define RTPRAWPACKET_H + +#include "rtpconfig.h" +#include "rtptimeutilities.h" +#include "rtpaddress.h" +#include "rtptypes.h" +#include "rtpmemoryobject.h" +#include "rtpstructs.h" + +namespace jrtplib +{ + +/** This class is used by the transmission component to store the incoming RTP and RTCP data in. */ +class JRTPLIB_IMPORTEXPORT RTPRawPacket : public RTPMemoryObject +{ + JRTPLIB_NO_COPY(RTPRawPacket) +public: + /** Creates an instance which stores data from \c data with length \c datalen. + * Creates an instance which stores data from \c data with length \c datalen. Only the pointer + * to the data is stored, no actual copy is made! The address from which this packet originated + * is set to \c address and the time at which the packet was received is set to \c recvtime. + * The flag which indicates whether this data is RTP or RTCP data is set to \c rtp. + * If you don't know if it's an RTP or RTCP packet, you can use the other constructor which + * tries to determine the type based on the header. A memory manager can be installed as well. + */ + RTPRawPacket(uint8_t *data,size_t datalen,RTPAddress *address,RTPTime &recvtime,bool rtp,RTPMemoryManager *mgr = 0); + + /** Creates an instance which stores data from \c data with length \c datalen. + * Creates an instance which stores data from \c data with length \c datalen. Only the pointer + * to the data is stored, no actual copy is made! The address from which this packet originated + * is set to \c address and the time at which the packet was received is set to \c recvtime. + * A memory manager can be installed as well. This is similar to the other constructor where + * you have to specify yourself if the packet is supposed to contain RTP or RTCP data. In this version, + * based on the header information the packet type will be determined. + */ + RTPRawPacket(uint8_t *data,size_t datalen,RTPAddress *address,RTPTime &recvtime,RTPMemoryManager *mgr = 0); + ~RTPRawPacket(); + + /** Returns the pointer to the data which is contained in this packet. */ + uint8_t *GetData() { return packetdata; } + + /** Returns the length of the packet described by this instance. */ + size_t GetDataLength() const { return packetdatalength; } + + /** Returns the time at which this packet was received. */ + RTPTime GetReceiveTime() const { return receivetime; } + + /** Returns the address stored in this packet. */ + const RTPAddress *GetSenderAddress() const { return senderaddress; } + + /** Returns \c true if this data is RTP data, \c false if it is RTCP data. */ + bool IsRTP() const { return isrtp; } + + /** Sets the pointer to the data stored in this packet to zero. + * Sets the pointer to the data stored in this packet to zero. This will prevent + * a \c delete call for the actual data when the destructor of RTPRawPacket is called. + * This function is used by the RTPPacket and RTCPCompoundPacket classes to obtain + * the packet data (without having to copy it) and to make sure the data isn't deleted + * when the destructor of RTPRawPacket is called. + */ + void ZeroData() { packetdata = 0; packetdatalength = 0; } + + /** Allocates a number of bytes for RTP or RTCP data using the memory manager that + * was used for this raw packet instance, can be useful if the RTPRawPacket::SetData + * function will be used. */ + uint8_t *AllocateBytes(bool isrtp, int recvlen) const; + + /** Deallocates the previously stored data and replaces it with the data that's + * specified, can be useful when e.g. decrypting data in RTPSession::OnChangeIncomingData */ + void SetData(uint8_t *data, size_t datalen); + + /** Deallocates the currently stored RTPAddress instance and replaces it + * with the one that's specified (you probably don't need this function). */ + void SetSenderAddress(RTPAddress *address); +private: + void DeleteData(); + + uint8_t *packetdata; + size_t packetdatalength; + RTPTime receivetime; + RTPAddress *senderaddress; + bool isrtp; +}; + +inline RTPRawPacket::RTPRawPacket(uint8_t *data,size_t datalen,RTPAddress *address,RTPTime &recvtime,bool rtp,RTPMemoryManager *mgr):RTPMemoryObject(mgr),receivetime(recvtime) +{ + packetdata = data; + packetdatalength = datalen; + senderaddress = address; + isrtp = rtp; +} + +inline RTPRawPacket::RTPRawPacket(uint8_t *data,size_t datalen,RTPAddress *address,RTPTime &recvtime,RTPMemoryManager *mgr):RTPMemoryObject(mgr),receivetime(recvtime) +{ + packetdata = data; + packetdatalength = datalen; + senderaddress = address; + + isrtp = true; + if (datalen >= sizeof(RTCPCommonHeader)) + { + RTCPCommonHeader *rtcpheader = (RTCPCommonHeader *)data; + uint8_t packettype = rtcpheader->packettype; + + if (packettype >= 200 && packettype <= 204) + isrtp = false; + } +} + +inline RTPRawPacket::~RTPRawPacket() +{ + DeleteData(); +} + +inline void RTPRawPacket::DeleteData() +{ + if (packetdata) + RTPDeleteByteArray(packetdata,GetMemoryManager()); + if (senderaddress) + RTPDelete(senderaddress,GetMemoryManager()); + + packetdata = 0; + senderaddress = 0; +} + +inline uint8_t *RTPRawPacket::AllocateBytes(bool isrtp, int recvlen) const +{ + JRTPLIB_UNUSED(isrtp); // possibly unused + return RTPNew(GetMemoryManager(),(isrtp)?RTPMEM_TYPE_BUFFER_RECEIVEDRTPPACKET:RTPMEM_TYPE_BUFFER_RECEIVEDRTCPPACKET) uint8_t[recvlen]; +} + +inline void RTPRawPacket::SetData(uint8_t *data, size_t datalen) +{ + if (packetdata) + RTPDeleteByteArray(packetdata,GetMemoryManager()); + + packetdata = data; + packetdatalength = datalen; +} + +inline void RTPRawPacket::SetSenderAddress(RTPAddress *address) +{ + if (senderaddress) + RTPDelete(senderaddress, GetMemoryManager()); + + senderaddress = address; +} + +} // end namespace + +#endif // RTPRAWPACKET_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpsecuresession.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpsecuresession.h new file mode 100644 index 0000000..cdbdd6f --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpsecuresession.h @@ -0,0 +1,137 @@ +/* + + 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 rtpsecuresession.h + */ + +#ifndef RTPSECURESESSION_H + +#define RTPSECURESESSION_H + +#include "rtpconfig.h" + +#if defined(RTP_SUPPORT_SRTP) || defined(RTP_SUPPORT_SRTP2) + +#include "rtpsession.h" + +#ifdef RTP_SUPPORT_THREAD + #include +#endif // RTP_SUPPORT_THREAD + +#ifdef RTP_SUPPORT_SRTP2 +struct srtp_ctx_t_; +typedef struct srtp_ctx_t_ srtp_ctx_t; +#else +struct srtp_ctx_t; +#endif + +namespace jrtplib +{ + +class RTPCrypt; + +// SRTP library needs to be initialized already! + +/** RTPSession derived class that serves as a base class for an SRTP implementation. + * + * This is an RTPSession derived class that serves as a base class for an SRTP implementation. + * The class sets the RTPSession::SetChangeIncomingData and RTPSession::SetChangeOutgoingData + * flags, and implements RTPSession::OnChangeIncomingData, RTPSession::OnChangeRTPOrRTCPData + * and RTPSession::OnSentRTPOrRTCPData so that encryption and decryption is applied to packets. + * The encryption and decryption will be done using [libsrtp](https://github.com/cisco/libsrtp), + * which must be available at compile time. + * + * Your derived class should call RTPSecureSession::InitializeSRTPContext to initialize a context + * struct of `libsrtp`. When this succeeds, the context can be obtained and used with the + * RTPSecureSession::LockSRTPContext function, which also locks a mutex if thread support was + * available. After you're done using the context yourself (to set encryption parameters for + * SSRCs), you **must** release it again using RTPSecureSession::UnlockSRTPContext. + * + * See `example7.cpp` for an example of how to use this class. + */ +class JRTPLIB_IMPORTEXPORT RTPSecureSession : public RTPSession +{ +public: + /** Constructs an RTPSecureSession instance, see RTPSession::RTPSession + * for more information about the parameters. */ + RTPSecureSession(RTPRandom *rnd = 0, RTPMemoryManager *mgr = 0); + ~RTPSecureSession(); +protected: + /** Initializes the SRTP context, in case of an error it may be useful to inspect + * RTPSecureSession::GetLastLibSRTPError. */ + int InitializeSRTPContext(); + + /** This function locks a mutex and returns the `libsrtp` context that was + * created in RTPSecureSession::InitializeSRTPContext, so that you can further + * use it to specify encryption parameters for various sources; note that you + * **must** release the context again after use with the + * RTPSecureSession::UnlockSRTPContext function. */ + srtp_ctx_t *LockSRTPContext(); + + /** Releases the lock on the SRTP context that was obtained in + * RTPSecureSession::LockSRTPContext. */ + int UnlockSRTPContext(); + + /** Returns (and clears) the last error that was encountered when using a + * `libsrtp` based function. */ + int GetLastLibSRTPError(); + + void SetLastLibSRTPError(int err); + + /** In case the reimplementation of OnChangeIncomingData (which may take place + * in a background thread) encounters an error, this member function will be + * called; implement it in a derived class to receive notification of this. */ + virtual void OnErrorChangeIncomingData(int errcode, int libsrtperrorcode); + + int OnChangeRTPOrRTCPData(const void *origdata, size_t origlen, bool isrtp, void **senddata, size_t *sendlen); + bool OnChangeIncomingData(RTPRawPacket *rawpack); + void OnSentRTPOrRTCPData(void *senddata, size_t sendlen, bool isrtp); +private: + int encryptData(uint8_t *pData, int &dataLength, bool rtp); + int decryptRawPacket(RTPRawPacket *rawpack, int *srtpError); + + srtp_ctx_t *m_pSRTPContext; + int m_lastSRTPError; +#ifdef RTP_SUPPORT_THREAD + jthread::JMutex m_srtpLock; +#endif // RTP_SUPPORT_THREAD +}; + +inline void RTPSecureSession::OnErrorChangeIncomingData(int, int) { } + +} // end namespace + +#endif // RTP_SUPPORT_SRTP || RTP_SUPPORT_SRTP2 + +#endif // RTPSECURESESSION_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpselect.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpselect.h new file mode 100644 index 0000000..bedc909 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpselect.h @@ -0,0 +1,190 @@ +/* + + 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 rtpselect.h + */ + +#ifndef RTPSELECT_H + +#define RTPSELECT_H + +#include "rtpconfig.h" +#include "rtptypes.h" +#include "rtperrors.h" +#include "rtptimeutilities.h" +#include "rtpsocketutil.h" + +#if defined(RTP_HAVE_WSAPOLL) || defined(RTP_HAVE_POLL) + +#ifndef RTP_HAVE_WSAPOLL +#include +#include +#endif // !RTP_HAVE_WSAPOLL + +#include +#include + +namespace jrtplib +{ + +inline int RTPSelect(const SocketType *sockets, int8_t *readflags, size_t numsocks, RTPTime timeout) +{ + using namespace std; + + vector fds(numsocks); + + for (size_t i = 0 ; i < numsocks ; i++) + { + fds[i].fd = sockets[i]; + fds[i].events = POLLIN; + fds[i].revents = 0; + readflags[i] = 0; + } + + int timeoutmsec = -1; + if (timeout.GetDouble() >= 0) + { + double dtimeoutmsec = timeout.GetDouble()*1000.0; + if (dtimeoutmsec > (numeric_limits::max)()) // parentheses to prevent windows 'max' macro expansion + dtimeoutmsec = (numeric_limits::max)(); + + timeoutmsec = (int)dtimeoutmsec; + } + +#ifdef RTP_HAVE_WSAPOLL + int status = WSAPoll(&(fds[0]), (ULONG)numsocks, timeoutmsec); + if (status < 0) + return ERR_RTP_SELECT_ERRORINPOLL; +#else + int status = poll(&(fds[0]), numsocks, timeoutmsec); + if (status < 0) + { + // We're just going to ignore an EINTR + if (errno == EINTR) + return 0; + return ERR_RTP_SELECT_ERRORINPOLL; + } +#endif // RTP_HAVE_WSAPOLL + + if (status > 0) + { + for (size_t i = 0 ; i < numsocks ; i++) + { + if (fds[i].revents) + readflags[i] = 1; + } + } + return status; +} + +} // end namespace + +#else + +#ifndef RTP_SOCKETTYPE_WINSOCK +#include +#include +#include +#include +#endif // !RTP_SOCKETTYPE_WINSOCK + +namespace jrtplib +{ + +/** Wrapper function around 'select', 'poll' or 'WSAPoll', depending on the + * availability on your platform. + * + * Wrapper function around 'select', 'poll' or 'WSAPoll', depending on the + * availability on your platform. The function will check the specified + * `sockets` for incoming data and sets the flags in `readflags` if so. + * A maximum time `timeout` will be waited for data to arrive, which is + * indefinitely if set to a negative value. The function returns the number + * of sockets that have data incoming. + */ +inline int RTPSelect(const SocketType *sockets, int8_t *readflags, size_t numsocks, RTPTime timeout) +{ + struct timeval tv; + struct timeval *pTv = 0; + + if (timeout.GetDouble() >= 0) + { + tv.tv_sec = (long)timeout.GetSeconds(); + tv.tv_usec = timeout.GetMicroSeconds(); + pTv = &tv; + } + + fd_set fdset; + FD_ZERO(&fdset); + for (size_t i = 0 ; i < numsocks ; i++) + { +#ifndef RTP_SOCKETTYPE_WINSOCK + const int setsize = FD_SETSIZE; + // On windows it seems that comparing the socket value to FD_SETSIZE does + // not make sense + if (sockets[i] >= setsize) + return ERR_RTP_SELECT_SOCKETDESCRIPTORTOOLARGE; +#endif // RTP_SOCKETTYPE_WINSOCK + FD_SET(sockets[i], &fdset); + readflags[i] = 0; + } + + int status = select(FD_SETSIZE, &fdset, 0, 0, pTv); +#ifdef RTP_SOCKETTYPE_WINSOCK + if (status < 0) + return ERR_RTP_SELECT_ERRORINSELECT; +#else + if (status < 0) + { + // We're just going to ignore an EINTR + if (errno == EINTR) + return 0; + return ERR_RTP_SELECT_ERRORINSELECT; + } +#endif // RTP_HAVE_WSAPOLL + + if (status > 0) // some descriptors were set, check them + { + for (size_t i = 0 ; i < numsocks ; i++) + { + if (FD_ISSET(sockets[i], &fdset)) + readflags[i] = 1; + } + } + return status; +} + +} // end namespace + +#endif // RTP_HAVE_POLL || RTP_HAVE_WSAPOLL + +#endif // RTPSELECT_H diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpsession.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpsession.h new file mode 100644 index 0000000..99e65bc --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpsession.h @@ -0,0 +1,695 @@ +/* + + 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 rtpsession.h + */ + +#ifndef RTPSESSION_H + +#define RTPSESSION_H + +#include "rtpconfig.h" +#include "rtplibraryversion.h" +#include "rtppacketbuilder.h" +#include "rtpsessionsources.h" +#include "rtptransmitter.h" +#include "rtpcollisionlist.h" +#include "rtcpscheduler.h" +#include "rtcppacketbuilder.h" +#include "rtptimeutilities.h" +#include "rtcpcompoundpacketbuilder.h" +#include "rtpmemoryobject.h" +#include + +#ifdef RTP_SUPPORT_THREAD + #include +#endif // RTP_SUPPORT_THREAD + +namespace jrtplib +{ + +class RTPTransmitter; +class RTPSessionParams; +class RTPTransmissionParams; +class RTPAddress; +class RTPSourceData; +class RTPPacket; +class RTPPollThread; +class RTPTransmissionInfo; +class RTCPCompoundPacket; +class RTCPPacket; +class RTCPAPPPacket; + +/** High level class for using RTP. + * For most RTP based applications, the RTPSession class will probably be the one to use. It handles + * the RTCP part completely internally, so the user can focus on sending and receiving the actual data. + * In case you want to use SRTP, you should create an RTPSecureSession derived class. + * \note The RTPSession class is not meant to be thread safe. The user should use some kind of locking + * mechanism to prevent different threads from using the same RTPSession instance. + */ +class JRTPLIB_IMPORTEXPORT RTPSession : public RTPMemoryObject +{ + JRTPLIB_NO_COPY(RTPSession) +public: + /** Constructs an RTPSession instance, optionally using a specific instance of a random + * number generator, and optionally installing a memory manager. + * Constructs an RTPSession instance, optionally using a specific instance of a random + * number generator, and optionally installing a memory manager. If no random number generator + * is specified, the RTPSession object will try to use either a RTPRandomURandom or + * RTPRandomRandS instance. If neither is available on the current platform, a RTPRandomRand48 + * instance will be used instead. By specifying a random number generator yourself, it is + * possible to use the same generator in several RTPSession instances. + */ + RTPSession(RTPRandom *rnd = 0, RTPMemoryManager *mgr = 0); + virtual ~RTPSession(); + + /** Creates an RTP session. + * This function creates an RTP session with parameters \c sessparams, which will use a transmitter + * corresponding to \c proto. Parameters for this transmitter can be specified as well. If \c + * proto is of type RTPTransmitter::UserDefinedProto, the NewUserDefinedTransmitter function must + * be implemented. + */ + int Create(const RTPSessionParams &sessparams,const RTPTransmissionParams *transparams = 0, RTPTransmitter::TransmissionProtocol proto = RTPTransmitter::IPv4UDPProto); + + /** Creates an RTP session using \c transmitter as transmission component. + * This function creates an RTP session with parameters \c sessparams, which will use the + * transmission component \c transmitter. Initialization and destruction of the transmitter + * will not be done by the RTPSession class if this Create function is used. This function + * can be useful if you which to reuse the transmission component in another RTPSession + * instance, once the original RTPSession isn't using the transmitter anymore. + */ + int Create(const RTPSessionParams &sessparams,RTPTransmitter *transmitter); + + /** Leaves the session without sending a BYE packet. */ + void Destroy(); + + /** Sends a BYE packet and leaves the session. + * Sends a BYE packet and leaves the session. At most a time \c maxwaittime will be waited to + * send the BYE packet. If this time expires, the session will be left without sending a BYE packet. + * The BYE packet will contain as reason for leaving \c reason with length \c reasonlength. + */ + void BYEDestroy(const RTPTime &maxwaittime,const void *reason,size_t reasonlength); + + /** Returns whether the session has been created or not. */ + bool IsActive(); + + /** Returns our own SSRC. */ + uint32_t GetLocalSSRC(); + + /** Adds \c addr to the list of destinations. */ + int AddDestination(const RTPAddress &addr); + + /** Deletes \c addr from the list of destinations. */ + int DeleteDestination(const RTPAddress &addr); + + /** Clears the list of destinations. */ + void ClearDestinations(); + + /** Returns \c true if multicasting is supported. */ + bool SupportsMulticasting(); + + /** Joins the multicast group specified by \c addr. */ + int JoinMulticastGroup(const RTPAddress &addr); + + /** Leaves the multicast group specified by \c addr. */ + int LeaveMulticastGroup(const RTPAddress &addr); + + /** Leaves all multicast groups. */ + void LeaveAllMulticastGroups(); + + /** Sends the RTP packet with payload \c data which has length \c len. + * Sends the RTP packet with payload \c data which has length \c len. + * The used payload type, marker and timestamp increment will be those that have been set + * using the \c SetDefault member functions. + */ + int SendPacket(const void *data,size_t len); + + /** Sends the RTP packet with payload \c data which has length \c len. + * It will use payload type \c pt, marker \c mark and after the packet has been built, the + * timestamp will be incremented by \c timestampinc. + */ + int SendPacket(const void *data,size_t len, + uint8_t pt,bool mark,uint32_t timestampinc); + + /** Sends the RTP packet with payload \c data which has length \c len. + * The packet will contain a header extension with identifier \c hdrextID and containing data + * \c hdrextdata. The length of this data is given by \c numhdrextwords and is specified in a + * number of 32-bit words. The used payload type, marker and timestamp increment will be those that + * have been set using the \c SetDefault member functions. + */ + int SendPacketEx(const void *data,size_t len, + uint16_t hdrextID,const void *hdrextdata,size_t numhdrextwords); + + /** Sends the RTP packet with payload \c data which has length \c len. + * It will use payload type \c pt, marker \c mark and after the packet has been built, the + * timestamp will be incremented by \c timestampinc. The packet will contain a header + * extension with identifier \c hdrextID and containing data \c hdrextdata. The length + * of this data is given by \c numhdrextwords and is specified in a number of 32-bit words. + */ + int SendPacketEx(const void *data,size_t len, + uint8_t pt,bool mark,uint32_t timestampinc, + uint16_t hdrextID,const void *hdrextdata,size_t numhdrextwords); +#ifdef RTP_SUPPORT_SENDAPP + /** If sending of RTCP APP packets was enabled at compile time, this function creates a compound packet + * containing an RTCP APP packet and sends it immediately. + * If sending of RTCP APP packets was enabled at compile time, this function creates a compound packet + * containing an RTCP APP packet and sends it immediately. If successful, the function returns the number + * of bytes in the RTCP compound packet. Note that this immediate sending is not compliant with the RTP + * specification, so use with care. + */ + int SendRTCPAPPPacket(uint8_t subtype, const uint8_t name[4], const void *appdata, size_t appdatalen); +#endif // RTP_SUPPORT_SENDAPP + +#ifdef RTP_SUPPORT_RTCPUNKNOWN + /** Tries to send an Unknown packet immediately. + * Tries to send an Unknown packet immediately. If successful, the function returns the number + * of bytes in the RTCP compound packet. Note that this immediate sending is not compliant with the RTP + * specification, so use with care. Can send message along with a receiver report or a sender report + */ + int SendUnknownPacket(bool sr, uint8_t payload_type, uint8_t subtype, const void *data, size_t len); +#endif // RTP_SUPPORT_RTCPUNKNOWN + + /** With this function raw data can be sent directly over the RTP or + * RTCP channel (if they are different); the data is **not** passed through the + * RTPSession::OnChangeRTPOrRTCPData function. */ + int SendRawData(const void *data, size_t len, bool usertpchannel); + + /** Sets the default payload type for RTP packets to \c pt. */ + int SetDefaultPayloadType(uint8_t pt); + + /** Sets the default marker for RTP packets to \c m. */ + int SetDefaultMark(bool m); + + /** Sets the default value to increment the timestamp with to \c timestampinc. */ + int SetDefaultTimestampIncrement(uint32_t timestampinc); + + /** This function increments the timestamp with the amount given by \c inc. + * This function increments the timestamp with the amount given by \c inc. This can be useful + * if, for example, a packet was not sent because it contained only silence. Then, this function + * should be called to increment the timestamp with the appropriate amount so that the next packets + * will still be played at the correct time at other hosts. + */ + int IncrementTimestamp(uint32_t inc); + + /** This function increments the timestamp with the amount given set by the SetDefaultTimestampIncrement + * member function. + * This function increments the timestamp with the amount given set by the SetDefaultTimestampIncrement + * member function. This can be useful if, for example, a packet was not sent because it contained only silence. + * Then, this function should be called to increment the timestamp with the appropriate amount so that the next + * packets will still be played at the correct time at other hosts. + */ + int IncrementTimestampDefault(); + + /** This function allows you to inform the library about the delay between sampling the first + * sample of a packet and sending the packet. + * This function allows you to inform the library about the delay between sampling the first + * sample of a packet and sending the packet. This delay is taken into account when calculating the + * relation between RTP timestamp and wallclock time, used for inter-media synchronization. + */ + int SetPreTransmissionDelay(const RTPTime &delay); + + /** This function returns an instance of a subclass of RTPTransmissionInfo which will give some + * additional information about the transmitter (a list of local IP addresses for example). + * This function returns an instance of a subclass of RTPTransmissionInfo which will give some + * additional information about the transmitter (a list of local IP addresses for example). The user + * has to free the returned instance when it is no longer needed, preferably using the DeleteTransmissionInfo + * function. + */ + RTPTransmissionInfo *GetTransmissionInfo(); + + /** Frees the memory used by the transmission information \c inf. */ + void DeleteTransmissionInfo(RTPTransmissionInfo *inf); + + /** If you're not using the poll thread, this function must be called regularly to process incoming data + * and to send RTCP data when necessary. + */ + int Poll(); + + /** Waits at most a time \c delay until incoming data has been detected. + * Waits at most a time \c delay until incoming data has been detected. Only works when you're not + * using the poll thread. If \c dataavailable is not \c NULL, it should be set to \c true if data + * was actually read and to \c false otherwise. + */ + int WaitForIncomingData(const RTPTime &delay,bool *dataavailable = 0); + + /** If the previous function has been called, this one aborts the waiting (only works when you're not + * using the poll thread). + */ + int AbortWait(); + + /** Returns the time interval after which an RTCP compound packet may have to be sent (only works when + * you're not using the poll thread. + */ + RTPTime GetRTCPDelay(); + + /** The following member functions (till EndDataAccess}) need to be accessed between a call + * to BeginDataAccess and EndDataAccess. + * The BeginDataAccess function makes sure that the poll thread won't access the source table + * at the same time that you're using it. When the EndDataAccess is called, the lock on the + * source table is freed again. + */ + int BeginDataAccess(); + + /** Starts the iteration over the participants by going to the first member in the table. + * Starts the iteration over the participants by going to the first member in the table. + * If a member was found, the function returns \c true, otherwise it returns \c false. + */ + bool GotoFirstSource(); + + /** Sets the current source to be the next source in the table. + * Sets the current source to be the next source in the table. If we're already at the last + * source, the function returns \c false, otherwise it returns \c true. + */ + bool GotoNextSource(); + + /** Sets the current source to be the previous source in the table. + * Sets the current source to be the previous source in the table. If we're at the first source, + * the function returns \c false, otherwise it returns \c true. + */ + bool GotoPreviousSource(); + + /** Sets the current source to be the first source in the table which has RTPPacket instances + * that we haven't extracted yet. + * Sets the current source to be the first source in the table which has RTPPacket instances + * that we haven't extracted yet. If no such member was found, the function returns \c false, + * otherwise it returns \c true. + */ + bool GotoFirstSourceWithData(); + + /** Sets the current source to be the next source in the table which has RTPPacket instances + * that we haven't extracted yet. + * Sets the current source to be the next source in the table which has RTPPacket instances + * that we haven't extracted yet. If no such member was found, the function returns \c false, + * otherwise it returns \c true. + */ + bool GotoNextSourceWithData(); + + /** Sets the current source to be the previous source in the table which has RTPPacket + * instances that we haven't extracted yet. + * Sets the current source to be the previous source in the table which has RTPPacket + * instances that we haven't extracted yet. If no such member was found, the function returns \c false, + * otherwise it returns \c true. + */ + bool GotoPreviousSourceWithData(); + + /** Returns the \c RTPSourceData instance for the currently selected participant. */ + RTPSourceData *GetCurrentSourceInfo(); + + /** Returns the \c RTPSourceData instance for the participant identified by \c ssrc, + * or NULL if no such entry exists. + */ + RTPSourceData *GetSourceInfo(uint32_t ssrc); + + /** Extracts the next packet from the received packets queue of the current participant, + * or NULL if no more packets are available. + * Extracts the next packet from the received packets queue of the current participant, + * or NULL if no more packets are available. When the packet is no longer needed, its + * memory should be freed using the DeletePacket member function. + */ + RTPPacket *GetNextPacket(); + + /** Returns the Sequence Number that will be used in the next SendPacket function call. */ + uint16_t GetNextSequenceNumber() const; + + /** Frees the memory used by \c p. */ + void DeletePacket(RTPPacket *p); + + /** See BeginDataAccess. */ + int EndDataAccess(); + + /** Sets the receive mode to \c m. + * Sets the receive mode to \c m. Note that when the receive mode is changed, the list of + * addresses to be ignored ot accepted will be cleared. + */ + int SetReceiveMode(RTPTransmitter::ReceiveMode m); + + /** Adds \c addr to the list of addresses to ignore. */ + int AddToIgnoreList(const RTPAddress &addr); + + /** Deletes \c addr from the list of addresses to ignore. */ + int DeleteFromIgnoreList(const RTPAddress &addr); + + /** Clears the list of addresses to ignore. */ + void ClearIgnoreList(); + + /** Adds \c addr to the list of addresses to accept. */ + int AddToAcceptList(const RTPAddress &addr); + + /** Deletes \c addr from the list of addresses to accept. */ + int DeleteFromAcceptList(const RTPAddress &addr); + + /** Clears the list of addresses to accept. */ + void ClearAcceptList(); + + /** Sets the maximum allowed packet size to \c s. */ + int SetMaximumPacketSize(size_t s); + + /** Sets the session bandwidth to \c bw, which is specified in bytes per second. */ + int SetSessionBandwidth(double bw); + + /** Sets the timestamp unit for our own data. + * Sets the timestamp unit for our own data. The timestamp unit is defined as a time interval in + * seconds divided by the corresponding timestamp interval. For example, for 8000 Hz audio, the + * timestamp unit would typically be 1/8000. Since this value is initially set to an illegal value, + * the user must set this to an allowed value to be able to create a session. + */ + int SetTimestampUnit(double u); + + /** Sets the RTCP interval for the SDES name item. + * After all possible sources in the source table have been processed, the class will check if other + * SDES items need to be sent. If \c count is zero or negative, nothing will happen. If \c count + * is positive, an SDES name item will be added after the sources in the source table have been + * processed \c count times. + */ + void SetNameInterval(int count); + + /** Sets the RTCP interval for the SDES e-mail item. + * After all possible sources in the source table have been processed, the class will check if other + * SDES items need to be sent. If \c count is zero or negative, nothing will happen. If \c count + * is positive, an SDES e-mail item will be added after the sources in the source table have been + * processed \c count times. + */ + void SetEMailInterval(int count); + + /** Sets the RTCP interval for the SDES location item. + * After all possible sources in the source table have been processed, the class will check if other + * SDES items need to be sent. If \c count is zero or negative, nothing will happen. If \c count + * is positive, an SDES location item will be added after the sources in the source table have been + * processed \c count times. + */ + void SetLocationInterval(int count); + + /** Sets the RTCP interval for the SDES phone item. + * After all possible sources in the source table have been processed, the class will check if other + * SDES items need to be sent. If \c count is zero or negative, nothing will happen. If \c count + * is positive, an SDES phone item will be added after the sources in the source table have been + * processed \c count times. + */ + void SetPhoneInterval(int count); + + /** Sets the RTCP interval for the SDES tool item. + * After all possible sources in the source table have been processed, the class will check if other + * SDES items need to be sent. If \c count is zero or negative, nothing will happen. If \c count + * is positive, an SDES tool item will be added after the sources in the source table have been + * processed \c count times. + */ + void SetToolInterval(int count); + + /** Sets the RTCP interval for the SDES note item. + * After all possible sources in the source table have been processed, the class will check if other + * SDES items need to be sent. If \c count is zero or negative, nothing will happen. If \c count + * is positive, an SDES note item will be added after the sources in the source table have been + * processed \c count times. + */ + void SetNoteInterval(int count); + + /** Sets the SDES name item for the local participant to the value \c s with length \c len. */ + int SetLocalName(const void *s,size_t len); + + /** Sets the SDES e-mail item for the local participant to the value \c s with length \c len. */ + int SetLocalEMail(const void *s,size_t len); + + /** Sets the SDES location item for the local participant to the value \c s with length \c len. */ + int SetLocalLocation(const void *s,size_t len); + + /** Sets the SDES phone item for the local participant to the value \c s with length \c len. */ + int SetLocalPhone(const void *s,size_t len); + + /** Sets the SDES tool item for the local participant to the value \c s with length \c len. */ + int SetLocalTool(const void *s,size_t len); + + /** Sets the SDES note item for the local participant to the value \c s with length \c len. */ + int SetLocalNote(const void *s,size_t len); + +#ifdef RTPDEBUG + void DumpSources(); + void DumpTransmitter(); +#endif // RTPDEBUG +protected: + /** Allocate a user defined transmitter. + * In case you specified in the Create function that you want to use a + * user defined transmitter, you should override this function. The RTPTransmitter + * instance returned by this function will then be used to send and receive RTP and + * RTCP packets. Note that when the session is destroyed, this RTPTransmitter + * instance will be destroyed as well. + */ + virtual RTPTransmitter *NewUserDefinedTransmitter(); + + /** Is called when an incoming RTP packet is about to be processed. + * Is called when an incoming RTP packet is about to be processed. This is _not_ + * a good function to process an RTP packet in, in case you want to avoid iterating + * over the sources using the GotoFirst/GotoNext functions. In that case, the + * RTPSession::OnValidatedRTPPacket function should be used. + */ + virtual void OnRTPPacket(RTPPacket *pack,const RTPTime &receivetime, const RTPAddress *senderaddress); + + /** Is called when an incoming RTCP packet is about to be processed. */ + virtual void OnRTCPCompoundPacket(RTCPCompoundPacket *pack,const RTPTime &receivetime, + const RTPAddress *senderaddress); + + /** Is called when an SSRC collision was detected. + * Is called when an SSRC collision was detected. The instance \c srcdat is the one present in + * the table, the address \c senderaddress is the one that collided with one of the addresses + * and \c isrtp indicates against which address of \c srcdat the check failed. + */ + virtual void OnSSRCCollision(RTPSourceData *srcdat,const RTPAddress *senderaddress,bool isrtp); + + /** Is called when another CNAME was received than the one already present for source \c srcdat. */ + virtual void OnCNAMECollision(RTPSourceData *srcdat,const RTPAddress *senderaddress, + const uint8_t *cname,size_t cnamelength); + + /** Is called when a new entry \c srcdat is added to the source table. */ + virtual void OnNewSource(RTPSourceData *srcdat); + + /** Is called when the entry \c srcdat is about to be deleted from the source table. */ + virtual void OnRemoveSource(RTPSourceData *srcdat); + + /** Is called when participant \c srcdat is timed out. */ + virtual void OnTimeout(RTPSourceData *srcdat); + + /** Is called when participant \c srcdat is timed after having sent a BYE packet. */ + virtual void OnBYETimeout(RTPSourceData *srcdat); + + /** Is called when an RTCP APP packet \c apppacket has been received at time \c receivetime + * from address \c senderaddress. + */ + virtual void OnAPPPacket(RTCPAPPPacket *apppacket,const RTPTime &receivetime, + const RTPAddress *senderaddress); + + /** Is called when an unknown RTCP packet type was detected. */ + virtual void OnUnknownPacketType(RTCPPacket *rtcppack,const RTPTime &receivetime, + const RTPAddress *senderaddress); + + /** Is called when an unknown packet format for a known packet type was detected. */ + virtual void OnUnknownPacketFormat(RTCPPacket *rtcppack,const RTPTime &receivetime, + const RTPAddress *senderaddress); + + /** Is called when the SDES NOTE item for source \c srcdat has been timed out. */ + virtual void OnNoteTimeout(RTPSourceData *srcdat); + + /** Is called when an RTCP sender report has been processed for this source. */ + virtual void OnRTCPSenderReport(RTPSourceData *srcdat); + + /** Is called when an RTCP receiver report has been processed for this source. */ + virtual void OnRTCPReceiverReport(RTPSourceData *srcdat); + + /** Is called when a specific SDES item was received for this source. */ + virtual void OnRTCPSDESItem(RTPSourceData *srcdat, RTCPSDESPacket::ItemType t, + const void *itemdata, size_t itemlength); +#ifdef RTP_SUPPORT_SDESPRIV + /** Is called when a specific SDES item of 'private' type was received for this source. */ + virtual void OnRTCPSDESPrivateItem(RTPSourceData *srcdat, const void *prefixdata, size_t prefixlen, + const void *valuedata, size_t valuelen); +#endif // RTP_SUPPORT_SDESPRIV + + /** Is called when a BYE packet has been processed for source \c srcdat. */ + virtual void OnBYEPacket(RTPSourceData *srcdat); + + /** Is called when an RTCP compound packet has just been sent (useful to inspect outgoing RTCP data). */ + virtual void OnSendRTCPCompoundPacket(RTCPCompoundPacket *pack); +#ifdef RTP_SUPPORT_THREAD + /** Is called when error \c errcode was detected in the poll thread. */ + virtual void OnPollThreadError(int errcode); + + /** Is called each time the poll thread loops. + * Is called each time the poll thread loops. This happens when incoming data was + * detected or when it's time to send an RTCP compound packet. + */ + virtual void OnPollThreadStep(); + + /** Is called when the poll thread is started. + * Is called when the poll thread is started. This happens just before entering the + * thread main loop. + * \param stop This can be used to stop the thread immediately without entering the loop. + */ + virtual void OnPollThreadStart(bool &stop); + + /** Is called when the poll thread is going to stop. + * Is called when the poll thread is going to stop. This happens just before termitating the thread. + */ + virtual void OnPollThreadStop(); +#endif // RTP_SUPPORT_THREAD + + /** If this is set to true, outgoing data will be passed through RTPSession::OnChangeRTPOrRTCPData + * and RTPSession::OnSentRTPOrRTCPData, allowing you to modify the data (e.g. to encrypt it). */ + void SetChangeOutgoingData(bool change) { m_changeOutgoingData = change; } + + /** If this is set to true, incoming data will be passed through RTPSession::OnChangeIncomingData, + * allowing you to modify the data (e.g. to decrypt it). */ + void SetChangeIncomingData(bool change) { m_changeIncomingData = change; } + + /** If RTPSession::SetChangeOutgoingData was sent to true, overriding this you can change the + * data packet that will actually be sent, for example adding encryption. + * If RTPSession::SetChangeOutgoingData was sent to true, overriding this you can change the + * data packet that will actually be sent, for example adding encryption. + * Note that no memory management will be performed on the `senddata` pointer you fill in, + * so if it needs to be deleted at some point you need to take care of this in some way + * yourself, a good way may be to do this in RTPSession::OnSentRTPOrRTCPData. If `senddata` is + * set to 0, no packet will be sent out. This also provides a way to turn off sending RTCP + * packets if desired. */ + virtual int OnChangeRTPOrRTCPData(const void *origdata, size_t origlen, bool isrtp, void **senddata, size_t *sendlen); + + /** This function is called when an RTP or RTCP packet was sent, it can be helpful + * when data was allocated in RTPSession::OnChangeRTPOrRTCPData to deallocate it + * here. */ + virtual void OnSentRTPOrRTCPData(void *senddata, size_t sendlen, bool isrtp); + + /** By overriding this function, the raw incoming data can be inspected + * and modified (e.g. for encryption). + * By overriding this function, the raw incoming data can be inspected + * and modified (e.g. for encryption). If the function returns `false`, + * the packet is discarded. + */ + virtual bool OnChangeIncomingData(RTPRawPacket *rawpack); + + /** Allows you to use an RTP packet from the specified source directly. + * Allows you to use an RTP packet from the specified source directly. If + * `ispackethandled` is set to `true`, the packet will no longer be stored in this + * source's packet list. Note that if you do set this flag, you'll need to + * deallocate the packet yourself at an appropriate time. + * + * The difference with RTPSession::OnRTPPacket is that that + * function will always process the RTP packet further and is therefore not + * really suited to actually do something with the data. + */ + virtual void OnValidatedRTPPacket(RTPSourceData *srcdat, RTPPacket *rtppack, bool isonprobation, bool *ispackethandled); +private: + int InternalCreate(const RTPSessionParams &sessparams); + int CreateCNAME(uint8_t *buffer,size_t *bufferlength,bool resolve); + int ProcessPolledData(); + int ProcessRTCPCompoundPacket(RTCPCompoundPacket &rtcpcomppack,RTPRawPacket *pack); + RTPRandom *GetRandomNumberGenerator(RTPRandom *r); + int SendRTPData(const void *data, size_t len); + int SendRTCPData(const void *data, size_t len); + + RTPRandom *rtprnd; + bool deletertprnd; + + RTPTransmitter *rtptrans; + bool created; + bool deletetransmitter; + bool usingpollthread, needthreadsafety; + bool acceptownpackets; + bool useSR_BYEifpossible; + size_t maxpacksize; + double sessionbandwidth; + double controlfragment; + double sendermultiplier; + double byemultiplier; + double membermultiplier; + double collisionmultiplier; + double notemultiplier; + bool sentpackets; + + bool m_changeIncomingData, m_changeOutgoingData; + + RTPSessionSources sources; + RTPPacketBuilder packetbuilder; + RTCPScheduler rtcpsched; + RTCPPacketBuilder rtcpbuilder; + RTPCollisionList collisionlist; + + std::list byepackets; + +#ifdef RTP_SUPPORT_THREAD + RTPPollThread *pollthread; + jthread::JMutex sourcesmutex,buildermutex,schedmutex,packsentmutex; + + friend class RTPPollThread; +#endif // RTP_SUPPORT_THREAD + friend class RTPSessionSources; + friend class RTCPSessionPacketBuilder; +}; + +inline RTPTransmitter *RTPSession::NewUserDefinedTransmitter() { return 0; } +inline void RTPSession::OnRTPPacket(RTPPacket *, const RTPTime &, const RTPAddress *) { } +inline void RTPSession::OnRTCPCompoundPacket(RTCPCompoundPacket *, const RTPTime &, const RTPAddress *) { } +inline void RTPSession::OnSSRCCollision(RTPSourceData *, const RTPAddress *, bool ) { } +inline void RTPSession::OnCNAMECollision(RTPSourceData *, const RTPAddress *, const uint8_t *, size_t ) { } +inline void RTPSession::OnNewSource(RTPSourceData *) { } +inline void RTPSession::OnRemoveSource(RTPSourceData *) { } +inline void RTPSession::OnTimeout(RTPSourceData *) { } +inline void RTPSession::OnBYETimeout(RTPSourceData *) { } +inline void RTPSession::OnAPPPacket(RTCPAPPPacket *, const RTPTime &, const RTPAddress *) { } +inline void RTPSession::OnUnknownPacketType(RTCPPacket *, const RTPTime &, const RTPAddress *) { } +inline void RTPSession::OnUnknownPacketFormat(RTCPPacket *, const RTPTime &, const RTPAddress *) { } +inline void RTPSession::OnNoteTimeout(RTPSourceData *) { } +inline void RTPSession::OnRTCPSenderReport(RTPSourceData *) { } +inline void RTPSession::OnRTCPReceiverReport(RTPSourceData *) { } +inline void RTPSession::OnRTCPSDESItem(RTPSourceData *, RTCPSDESPacket::ItemType, const void *, size_t) { } + +#ifdef RTP_SUPPORT_SDESPRIV +inline void RTPSession::OnRTCPSDESPrivateItem(RTPSourceData *, const void *, size_t, const void *, size_t) { } +#endif // RTP_SUPPORT_SDESPRIV + +inline void RTPSession::OnBYEPacket(RTPSourceData *) { } +inline void RTPSession::OnSendRTCPCompoundPacket(RTCPCompoundPacket *) { } + +#ifdef RTP_SUPPORT_THREAD +inline void RTPSession::OnPollThreadError(int) { } +inline void RTPSession::OnPollThreadStep() { } +inline void RTPSession::OnPollThreadStart(bool &) { } +inline void RTPSession::OnPollThreadStop() { } +#endif // RTP_SUPPORT_THREAD + +inline int RTPSession::OnChangeRTPOrRTCPData(const void *, size_t, bool, void **, size_t *) { + return ERR_RTP_RTPSESSION_CHANGEREQUESTEDBUTNOTIMPLEMENTED; +} +inline void RTPSession::OnSentRTPOrRTCPData(void *, size_t, bool) { } +inline bool RTPSession::OnChangeIncomingData(RTPRawPacket *) { return true; } +inline void RTPSession::OnValidatedRTPPacket(RTPSourceData *, RTPPacket *, bool, bool *) { } + +} // end namespace + +#endif // RTPSESSION_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpsessionparams.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpsessionparams.h new file mode 100644 index 0000000..042432e --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpsessionparams.h @@ -0,0 +1,256 @@ +/* + + 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 rtpsessionparams.h + */ + +#ifndef RTPSESSIONPARAMS_H + +#define RTPSESSIONPARAMS_H + +#include "rtpconfig.h" +#include "rtptypes.h" +#include "rtptransmitter.h" +#include "rtptimeutilities.h" +#include "rtpsources.h" + +namespace jrtplib +{ + +/** Describes the parameters for to be used by an RTPSession instance. + * Describes the parameters for to be used by an RTPSession instance. Note that the own timestamp + * unit must be set to a valid number, otherwise the session can't be created. + */ +class JRTPLIB_IMPORTEXPORT RTPSessionParams +{ +public: + RTPSessionParams(); + + /** If \c usethread is \c true, the session will use a poll thread to automatically process incoming + * data and to send RTCP packets when necessary. + */ + int SetUsePollThread(bool usethread); + + /** if `s` is `true`, the session will use mutexes in case multiple threads + * are at work. */ + int SetNeedThreadSafety(bool s); + + /** Returns whether the session should use a poll thread or not (default is \c true). */ + bool IsUsingPollThread() const { return usepollthread; } + + /** Sets the maximum allowed packet size for the session. */ + void SetMaximumPacketSize(size_t max) { maxpacksize = max; } + + /** Returns the maximum allowed packet size (default is 1400 bytes). */ + size_t GetMaximumPacketSize() const { return maxpacksize; } + + /** If the argument is \c true, the session should accept its own packets and store + * them accordingly in the source table. + */ + void SetAcceptOwnPackets(bool accept) { acceptown = accept; } + + /** Returns \c true if the session should accept its own packets (default is \c false). */ + bool AcceptOwnPackets() const { return acceptown; } + + /** Sets the receive mode to be used by the session. */ + void SetReceiveMode(RTPTransmitter::ReceiveMode recvmode) { receivemode = recvmode; } + + /** Sets the receive mode to be used by the session (default is: accept all packets). */ + RTPTransmitter::ReceiveMode GetReceiveMode() const { return receivemode; } + + /** Sets the timestamp unit for our own data. + * Sets the timestamp unit for our own data. The timestamp unit is defined as a time interval in + * seconds divided by the corresponding timestamp interval. For example, for 8000 Hz audio, the + * timestamp unit would typically be 1/8000. Since this value is initially set to an illegal value, + * the user must set this to an allowed value to be able to create a session. + */ + void SetOwnTimestampUnit(double tsunit) { owntsunit = tsunit; } + + /** Returns the currently set timestamp unit. */ + double GetOwnTimestampUnit() const { return owntsunit; } + + /** Sets a flag indicating if a DNS lookup should be done to determine our hostname (to construct a CNAME item). + * If \c v is set to \c true, the session will ask the transmitter to find a host name based upon the IP + * addresses in its list of local IP addresses. If set to \c false, a call to \c gethostname or something + * similar will be used to find the local hostname. Note that the first method might take some time. + */ + void SetResolveLocalHostname(bool v) { resolvehostname = v; } + + /** Returns whether the local hostname should be determined from the transmitter's list of local IP addresses + * or not (default is \c false). + */ + bool GetResolveLocalHostname() const { return resolvehostname; } +#ifdef RTP_SUPPORT_PROBATION + /** If probation support is enabled, this function sets the probation type to be used. */ + void SetProbationType(RTPSources::ProbationType probtype) { probationtype = probtype; } + + /** Returns the probation type which will be used (default is RTPSources::ProbationStore). */ + RTPSources::ProbationType GetProbationType() const { return probationtype; } +#endif // RTP_SUPPORT_PROBATION + + /** Sets the session bandwidth in bytes per second. */ + void SetSessionBandwidth(double sessbw) { sessionbandwidth = sessbw; } + + /** Returns the session bandwidth in bytes per second (default is 10000 bytes per second). */ + double GetSessionBandwidth() const { return sessionbandwidth; } + + /** Sets the fraction of the session bandwidth to be used for control traffic. */ + void SetControlTrafficFraction(double frac) { controlfrac = frac; } + + /** Returns the fraction of the session bandwidth that will be used for control traffic (default is 5%). */ + double GetControlTrafficFraction() const { return controlfrac; } + + /** Sets the minimum fraction of the control traffic that will be used by senders. */ + void SetSenderControlBandwidthFraction(double frac) { senderfrac = frac; } + + /** Returns the minimum fraction of the control traffic that will be used by senders (default is 25%). */ + double GetSenderControlBandwidthFraction() const { return senderfrac; } + + /** Set the minimal time interval between sending RTCP packets. */ + void SetMinimumRTCPTransmissionInterval(const RTPTime &t) { mininterval = t; } + + /** Returns the minimal time interval between sending RTCP packets (default is 5 seconds). */ + RTPTime GetMinimumRTCPTransmissionInterval() const { return mininterval; } + + /** If \c usehalf is set to \c true, the session will only wait half of the calculated RTCP + * interval before sending its first RTCP packet. + */ + void SetUseHalfRTCPIntervalAtStartup(bool usehalf) { usehalfatstartup = usehalf; } + + /** Returns whether the session will only wait half of the calculated RTCP interval before sending its + * first RTCP packet or not (default is \c true). + */ + bool GetUseHalfRTCPIntervalAtStartup() const { return usehalfatstartup; } + + /** If \c v is \c true, the session will send a BYE packet immediately if this is allowed. */ + void SetRequestImmediateBYE(bool v) { immediatebye = v; } + + /** Returns whether the session should send a BYE packet immediately (if allowed) or not (default is \c true). */ + bool GetRequestImmediateBYE() const { return immediatebye; } + + /** When sending a BYE packet, this indicates whether it will be part of an RTCP compound packet + * that begins with a sender report (if allowed) or a receiver report. + */ + void SetSenderReportForBYE(bool v) { SR_BYE = v; } + + /** Returns \c true if a BYE packet will be sent in an RTCP compound packet which starts with a + * sender report; if a receiver report will be used, the function returns \c false (default is \c true). + */ + bool GetSenderReportForBYE() const { return SR_BYE; } + + /** Sets the multiplier to be used when timing out senders. */ + void SetSenderTimeoutMultiplier(double m) { sendermultiplier = m; } + + /** Returns the multiplier to be used when timing out senders (default is 2). */ + double GetSenderTimeoutMultiplier() const { return sendermultiplier; } + + /** Sets the multiplier to be used when timing out members. */ + void SetSourceTimeoutMultiplier(double m) { generaltimeoutmultiplier = m; } + + /** Returns the multiplier to be used when timing out members (default is 5). */ + double GetSourceTimeoutMultiplier() const { return generaltimeoutmultiplier; } + + /** Sets the multiplier to be used when timing out a member after it has sent a BYE packet. */ + void SetBYETimeoutMultiplier(double m) { byetimeoutmultiplier = m; } + + /** Returns the multiplier to be used when timing out a member after it has sent a BYE packet (default is 1). */ + double GetBYETimeoutMultiplier() const { return byetimeoutmultiplier; } + + /** Sets the multiplier to be used when timing out entries in the collision table. */ + void SetCollisionTimeoutMultiplier(double m) { collisionmultiplier = m; } + + /** Returns the multiplier to be used when timing out entries in the collision table (default is 10). */ + double GetCollisionTimeoutMultiplier() const { return collisionmultiplier; } + + /** Sets the multiplier to be used when timing out SDES NOTE information. */ + void SetNoteTimeoutMultiplier(double m) { notemultiplier = m; } + + /** Returns the multiplier to be used when timing out SDES NOTE information (default is 25). */ + double GetNoteTimeoutMultiplier() const { return notemultiplier; } + + /** Sets a flag which indicates if a predefined SSRC identifier should be used. */ + void SetUsePredefinedSSRC(bool f) { usepredefinedssrc = f; } + + /** Returns a flag indicating if a predefined SSRC should be used. */ + bool GetUsePredefinedSSRC() const { return usepredefinedssrc; } + + /** Sets the SSRC which will be used if RTPSessionParams::GetUsePredefinedSSRC returns true. */ + void SetPredefinedSSRC(uint32_t ssrc) { predefinedssrc = ssrc; } + + /** Returns the SSRC which will be used if RTPSessionParams::GetUsePredefinedSSRC returns true. */ + uint32_t GetPredefinedSSRC() const { return predefinedssrc; } + + /** Forces this string to be used as the CNAME identifier. */ + void SetCNAME(const std::string &s) { cname = s; } + + /** Returns the currently set CNAME, is blank when this will be generated automatically (the default). */ + std::string GetCNAME() const { return cname; } + + /** Returns `true` if thread safety was requested using RTPSessionParams::SetNeedThreadSafety. */ + bool NeedThreadSafety() const { return m_needThreadSafety; } +private: + bool acceptown; + bool usepollthread; + size_t maxpacksize; + double owntsunit; + RTPTransmitter::ReceiveMode receivemode; + bool resolvehostname; +#ifdef RTP_SUPPORT_PROBATION + RTPSources::ProbationType probationtype; +#endif // RTP_SUPPORT_PROBATION + + double sessionbandwidth; + double controlfrac; + double senderfrac; + RTPTime mininterval; + bool usehalfatstartup; + bool immediatebye; + bool SR_BYE; + + double sendermultiplier; + double generaltimeoutmultiplier; + double byetimeoutmultiplier; + double collisionmultiplier; + double notemultiplier; + + bool usepredefinedssrc; + uint32_t predefinedssrc; + + std::string cname; + bool m_needThreadSafety; +}; + +} // end namespace + +#endif // RTPSESSIONPARAMS_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpsessionsources.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpsessionsources.h new file mode 100644 index 0000000..c826800 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpsessionsources.h @@ -0,0 +1,93 @@ +/* + + 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 rtpsessionsources.h + */ + +#ifndef RTPSESSIONSOURCES_H + +#define RTPSESSIONSOURCES_H + +#include "rtpconfig.h" +#include "rtpsources.h" + +namespace jrtplib +{ + +class RTPSession; + +class JRTPLIB_IMPORTEXPORT RTPSessionSources : public RTPSources +{ +public: + RTPSessionSources(RTPSession &sess,RTPMemoryManager *mgr) : RTPSources(RTPSources::ProbationStore,mgr),rtpsession(sess) + { owncollision = false; } + ~RTPSessionSources() { } + void ClearOwnCollisionFlag() { owncollision = false; } + bool DetectedOwnCollision() const { return owncollision; } +private: + void OnRTPPacket(RTPPacket *pack,const RTPTime &receivetime, + const RTPAddress *senderaddress); + void OnRTCPCompoundPacket(RTCPCompoundPacket *pack,const RTPTime &receivetime, + const RTPAddress *senderaddress); + void OnSSRCCollision(RTPSourceData *srcdat,const RTPAddress *senderaddress,bool isrtp); + void OnCNAMECollision(RTPSourceData *srcdat,const RTPAddress *senderaddress, + const uint8_t *cname,size_t cnamelength); + void OnNewSource(RTPSourceData *srcdat); + void OnRemoveSource(RTPSourceData *srcdat); + void OnTimeout(RTPSourceData *srcdat); + void OnBYETimeout(RTPSourceData *srcdat); + void OnBYEPacket(RTPSourceData *srcdat); + void OnAPPPacket(RTCPAPPPacket *apppacket,const RTPTime &receivetime, + const RTPAddress *senderaddress); + void OnUnknownPacketType(RTCPPacket *rtcppack,const RTPTime &receivetime, + const RTPAddress *senderaddress); + void OnUnknownPacketFormat(RTCPPacket *rtcppack,const RTPTime &receivetime, + const RTPAddress *senderaddress); + void OnNoteTimeout(RTPSourceData *srcdat); + void OnValidatedRTPPacket(RTPSourceData *srcdat, RTPPacket *rtppack, bool isonprobation, bool *ispackethandled); + void OnRTCPSenderReport(RTPSourceData *srcdat); + void OnRTCPReceiverReport(RTPSourceData *srcdat); + void OnRTCPSDESItem(RTPSourceData *srcdat, RTCPSDESPacket::ItemType t, + const void *itemdata, size_t itemlength); +#ifdef RTP_SUPPORT_SDESPRIV + void OnRTCPSDESPrivateItem(RTPSourceData *srcdat, const void *prefixdata, size_t prefixlen, + const void *valuedata, size_t valuelen); +#endif // RTP_SUPPORT_SDESPRIV + + RTPSession &rtpsession; + bool owncollision; +}; + +} // end namespace + +#endif // RTPSESSIONSOURCES_H diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpsocketutil.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpsocketutil.h new file mode 100644 index 0000000..fd6e4cc --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpsocketutil.h @@ -0,0 +1,61 @@ +/* + + 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 rtpsocketutil.h + */ + +#ifndef RTPSOCKETUTIL_H + +#define RTPSOCKETUTIL_H + +#include "rtpconfig.h" +#ifdef RTP_SOCKETTYPE_WINSOCK +#include "rtptypes.h" +#endif // RTP_SOCKETTYPE_WINSOCK + +namespace jrtplib +{ + +#ifndef RTP_SOCKETTYPE_WINSOCK + +typedef int SocketType; + +#else + +typedef SOCKET SocketType; + +#endif // RTP_SOCKETTYPE_WINSOCK + +} // end namespace + +#endif // RTPSOCKETUTIL_H diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpsourcedata.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpsourcedata.h new file mode 100644 index 0000000..3d5ac8c --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpsourcedata.h @@ -0,0 +1,480 @@ +/* + + 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 rtpsourcedata.h + */ + +#ifndef RTPSOURCEDATA_H + +#define RTPSOURCEDATA_H + +#include "rtpconfig.h" +#include "rtptimeutilities.h" +#include "rtppacket.h" +#include "rtcpsdesinfo.h" +#include "rtptypes.h" +#include "rtpsources.h" +#include "rtpmemoryobject.h" +#include + +namespace jrtplib +{ + +class RTPAddress; + +class JRTPLIB_IMPORTEXPORT RTCPSenderReportInfo +{ +public: + RTCPSenderReportInfo():ntptimestamp(0,0),receivetime(0,0) { hasinfo = false; rtptimestamp = 0; packetcount = 0; bytecount = 0; } + void Set(const RTPNTPTime &ntptime,uint32_t rtptime,uint32_t pcount, + uint32_t bcount,const RTPTime &rcvtime) { ntptimestamp = ntptime; rtptimestamp = rtptime; packetcount = pcount; bytecount = bcount; receivetime = rcvtime; hasinfo = true; } + + bool HasInfo() const { return hasinfo; } + RTPNTPTime GetNTPTimestamp() const { return ntptimestamp; } + uint32_t GetRTPTimestamp() const { return rtptimestamp; } + uint32_t GetPacketCount() const { return packetcount; } + uint32_t GetByteCount() const { return bytecount; } + RTPTime GetReceiveTime() const { return receivetime; } +private: + bool hasinfo; + RTPNTPTime ntptimestamp; + uint32_t rtptimestamp; + uint32_t packetcount; + uint32_t bytecount; + RTPTime receivetime; +}; + +class JRTPLIB_IMPORTEXPORT RTCPReceiverReportInfo +{ +public: + RTCPReceiverReportInfo():receivetime(0,0) { hasinfo = false; fractionlost = 0; packetslost = 0; exthighseqnr = 0; jitter = 0; lsr = 0; dlsr = 0; } + void Set(uint8_t fraclost,int32_t plost,uint32_t exthigh, + uint32_t jit,uint32_t l,uint32_t dl,const RTPTime &rcvtime) { fractionlost = ((double)fraclost)/256.0; packetslost = plost; exthighseqnr = exthigh; jitter = jit; lsr = l; dlsr = dl; receivetime = rcvtime; hasinfo = true; } + + bool HasInfo() const { return hasinfo; } + double GetFractionLost() const { return fractionlost; } + int32_t GetPacketsLost() const { return packetslost; } + uint32_t GetExtendedHighestSequenceNumber() const { return exthighseqnr; } + uint32_t GetJitter() const { return jitter; } + uint32_t GetLastSRTimestamp() const { return lsr; } + uint32_t GetDelaySinceLastSR() const { return dlsr; } + RTPTime GetReceiveTime() const { return receivetime; } +private: + bool hasinfo; + double fractionlost; + int32_t packetslost; + uint32_t exthighseqnr; + uint32_t jitter; + uint32_t lsr; + uint32_t dlsr; + RTPTime receivetime; +}; + +class JRTPLIB_IMPORTEXPORT RTPSourceStats +{ +public: + RTPSourceStats(); + void ProcessPacket(RTPPacket *pack,const RTPTime &receivetime,double tsunit,bool ownpacket,bool *accept,bool applyprobation,bool *onprobation); + + bool HasSentData() const { return sentdata; } + uint32_t GetNumPacketsReceived() const { return packetsreceived; } + uint32_t GetBaseSequenceNumber() const { return baseseqnr; } + uint32_t GetExtendedHighestSequenceNumber() const { return exthighseqnr; } + uint32_t GetJitter() const { return jitter; } + + int32_t GetNumPacketsReceivedInInterval() const { return numnewpackets; } + uint32_t GetSavedExtendedSequenceNumber() const { return savedextseqnr; } + void StartNewInterval() { numnewpackets = 0; savedextseqnr = exthighseqnr; } + + void SetLastMessageTime(const RTPTime &t) { lastmsgtime = t; } + RTPTime GetLastMessageTime() const { return lastmsgtime; } + void SetLastRTPPacketTime(const RTPTime &t) { lastrtptime = t; } + RTPTime GetLastRTPPacketTime() const { return lastrtptime; } + + void SetLastNoteTime(const RTPTime &t) { lastnotetime = t; } + RTPTime GetLastNoteTime() const { return lastnotetime; } +private: + bool sentdata; + uint32_t packetsreceived; + uint32_t numcycles; // shifted left 16 bits + uint32_t baseseqnr; + uint32_t exthighseqnr,prevexthighseqnr; + uint32_t jitter,prevtimestamp; + double djitter; + RTPTime prevpacktime; + RTPTime lastmsgtime; + RTPTime lastrtptime; + RTPTime lastnotetime; + uint32_t numnewpackets; + uint32_t savedextseqnr; +#ifdef RTP_SUPPORT_PROBATION + uint16_t prevseqnr; + int probation; +#endif // RTP_SUPPORT_PROBATION +}; + +inline RTPSourceStats::RTPSourceStats():prevpacktime(0,0),lastmsgtime(0,0),lastrtptime(0,0),lastnotetime(0,0) +{ + sentdata = false; + packetsreceived = 0; + baseseqnr = 0; + exthighseqnr = 0; + prevexthighseqnr = 0; + jitter = 0; + numcycles = 0; + numnewpackets = 0; + prevtimestamp = 0; + djitter = 0; + savedextseqnr = 0; +#ifdef RTP_SUPPORT_PROBATION + probation = 0; + prevseqnr = 0; +#endif // RTP_SUPPORT_PROBATION +} + +/** Describes an entry in the RTPSources source table. */ +class JRTPLIB_IMPORTEXPORT RTPSourceData : public RTPMemoryObject +{ + JRTPLIB_NO_COPY(RTPSourceData) +protected: + RTPSourceData(uint32_t ssrc, RTPMemoryManager *mgr = 0); + virtual ~RTPSourceData(); +public: + /** Extracts the first packet of this participants RTP packet queue. */ + RTPPacket *GetNextPacket(); + + /** Clears the participant's RTP packet list. */ + void FlushPackets(); + + /** Returns \c true if there are RTP packets which can be extracted. */ + bool HasData() const { if (!validated) return false; return packetlist.empty()?false:true; } + + /** Returns the SSRC identifier for this member. */ + uint32_t GetSSRC() const { return ssrc; } + + /** Returns \c true if the participant was added using the RTPSources member function CreateOwnSSRC and + * returns \c false otherwise. + */ + bool IsOwnSSRC() const { return ownssrc; } + + /** Returns \c true if the source identifier is actually a CSRC from an RTP packet. */ + bool IsCSRC() const { return iscsrc; } + + /** Returns \c true if this member is marked as a sender and \c false if not. */ + bool IsSender() const { return issender; } + + /** Returns \c true if the participant is validated, which is the case if a number of + * consecutive RTP packets have been received or if a CNAME item has been received for + * this participant. + */ + bool IsValidated() const { return validated; } + + /** Returns \c true if the source was validated and had not yet sent a BYE packet. */ + bool IsActive() const { if (!validated) return false; if (receivedbye) return false; return true; } + + /** This function is used by the RTCPPacketBuilder class to mark whether this participant's + * information has been processed in a report block or not. + */ + void SetProcessedInRTCP(bool v) { processedinrtcp = v; } + + /** This function is used by the RTCPPacketBuilder class and returns whether this participant + * has been processed in a report block or not. + */ + bool IsProcessedInRTCP() const { return processedinrtcp; } + + /** Returns \c true if the address from which this participant's RTP packets originate has + * already been set. + */ + bool IsRTPAddressSet() const { return isrtpaddrset; } + + /** Returns \c true if the address from which this participant's RTCP packets originate has + * already been set. + */ + bool IsRTCPAddressSet() const { return isrtcpaddrset; } + + /** Returns the address from which this participant's RTP packets originate. + * Returns the address from which this participant's RTP packets originate. If the address has + * been set and the returned value is NULL, this indicates that it originated from the local + * participant. + */ + const RTPAddress *GetRTPDataAddress() const { return rtpaddr; } + + /** Returns the address from which this participant's RTCP packets originate. + * Returns the address from which this participant's RTCP packets originate. If the address has + * been set and the returned value is NULL, this indicates that it originated from the local + * participant. + */ + const RTPAddress *GetRTCPDataAddress() const { return rtcpaddr; } + + /** Returns \c true if we received a BYE message for this participant and \c false otherwise. */ + bool ReceivedBYE() const { return receivedbye; } + + /** Returns the reason for leaving contained in the BYE packet of this participant. + * Returns the reason for leaving contained in the BYE packet of this participant. The length of + * the reason is stored in \c len. + */ + uint8_t *GetBYEReason(size_t *len) const { *len = byereasonlen; return byereason; } + + /** Returns the time at which the BYE packet was received. */ + RTPTime GetBYETime() const { return byetime; } + + /** Sets the value for the timestamp unit to be used in jitter calculations for data received from this participant. + * Sets the value for the timestamp unit to be used in jitter calculations for data received from this participant. + * If not set, the library uses an approximation for the timestamp unit which is calculated from two consecutive + * RTCP sender reports. The timestamp unit is defined as a time interval divided by the corresponding timestamp + * interval. For 8000 Hz audio this would be 1/8000. For video, often a timestamp unit of 1/90000 is used. + */ + void SetTimestampUnit(double tsu) { timestampunit = tsu; } + + /** Returns the timestamp unit used for this participant. */ + double GetTimestampUnit() const { return timestampunit; } + + /** Returns \c true if an RTCP sender report has been received from this participant. */ + bool SR_HasInfo() const { return SRinf.HasInfo(); } + + /** Returns the NTP timestamp contained in the last sender report. */ + RTPNTPTime SR_GetNTPTimestamp() const { return SRinf.GetNTPTimestamp(); } + + /** Returns the RTP timestamp contained in the last sender report. */ + uint32_t SR_GetRTPTimestamp() const { return SRinf.GetRTPTimestamp(); } + + /** Returns the packet count contained in the last sender report. */ + uint32_t SR_GetPacketCount() const { return SRinf.GetPacketCount(); } + + /** Returns the octet count contained in the last sender report. */ + uint32_t SR_GetByteCount() const { return SRinf.GetByteCount(); } + + /** Returns the time at which the last sender report was received. */ + RTPTime SR_GetReceiveTime() const { return SRinf.GetReceiveTime(); } + + /** Returns \c true if more than one RTCP sender report has been received. */ + bool SR_Prev_HasInfo() const { return SRprevinf.HasInfo(); } + + /** Returns the NTP timestamp contained in the second to last sender report. */ + RTPNTPTime SR_Prev_GetNTPTimestamp() const { return SRprevinf.GetNTPTimestamp(); } + + /** Returns the RTP timestamp contained in the second to last sender report. */ + uint32_t SR_Prev_GetRTPTimestamp() const { return SRprevinf.GetRTPTimestamp(); } + + /** Returns the packet count contained in the second to last sender report. */ + uint32_t SR_Prev_GetPacketCount() const { return SRprevinf.GetPacketCount(); } + + /** Returns the octet count contained in the second to last sender report. */ + uint32_t SR_Prev_GetByteCount() const { return SRprevinf.GetByteCount(); } + + /** Returns the time at which the second to last sender report was received. */ + RTPTime SR_Prev_GetReceiveTime() const { return SRprevinf.GetReceiveTime(); } + + /** Returns \c true if this participant sent a receiver report with information about the reception of our data. */ + bool RR_HasInfo() const { return RRinf.HasInfo(); } + + /** Returns the fraction lost value from the last report. */ + double RR_GetFractionLost() const { return RRinf.GetFractionLost(); } + + /** Returns the number of lost packets contained in the last report. */ + int32_t RR_GetPacketsLost() const { return RRinf.GetPacketsLost(); } + + /** Returns the extended highest sequence number contained in the last report. */ + uint32_t RR_GetExtendedHighestSequenceNumber() const { return RRinf.GetExtendedHighestSequenceNumber(); } + + /** Returns the jitter value from the last report. */ + uint32_t RR_GetJitter() const { return RRinf.GetJitter(); } + + /** Returns the LSR value from the last report. */ + uint32_t RR_GetLastSRTimestamp() const { return RRinf.GetLastSRTimestamp(); } + + /** Returns the DLSR value from the last report. */ + uint32_t RR_GetDelaySinceLastSR() const { return RRinf.GetDelaySinceLastSR(); } + + /** Returns the time at which the last report was received. */ + RTPTime RR_GetReceiveTime() const { return RRinf.GetReceiveTime(); } + + /** Returns \c true if this participant sent more than one receiver report with information + * about the reception of our data. + */ + bool RR_Prev_HasInfo() const { return RRprevinf.HasInfo(); } + + /** Returns the fraction lost value from the second to last report. */ + double RR_Prev_GetFractionLost() const { return RRprevinf.GetFractionLost(); } + + /** Returns the number of lost packets contained in the second to last report. */ + int32_t RR_Prev_GetPacketsLost() const { return RRprevinf.GetPacketsLost(); } + + /** Returns the extended highest sequence number contained in the second to last report. */ + uint32_t RR_Prev_GetExtendedHighestSequenceNumber() const { return RRprevinf.GetExtendedHighestSequenceNumber(); } + + /** Returns the jitter value from the second to last report. */ + uint32_t RR_Prev_GetJitter() const { return RRprevinf.GetJitter(); } + + /** Returns the LSR value from the second to last report. */ + uint32_t RR_Prev_GetLastSRTimestamp() const { return RRprevinf.GetLastSRTimestamp(); } + + /** Returns the DLSR value from the second to last report. */ + uint32_t RR_Prev_GetDelaySinceLastSR() const { return RRprevinf.GetDelaySinceLastSR(); } + + /** Returns the time at which the second to last report was received. */ + RTPTime RR_Prev_GetReceiveTime() const { return RRprevinf.GetReceiveTime(); } + + /** Returns \c true if validated RTP packets have been received from this participant. */ + bool INF_HasSentData() const { return stats.HasSentData(); } + + /** Returns the total number of received packets from this participant. */ + int32_t INF_GetNumPacketsReceived() const { return stats.GetNumPacketsReceived(); } + + /** Returns the base sequence number of this participant. */ + uint32_t INF_GetBaseSequenceNumber() const { return stats.GetBaseSequenceNumber(); } + + /** Returns the extended highest sequence number received from this participant. */ + uint32_t INF_GetExtendedHighestSequenceNumber() const { return stats.GetExtendedHighestSequenceNumber(); } + + /** Returns the current jitter value for this participant. */ + uint32_t INF_GetJitter() const { return stats.GetJitter(); } + + /** Returns the time at which something was last heard from this member. */ + RTPTime INF_GetLastMessageTime() const { return stats.GetLastMessageTime(); } + + /** Returns the time at which the last RTP packet was received. */ + RTPTime INF_GetLastRTPPacketTime() const { return stats.GetLastRTPPacketTime(); } + + /** Returns the estimated timestamp unit, calculated from two consecutive sender reports. */ + double INF_GetEstimatedTimestampUnit() const; + + /** Returns the number of packets received since a new interval was started with INF_StartNewInterval. */ + uint32_t INF_GetNumPacketsReceivedInInterval() const { return stats.GetNumPacketsReceivedInInterval(); } + + /** Returns the extended sequence number which was stored by the INF_StartNewInterval call. */ + uint32_t INF_GetSavedExtendedSequenceNumber() const { return stats.GetSavedExtendedSequenceNumber(); } + + /** Starts a new interval to count received packets in; this also stores the current extended highest sequence + * number to be able to calculate the packet loss during the interval. + */ + void INF_StartNewInterval() { stats.StartNewInterval(); } + + /** Estimates the round trip time by using the LSR and DLSR info from the last receiver report. */ + RTPTime INF_GetRoundtripTime() const; + + /** Returns the time at which the last SDES NOTE item was received. */ + RTPTime INF_GetLastSDESNoteTime() const { return stats.GetLastNoteTime(); } + + /** Returns a pointer to the SDES CNAME item of this participant and stores its length in \c len. */ + uint8_t *SDES_GetCNAME(size_t *len) const { return SDESinf.GetCNAME(len); } + + /** Returns a pointer to the SDES name item of this participant and stores its length in \c len. */ + uint8_t *SDES_GetName(size_t *len) const { return SDESinf.GetName(len); } + + /** Returns a pointer to the SDES e-mail item of this participant and stores its length in \c len. */ + uint8_t *SDES_GetEMail(size_t *len) const { return SDESinf.GetEMail(len); } + + /** Returns a pointer to the SDES phone item of this participant and stores its length in \c len. */ + uint8_t *SDES_GetPhone(size_t *len) const { return SDESinf.GetPhone(len); } + + /** Returns a pointer to the SDES location item of this participant and stores its length in \c len. */ + uint8_t *SDES_GetLocation(size_t *len) const { return SDESinf.GetLocation(len); } + + /** Returns a pointer to the SDES tool item of this participant and stores its length in \c len. */ + uint8_t *SDES_GetTool(size_t *len) const { return SDESinf.GetTool(len); } + + /** Returns a pointer to the SDES note item of this participant and stores its length in \c len. */ + uint8_t *SDES_GetNote(size_t *len) const { return SDESinf.GetNote(len); } + +#ifdef RTP_SUPPORT_SDESPRIV + /** Starts the iteration over the stored SDES private item prefixes and their associated values. */ + void SDES_GotoFirstPrivateValue() { SDESinf.GotoFirstPrivateValue(); } + + /** If available, returns \c true and stores the next SDES private item prefix in \c prefix and its length in + * \c prefixlen; the associated value and its length are then stored in \c value and \c valuelen. + */ + bool SDES_GetNextPrivateValue(uint8_t **prefix,size_t *prefixlen,uint8_t **value,size_t *valuelen) { return SDESinf.GetNextPrivateValue(prefix,prefixlen,value,valuelen); } + + /** Looks for the entry which corresponds to the SDES private item prefix \c prefix with length + * \c prefixlen; if found, the function returns \c true and stores the associated value and + * its length in \c value and \c valuelen respectively. + */ + bool SDES_GetPrivateValue(uint8_t *prefix,size_t prefixlen,uint8_t **value,size_t *valuelen) const { return SDESinf.GetPrivateValue(prefix,prefixlen,value,valuelen); } +#endif // RTP_SUPPORT_SDESPRIV + +#ifdef RTPDEBUG + virtual void Dump(); +#endif // RTPDEBUG +protected: + std::list packetlist; + + uint32_t ssrc; + bool ownssrc; + bool iscsrc; + double timestampunit; + bool receivedbye; + bool validated; + bool processedinrtcp; + bool issender; + + RTCPSenderReportInfo SRinf,SRprevinf; + RTCPReceiverReportInfo RRinf,RRprevinf; + RTPSourceStats stats; + RTCPSDESInfo SDESinf; + + bool isrtpaddrset,isrtcpaddrset; + RTPAddress *rtpaddr,*rtcpaddr; + + RTPTime byetime; + uint8_t *byereason; + size_t byereasonlen; +}; + +inline RTPPacket *RTPSourceData::GetNextPacket() +{ + if (!validated) + return 0; + + RTPPacket *p; + + if (packetlist.empty()) + return 0; + p = *(packetlist.begin()); + packetlist.pop_front(); + return p; +} + +inline void RTPSourceData::FlushPackets() +{ + std::list::const_iterator it; + + for (it = packetlist.begin() ; it != packetlist.end() ; ++it) + RTPDelete(*it,GetMemoryManager()); + packetlist.clear(); +} + +} // end namespace + +#endif // RTPSOURCEDATA_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpsources.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpsources.h new file mode 100644 index 0000000..8ab7779 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpsources.h @@ -0,0 +1,412 @@ +/* + + 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 rtpsources.h + */ + +#ifndef RTPSOURCES_H + +#define RTPSOURCES_H + +#include "rtpconfig.h" +#include "rtpkeyhashtable.h" +#include "rtcpsdespacket.h" +#include "rtptypes.h" +#include "rtpmemoryobject.h" + +#define RTPSOURCES_HASHSIZE 8317 + +namespace jrtplib +{ + +class JRTPLIB_IMPORTEXPORT RTPSources_GetHashIndex +{ +public: + static int GetIndex(const uint32_t &ssrc) { return ssrc%RTPSOURCES_HASHSIZE; } +}; + +class RTPNTPTime; +class RTPTransmitter; +class RTCPAPPPacket; +class RTPInternalSourceData; +class RTPRawPacket; +class RTPPacket; +class RTPTime; +class RTPAddress; +class RTPSourceData; + +/** Represents a table in which information about the participating sources is kept. + * Represents a table in which information about the participating sources is kept. The class has member + * functions to process RTP and RTCP data and to iterate over the participants. Note that a NULL address + * is used to identify packets from our own session. The class also provides some overridable functions + * which can be used to catch certain events (new SSRC, SSRC collision, ...). + */ +class JRTPLIB_IMPORTEXPORT RTPSources : public RTPMemoryObject +{ + JRTPLIB_NO_COPY(RTPSources) +public: + /** Type of probation to use for new sources. */ + enum ProbationType + { + NoProbation, /**< Don't use the probation algorithm; accept RTP packets immediately. */ + ProbationDiscard, /**< Discard incoming RTP packets originating from a source that's on probation. */ + ProbationStore /**< Store incoming RTP packet from a source that's on probation for later retrieval. */ + }; + + /** In the constructor you can select the probation type you'd like to use and also a memory manager. */ + RTPSources(ProbationType = ProbationStore,RTPMemoryManager *mgr = 0); + virtual ~RTPSources(); + + /** Clears the source table. */ + void Clear(); +#ifdef RTP_SUPPORT_PROBATION + /** Changes the current probation type. */ + void SetProbationType(ProbationType probtype) { probationtype = probtype; } +#endif // RTP_SUPPORT_PROBATION + + /** Creates an entry for our own SSRC identifier. */ + int CreateOwnSSRC(uint32_t ssrc); + + /** Deletes the entry for our own SSRC identifier. */ + int DeleteOwnSSRC(); + + /** This function should be called if our own session has sent an RTP packet. + * This function should be called if our own session has sent an RTP packet. + * For our own SSRC entry, the sender flag is updated based upon outgoing packets instead of incoming packets. + */ + void SentRTPPacket(); + + /** Processes a raw packet \c rawpack. + * Processes a raw packet \c rawpack. The instance \c trans will be used to check if this + * packet is one of our own packets. The flag \c acceptownpackets indicates whether own packets should be + * accepted or ignored. + */ + int ProcessRawPacket(RTPRawPacket *rawpack,RTPTransmitter *trans,bool acceptownpackets); + + /** Processes a raw packet \c rawpack. + * Processes a raw packet \c rawpack. Every transmitter in the array \c trans of length \c numtrans + * is used to check if the packet is from our own session. The flag \c acceptownpackets indicates + * whether own packets should be accepted or ignored. + */ + int ProcessRawPacket(RTPRawPacket *rawpack,RTPTransmitter *trans[],int numtrans,bool acceptownpackets); + + /** Processes an RTPPacket instance \c rtppack which was received at time \c receivetime and + * which originated from \c senderaddres. + * Processes an RTPPacket instance \c rtppack which was received at time \c receivetime and + * which originated from \c senderaddres. The \c senderaddress parameter must be NULL if + * the packet was sent by the local participant. The flag \c stored indicates whether the packet + * was stored in the table or not. If so, the \c rtppack instance may not be deleted. + */ + int ProcessRTPPacket(RTPPacket *rtppack,const RTPTime &receivetime,const RTPAddress *senderaddress,bool *stored); + + /** Processes the RTCP compound packet \c rtcpcomppack which was received at time \c receivetime from \c senderaddress. + * Processes the RTCP compound packet \c rtcpcomppack which was received at time \c receivetime from \c senderaddress. + * The \c senderaddress parameter must be NULL if the packet was sent by the local participant. + */ + int ProcessRTCPCompoundPacket(RTCPCompoundPacket *rtcpcomppack,const RTPTime &receivetime, + const RTPAddress *senderaddress); + + /** Process the sender information of SSRC \c ssrc into the source table. + * Process the sender information of SSRC \c ssrc into the source table. The information was received + * at time \c receivetime from address \c senderaddress. The \c senderaddress} parameter must be NULL + * if the packet was sent by the local participant. + */ + int ProcessRTCPSenderInfo(uint32_t ssrc,const RTPNTPTime &ntptime,uint32_t rtptime, + uint32_t packetcount,uint32_t octetcount,const RTPTime &receivetime, + const RTPAddress *senderaddress); + + /** Processes the report block information which was sent by participant \c ssrc into the source table. + * Processes the report block information which was sent by participant \c ssrc into the source table. + * The information was received at time \c receivetime from address \c senderaddress The \c senderaddress + * parameter must be NULL if the packet was sent by the local participant. + */ + int ProcessRTCPReportBlock(uint32_t ssrc,uint8_t fractionlost,int32_t lostpackets, + uint32_t exthighseqnr,uint32_t jitter,uint32_t lsr, + uint32_t dlsr,const RTPTime &receivetime,const RTPAddress *senderaddress); + + /** Processes the non-private SDES item from source \c ssrc into the source table. + * Processes the non-private SDES item from source \c ssrc into the source table. The information was + * received at time \c receivetime from address \c senderaddress. The \c senderaddress parameter must + * be NULL if the packet was sent by the local participant. + */ + int ProcessSDESNormalItem(uint32_t ssrc,RTCPSDESPacket::ItemType t,size_t itemlength, + const void *itemdata,const RTPTime &receivetime,const RTPAddress *senderaddress); +#ifdef RTP_SUPPORT_SDESPRIV + /** Processes the SDES private item from source \c ssrc into the source table. + * Processes the SDES private item from source \c ssrc into the source table. The information was + * received at time \c receivetime from address \c senderaddress. The \c senderaddress + * parameter must be NULL if the packet was sent by the local participant. + */ + int ProcessSDESPrivateItem(uint32_t ssrc,size_t prefixlen,const void *prefixdata, + size_t valuelen,const void *valuedata,const RTPTime &receivetime, + const RTPAddress *senderaddress); +#endif //RTP_SUPPORT_SDESPRIV + /** Processes the BYE message for SSRC \c ssrc. + * Processes the BYE message for SSRC \c ssrc. The information was received at time \c receivetime from + * address \c senderaddress. The \c senderaddress parameter must be NULL if the packet was sent by the + * local participant. + */ + int ProcessBYE(uint32_t ssrc,size_t reasonlength,const void *reasondata,const RTPTime &receivetime, + const RTPAddress *senderaddress); + + /** If we heard from source \c ssrc, but no actual data was added to the source table (for example, if + * no report block was meant for us), this function can e used to indicate that something was received from + * this source. + * If we heard from source \c ssrc, but no actual data was added to the source table (for example, if + * no report block was meant for us), this function can e used to indicate that something was received from + * this source. This will prevent a premature timeout for this participant. The message was received at time + * \c receivetime from address \c senderaddress. The \c senderaddress parameter must be NULL if the + * packet was sent by the local participant. + */ + int UpdateReceiveTime(uint32_t ssrc,const RTPTime &receivetime,const RTPAddress *senderaddress); + + /** Starts the iteration over the participants by going to the first member in the table. + * Starts the iteration over the participants by going to the first member in the table. + * If a member was found, the function returns \c true, otherwise it returns \c false. + */ + bool GotoFirstSource(); + + /** Sets the current source to be the next source in the table. + * Sets the current source to be the next source in the table. If we're already at the last source, + * the function returns \c false, otherwise it returns \c true. + */ + bool GotoNextSource(); + + /** Sets the current source to be the previous source in the table. + * Sets the current source to be the previous source in the table. If we're at the first source, + * the function returns \c false, otherwise it returns \c true. + */ + bool GotoPreviousSource(); + + /** Sets the current source to be the first source in the table which has RTPPacket instances + * that we haven't extracted yet. + * Sets the current source to be the first source in the table which has RTPPacket instances + * that we haven't extracted yet. If no such member was found, the function returns \c false, + * otherwise it returns \c true. + */ + bool GotoFirstSourceWithData(); + + /** Sets the current source to be the next source in the table which has RTPPacket instances that + * we haven't extracted yet. + * Sets the current source to be the next source in the table which has RTPPacket instances that + * we haven't extracted yet. If no such member was found, the function returns \c false, + * otherwise it returns \c true. + */ + bool GotoNextSourceWithData(); + + /** Sets the current source to be the previous source in the table which has RTPPacket instances + * that we haven't extracted yet. + * Sets the current source to be the previous source in the table which has RTPPacket instances + * that we haven't extracted yet. If no such member was found, the function returns \c false, + * otherwise it returns \c true. + */ + bool GotoPreviousSourceWithData(); + + /** Returns the RTPSourceData instance for the currently selected participant. */ + RTPSourceData *GetCurrentSourceInfo(); + + /** Returns the RTPSourceData instance for the participant identified by \c ssrc, or + * NULL if no such entry exists. + */ + RTPSourceData *GetSourceInfo(uint32_t ssrc); + + /** Extracts the next packet from the received packets queue of the current participant. */ + RTPPacket *GetNextPacket(); + + /** Returns \c true if an entry for participant \c ssrc exists and \c false otherwise. */ + bool GotEntry(uint32_t ssrc); + + /** If present, it returns the RTPSourceData instance of the entry which was created by CreateOwnSSRC. */ + RTPSourceData *GetOwnSourceInfo() { return (RTPSourceData *)owndata; } + + /** Assuming that the current time is \c curtime, time out the members from whom we haven't heard + * during the previous time interval \c timeoutdelay. + */ + void Timeout(const RTPTime &curtime,const RTPTime &timeoutdelay); + + /** Assuming that the current time is \c curtime, remove the sender flag for senders from whom we haven't + * received any RTP packets during the previous time interval \c timeoutdelay. + */ + void SenderTimeout(const RTPTime &curtime,const RTPTime &timeoutdelay); + + /** Assuming that the current time is \c curtime, remove the members who sent a BYE packet more than + * the time interval \c timeoutdelay ago. + */ + void BYETimeout(const RTPTime &curtime,const RTPTime &timeoutdelay); + + /** Assuming that the current time is \c curtime, clear the SDES NOTE items which haven't been updated + * during the previous time interval \c timeoutdelay. + */ + void NoteTimeout(const RTPTime &curtime,const RTPTime &timeoutdelay); + + /** Combines the functions SenderTimeout, BYETimeout, Timeout and NoteTimeout. + * Combines the functions SenderTimeout, BYETimeout, Timeout and NoteTimeout. This is more efficient + * than calling all four functions since only one iteration is needed in this function. + */ + void MultipleTimeouts(const RTPTime &curtime,const RTPTime &sendertimeout, + const RTPTime &byetimeout,const RTPTime &generaltimeout, + const RTPTime ¬etimeout); + + /** Returns the number of participants which are marked as a sender. */ + int GetSenderCount() const { return sendercount; } + + /** Returns the total number of entries in the source table. */ + int GetTotalCount() const { return totalcount; } + + /** Returns the number of members which have been validated and which haven't sent a BYE packet yet. */ + int GetActiveMemberCount() const { return activecount; } +#ifdef RTPDEBUG + void Dump(); + void SafeCountTotal(); + void SafeCountSenders(); + void SafeCountActive(); +#endif // RTPDEBUG +protected: + /** Is called when an RTP packet is about to be processed. */ + virtual void OnRTPPacket(RTPPacket *pack,const RTPTime &receivetime, const RTPAddress *senderaddress); + + /** Is called when an RTCP compound packet is about to be processed. */ + virtual void OnRTCPCompoundPacket(RTCPCompoundPacket *pack,const RTPTime &receivetime, + const RTPAddress *senderaddress); + + /** Is called when an SSRC collision was detected. + * Is called when an SSRC collision was detected. The instance \c srcdat is the one present in + * the table, the address \c senderaddress is the one that collided with one of the addresses + * and \c isrtp indicates against which address of \c srcdat the check failed. + */ + virtual void OnSSRCCollision(RTPSourceData *srcdat,const RTPAddress *senderaddress,bool isrtp); + + /** Is called when another CNAME was received than the one already present for source \c srcdat. */ + virtual void OnCNAMECollision(RTPSourceData *srcdat,const RTPAddress *senderaddress, + const uint8_t *cname,size_t cnamelength); + + /** Is called when a new entry \c srcdat is added to the source table. */ + virtual void OnNewSource(RTPSourceData *srcdat); + + /** Is called when the entry \c srcdat is about to be deleted from the source table. */ + virtual void OnRemoveSource(RTPSourceData *srcdat); + + /** Is called when participant \c srcdat is timed out. */ + virtual void OnTimeout(RTPSourceData *srcdat); + + /** Is called when participant \c srcdat is timed after having sent a BYE packet. */ + virtual void OnBYETimeout(RTPSourceData *srcdat); + + /** Is called when a BYE packet has been processed for source \c srcdat. */ + virtual void OnBYEPacket(RTPSourceData *srcdat); + + /** Is called when an RTCP sender report has been processed for this source. */ + virtual void OnRTCPSenderReport(RTPSourceData *srcdat); + + /** Is called when an RTCP receiver report has been processed for this source. */ + virtual void OnRTCPReceiverReport(RTPSourceData *srcdat); + + /** Is called when a specific SDES item was received for this source. */ + virtual void OnRTCPSDESItem(RTPSourceData *srcdat, RTCPSDESPacket::ItemType t, + const void *itemdata, size_t itemlength); +#ifdef RTP_SUPPORT_SDESPRIV + /** Is called when a specific SDES item of 'private' type was received for this source. */ + virtual void OnRTCPSDESPrivateItem(RTPSourceData *srcdat, const void *prefixdata, size_t prefixlen, + const void *valuedata, size_t valuelen); +#endif // RTP_SUPPORT_SDESPRIV + + + /** Is called when an RTCP APP packet \c apppacket has been received at time \c receivetime + * from address \c senderaddress. + */ + virtual void OnAPPPacket(RTCPAPPPacket *apppacket,const RTPTime &receivetime, + const RTPAddress *senderaddress); + + /** Is called when an unknown RTCP packet type was detected. */ + virtual void OnUnknownPacketType(RTCPPacket *rtcppack,const RTPTime &receivetime, + const RTPAddress *senderaddress); + + /** Is called when an unknown packet format for a known packet type was detected. */ + virtual void OnUnknownPacketFormat(RTCPPacket *rtcppack,const RTPTime &receivetime, + const RTPAddress *senderaddress); + + /** Is called when the SDES NOTE item for source \c srcdat has been timed out. */ + virtual void OnNoteTimeout(RTPSourceData *srcdat); + + /** Allows you to use an RTP packet from the specified source directly. + * Allows you to use an RTP packet from the specified source directly. If + * `ispackethandled` is set to `true`, the packet will no longer be stored in this + * source's packet list. */ + virtual void OnValidatedRTPPacket(RTPSourceData *srcdat, RTPPacket *rtppack, bool isonprobation, bool *ispackethandled); +private: + void ClearSourceList(); + int ObtainSourceDataInstance(uint32_t ssrc,RTPInternalSourceData **srcdat,bool *created); + int GetRTCPSourceData(uint32_t ssrc,const RTPAddress *senderaddress,RTPInternalSourceData **srcdat,bool *newsource); + bool CheckCollision(RTPInternalSourceData *srcdat,const RTPAddress *senderaddress,bool isrtp); + + RTPKeyHashTable sourcelist; + + int sendercount; + int totalcount; + int activecount; + +#ifdef RTP_SUPPORT_PROBATION + ProbationType probationtype; +#endif // RTP_SUPPORT_PROBATION + + RTPInternalSourceData *owndata; + + friend class RTPInternalSourceData; +}; + +// Inlining the default implementations to avoid unused-parameter errors. +inline void RTPSources::OnRTPPacket(RTPPacket *, const RTPTime &, const RTPAddress *) { } +inline void RTPSources::OnRTCPCompoundPacket(RTCPCompoundPacket *, const RTPTime &, const RTPAddress *) { } +inline void RTPSources::OnSSRCCollision(RTPSourceData *, const RTPAddress *, bool) { } +inline void RTPSources::OnCNAMECollision(RTPSourceData *, const RTPAddress *, const uint8_t *, size_t) { } +inline void RTPSources::OnNewSource(RTPSourceData *) { } +inline void RTPSources::OnRemoveSource(RTPSourceData *) { } +inline void RTPSources::OnTimeout(RTPSourceData *) { } +inline void RTPSources::OnBYETimeout(RTPSourceData *) { } +inline void RTPSources::OnBYEPacket(RTPSourceData *) { } +inline void RTPSources::OnRTCPSenderReport(RTPSourceData *) { } +inline void RTPSources::OnRTCPReceiverReport(RTPSourceData *) { } +inline void RTPSources::OnRTCPSDESItem(RTPSourceData *, RTCPSDESPacket::ItemType, const void *, size_t) { } +#ifdef RTP_SUPPORT_SDESPRIV +inline void RTPSources::OnRTCPSDESPrivateItem(RTPSourceData *, const void *, size_t, const void *, size_t) { } +#endif // RTP_SUPPORT_SDESPRIV +inline void RTPSources::OnAPPPacket(RTCPAPPPacket *, const RTPTime &, const RTPAddress *) { } +inline void RTPSources::OnUnknownPacketType(RTCPPacket *, const RTPTime &, const RTPAddress *) { } +inline void RTPSources::OnUnknownPacketFormat(RTCPPacket *, const RTPTime &, const RTPAddress *) { } +inline void RTPSources::OnNoteTimeout(RTPSourceData *) { } +inline void RTPSources::OnValidatedRTPPacket(RTPSourceData *, RTPPacket *, bool, bool *) { } + +} // end namespace + +#endif // RTPSOURCES_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpstructs.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpstructs.h new file mode 100644 index 0000000..f1f77d3 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpstructs.h @@ -0,0 +1,128 @@ +/* + + 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 rtpstructs.h + */ + +#ifndef RTPSTRUCTS_H + +#define RTPSTRUCTS_H + +#include "rtpconfig.h" +#include "rtptypes.h" + +namespace jrtplib +{ + +struct RTPHeader +{ +#ifdef RTP_BIG_ENDIAN + uint8_t version:2; + uint8_t padding:1; + uint8_t extension:1; + uint8_t csrccount:4; + + uint8_t marker:1; + uint8_t payloadtype:7; +#else // little endian + uint8_t csrccount:4; + uint8_t extension:1; + uint8_t padding:1; + uint8_t version:2; + + uint8_t payloadtype:7; + uint8_t marker:1; +#endif // RTP_BIG_ENDIAN + + uint16_t sequencenumber; + uint32_t timestamp; + uint32_t ssrc; +}; + +struct RTPExtensionHeader +{ + uint16_t extid; + uint16_t length; +}; + +struct RTPSourceIdentifier +{ + uint32_t ssrc; +}; + +struct RTCPCommonHeader +{ +#ifdef RTP_BIG_ENDIAN + uint8_t version:2; + uint8_t padding:1; + uint8_t count:5; +#else // little endian + uint8_t count:5; + uint8_t padding:1; + uint8_t version:2; +#endif // RTP_BIG_ENDIAN + + uint8_t packettype; + uint16_t length; +}; + +struct RTCPSenderReport +{ + uint32_t ntptime_msw; + uint32_t ntptime_lsw; + uint32_t rtptimestamp; + uint32_t packetcount; + uint32_t octetcount; +}; + +struct RTCPReceiverReport +{ + uint32_t ssrc; // Identifies about which SSRC's data this report is... + uint8_t fractionlost; + uint8_t packetslost[3]; + uint32_t exthighseqnr; + uint32_t jitter; + uint32_t lsr; + uint32_t dlsr; +}; + +struct RTCPSDESHeader +{ + uint8_t sdesid; + uint8_t length; +}; + +} // end namespace + +#endif // RTPSTRUCTS + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtptcpaddress.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtptcpaddress.h new file mode 100644 index 0000000..acc78c3 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtptcpaddress.h @@ -0,0 +1,86 @@ +/* + + 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 rtptcpaddress.h + */ + +#ifndef RTPTCPADDRESS_H + +#define RTPTCPADDRESS_H + +#include "rtpconfig.h" +#include "rtpaddress.h" +#include "rtptypes.h" +#include "rtpsocketutil.h" + +namespace jrtplib +{ + +class RTPMemoryManager; + +/** Represents a TCP 'address' and port. + * This class is used by the TCP transmission component, to specify which sockets + * should be used to send/receive data, and to know on which socket incoming data + * was received. + */ +class JRTPLIB_IMPORTEXPORT RTPTCPAddress : public RTPAddress +{ +public: + /** Creates an instance with which you can use a specific socket + * in the TCP transmitter (must be connected). */ + RTPTCPAddress(SocketType sock):RTPAddress(TCPAddress) + { + m_socket = sock; + } + + ~RTPTCPAddress() { } + + /** Returns the socket that was specified in the constructor. */ + SocketType GetSocket() const { return m_socket; } + + RTPAddress *CreateCopy(RTPMemoryManager *mgr) const; + + // Note that these functions are only used for received packets + bool IsSameAddress(const RTPAddress *addr) const; + bool IsFromSameHost(const RTPAddress *addr) const; +#ifdef RTPDEBUG + std::string GetAddressString() const; +#endif // RTPDEBUG +private: + SocketType m_socket; +}; + +} // end namespace + +#endif // RTPTCPADDRESS_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtptcptransmitter.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtptcptransmitter.h new file mode 100644 index 0000000..2191757 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtptcptransmitter.h @@ -0,0 +1,215 @@ +/* + + 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 rtptcptransmitter.h + */ + +#ifndef RTPTCPTRANSMITTER_H + +#define RTPTCPTRANSMITTER_H + +#include "rtpconfig.h" +#include "rtptransmitter.h" +#include "rtpsocketutil.h" +#include "rtpabortdescriptors.h" +#include +#include +#include + +#ifdef RTP_SUPPORT_THREAD + #include +#endif // RTP_SUPPORT_THREAD + +namespace jrtplib +{ + +/** Parameters for the TCP transmitter. */ +class JRTPLIB_IMPORTEXPORT RTPTCPTransmissionParams : public RTPTransmissionParams +{ +public: + RTPTCPTransmissionParams(); + + /** 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; } + + /** 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: + RTPAbortDescriptors *m_pAbortDesc; +}; + +inline RTPTCPTransmissionParams::RTPTCPTransmissionParams() : RTPTransmissionParams(RTPTransmitter::TCPProto) +{ + m_pAbortDesc = 0; +} + +/** Additional information about the TCP transmitter. */ +class JRTPLIB_IMPORTEXPORT RTPTCPTransmissionInfo : public RTPTransmissionInfo +{ +public: + RTPTCPTransmissionInfo() : RTPTransmissionInfo(RTPTransmitter::TCPProto) { } + ~RTPTCPTransmissionInfo() { } +}; + +// TODO: this is for IPv4, and will only be valid if one rtp packet is in one tcp frame +#define RTPTCPTRANS_HEADERSIZE (20+20+2) // 20 IP, 20 TCP, 2 for framing (RFC 4571) + +/** A TCP transmission component. + * + * This class inherits the RTPTransmitter interface and implements a transmission component + * which uses TCP to send and receive RTP and RTCP data. The component's parameters + * are described by the class RTPTCPTransmissionParams. The functions which have an RTPAddress + * argument require an argument of RTPTCPAddress. The RTPTransmitter::GetTransmissionInfo member function + * returns an instance of type RTPTCPTransmissionInfo. + * + * After this transmission component was created, no data will actually be sent or received + * yet. You can specify over which TCP connections (which must be established first) data + * should be transmitted by using the RTPTransmitter::AddDestination member function. This + * takes an argument of type RTPTCPAddress, with which relevant the socket descriptor can + * be passed to the transmitter. + * + * These sockets will also be used to check for incoming RTP or RTCP data. The RTPTCPAddress + * instance that's associated with a received packet, will contain the socket descriptor + * on which the data was received. This descriptor can be obtained using RTPTCPAddress::GetSocket. + * + * To get notified of an error when sending over or receiving from a socket, override the + * RTPTCPTransmitter::OnSendError and RTPTCPTransmitter::OnReceiveError member functions. + */ +class JRTPLIB_IMPORTEXPORT RTPTCPTransmitter : public RTPTransmitter +{ + JRTPLIB_NO_COPY(RTPTCPTransmitter) +public: + RTPTCPTransmitter(RTPMemoryManager *mgr); + ~RTPTCPTransmitter(); + + 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 RTPTCPTRANS_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(); +#ifdef RTPDEBUG + void Dump(); +#endif // RTPDEBUG +protected: + /** By overriding this function you can be notified of an error when sending over a socket. */ + virtual void OnSendError(SocketType sock); + /** By overriding this function you can be notified of an error when receiving from a socket. */ + virtual void OnReceiveError(SocketType sock); +private: + class SocketData + { + public: + SocketData(); + ~SocketData(); + void Reset(); + + uint8_t m_lengthBuffer[2]; + int m_lengthBufferOffset; + int m_dataLength; + int m_dataBufferOffset; + uint8_t *m_pDataBuffer; + + uint8_t *ExtractDataBuffer() { uint8_t *pTmp = m_pDataBuffer; m_pDataBuffer = 0; return pTmp; } + int ProcessAvailableBytes(SocketType sock, int availLen, bool &complete, RTPMemoryManager *pMgr); + }; + + int SendRTPRTCPData(const void *data,size_t len); + void FlushPackets(); + int PollSocket(SocketType sock, SocketData &sdata); + void ClearDestSockets(); + int ValidateSocket(SocketType s); + + bool m_init; + bool m_created; + bool m_waitingForData; + + std::map m_destSockets; + std::vector m_tmpSocks; + std::vector m_tmpFlags; + std::vector m_localHostname; + size_t m_maxPackSize; + + std::list m_rawpacketlist; + + RTPAbortDescriptors m_abortDesc; + RTPAbortDescriptors *m_pAbortDesc; // in case an external one was specified + +#ifdef RTP_SUPPORT_THREAD + jthread::JMutex m_mainMutex, m_waitMutex; + bool m_threadsafe; +#endif // RTP_SUPPORT_THREAD +}; + +inline void RTPTCPTransmitter::OnSendError(SocketType) { } +inline void RTPTCPTransmitter::OnReceiveError(SocketType) { } + +} // end namespace + +#endif // RTPTCPTRANSMITTER_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtptimeutilities.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtptimeutilities.h new file mode 100644 index 0000000..4a68122 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtptimeutilities.h @@ -0,0 +1,393 @@ +/* + + 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 rtptimeutilities.h + */ + +#ifndef RTPTIMEUTILITIES_H + +#define RTPTIMEUTILITIES_H + +#include "rtpconfig.h" +#include "rtptypes.h" +#ifndef RTP_HAVE_QUERYPERFORMANCECOUNTER + #include + #include + #include +#endif // RTP_HAVE_QUERYPERFORMANCECOUNTER + +#define RTP_NTPTIMEOFFSET 2208988800UL + +#ifdef RTP_HAVE_VSUINT64SUFFIX +#define C1000000 1000000ui64 +#define CEPOCH 11644473600000000ui64 +#else +#define C1000000 1000000ULL +#define CEPOCH 11644473600000000ULL +#endif // RTP_HAVE_VSUINT64SUFFIX + +namespace jrtplib +{ + +/** + * This is a simple wrapper for the most significant word (MSW) and least + * significant word (LSW) of an NTP timestamp. + */ +class JRTPLIB_IMPORTEXPORT RTPNTPTime +{ +public: + /** This constructor creates and instance with MSW \c m and LSW \c l. */ + RTPNTPTime(uint32_t m,uint32_t l) { msw = m ; lsw = l; } + + /** Returns the most significant word. */ + uint32_t GetMSW() const { return msw; } + + /** Returns the least significant word. */ + uint32_t GetLSW() const { return lsw; } +private: + uint32_t msw,lsw; +}; + +/** This class is used to specify wallclock time, delay intervals etc. + * This class is used to specify wallclock time, delay intervals etc. + * It stores a number of seconds and a number of microseconds. + */ +class JRTPLIB_IMPORTEXPORT RTPTime +{ +public: + /** Returns an RTPTime instance representing the current wallclock time. + * Returns an RTPTime instance representing the current wallclock time. This is expressed + * as a number of seconds since 00:00:00 UTC, January 1, 1970. + */ + static RTPTime CurrentTime(); + + /** This function waits the amount of time specified in \c delay. */ + static void Wait(const RTPTime &delay); + + /** Creates an RTPTime instance representing \c t, which is expressed in units of seconds. */ + RTPTime(double t); + + /** Creates an instance that corresponds to \c ntptime. + * Creates an instance that corresponds to \c ntptime. If + * the conversion cannot be made, both the seconds and the + * microseconds are set to zero. + */ + RTPTime(RTPNTPTime ntptime); + + /** Creates an instance corresponding to \c seconds and \c microseconds. */ + RTPTime(int64_t seconds, uint32_t microseconds); + + /** Returns the number of seconds stored in this instance. */ + int64_t GetSeconds() const; + + /** Returns the number of microseconds stored in this instance. */ + uint32_t GetMicroSeconds() const; + + /** Returns the time stored in this instance, expressed in units of seconds. */ + double GetDouble() const { return m_t; } + + /** Returns the NTP time corresponding to the time stored in this instance. */ + RTPNTPTime GetNTPTime() const; + + RTPTime &operator-=(const RTPTime &t); + RTPTime &operator+=(const RTPTime &t); + bool operator<(const RTPTime &t) const; + bool operator>(const RTPTime &t) const; + bool operator<=(const RTPTime &t) const; + bool operator>=(const RTPTime &t) const; + + bool IsZero() const { return m_t == 0; } +private: +#ifdef RTP_HAVE_QUERYPERFORMANCECOUNTER + static inline uint64_t CalculateMicroseconds(uint64_t performancecount,uint64_t performancefrequency); +#endif // RTP_HAVE_QUERYPERFORMANCECOUNTER + + double m_t; +}; + +inline RTPTime::RTPTime(double t) +{ + m_t = t; +} + +inline RTPTime::RTPTime(int64_t seconds, uint32_t microseconds) +{ + if (seconds >= 0) + { + m_t = (double)seconds + 1e-6*(double)microseconds; + } + else + { + int64_t possec = -seconds; + + m_t = (double)possec + 1e-6*(double)microseconds; + m_t = -m_t; + } +} + +inline RTPTime::RTPTime(RTPNTPTime ntptime) +{ + if (ntptime.GetMSW() < RTP_NTPTIMEOFFSET) + { + m_t = 0; + } + else + { + uint32_t sec = ntptime.GetMSW() - RTP_NTPTIMEOFFSET; + + double x = (double)ntptime.GetLSW(); + x /= (65536.0*65536.0); + x *= 1000000.0; + uint32_t microsec = (uint32_t)x; + + m_t = (double)sec + 1e-6*(double)microsec; + } +} + +inline int64_t RTPTime::GetSeconds() const +{ + return (int64_t)m_t; +} + +inline uint32_t RTPTime::GetMicroSeconds() const +{ + uint32_t microsec; + + if (m_t >= 0) + { + int64_t sec = (int64_t)m_t; + microsec = (uint32_t)(1e6*(m_t - (double)sec) + 0.5); + } + else // m_t < 0 + { + int64_t sec = (int64_t)(-m_t); + microsec = (uint32_t)(1e6*((-m_t) - (double)sec) + 0.5); + } + + if (microsec >= 1000000) + return 999999; + // Unsigned, it can never be less than 0 + // if (microsec < 0) + // return 0; + return microsec; +} + +#ifdef RTP_HAVE_QUERYPERFORMANCECOUNTER + +inline uint64_t RTPTime::CalculateMicroseconds(uint64_t performancecount,uint64_t performancefrequency) +{ + uint64_t f = performancefrequency; + uint64_t a = performancecount; + uint64_t b = a/f; + uint64_t c = a%f; // a = b*f+c => (a*1000000)/f = b*1000000+(c*1000000)/f + + return b*C1000000+(c*C1000000)/f; +} + +inline RTPTime RTPTime::CurrentTime() +{ + static int inited = 0; + static uint64_t microseconds, initmicroseconds; + static LARGE_INTEGER performancefrequency; + + uint64_t emulate_microseconds, microdiff; + SYSTEMTIME systemtime; + FILETIME filetime; + + LARGE_INTEGER performancecount; + + QueryPerformanceCounter(&performancecount); + + if(!inited){ + inited = 1; + QueryPerformanceFrequency(&performancefrequency); + GetSystemTime(&systemtime); + SystemTimeToFileTime(&systemtime,&filetime); + microseconds = ( ((uint64_t)(filetime.dwHighDateTime) << 32) + (uint64_t)(filetime.dwLowDateTime) ) / (uint64_t)10; + microseconds-= CEPOCH; // EPOCH + initmicroseconds = CalculateMicroseconds(performancecount.QuadPart, performancefrequency.QuadPart); + } + + emulate_microseconds = CalculateMicroseconds(performancecount.QuadPart, performancefrequency.QuadPart); + + microdiff = emulate_microseconds - initmicroseconds; + + double t = 1e-6*(double)(microseconds + microdiff); + return RTPTime(t); +} + +inline void RTPTime::Wait(const RTPTime &delay) +{ + if (delay.m_t <= 0) + return; + + uint64_t sec = (uint64_t)delay.m_t; + uint32_t microsec = (uint32_t)(1e6*(delay.m_t-(double)sec)); + DWORD t = ((DWORD)sec)*1000+(((DWORD)microsec)/1000); + Sleep(t); +} + +#else // unix style + +#ifdef RTP_HAVE_CLOCK_GETTIME +inline double RTPTime_timespecToDouble(struct timespec &ts) +{ + return (double)ts.tv_sec + 1e-9*(double)ts.tv_nsec; +} + +inline RTPTime RTPTime::CurrentTime() +{ + static bool s_initialized = false; + static double s_startOffet = 0; + + if (!s_initialized) + { + s_initialized = true; + + // Get the corresponding times in system time and monotonic time + struct timespec tpSys, tpMono; + + clock_gettime(CLOCK_REALTIME, &tpSys); + clock_gettime(CLOCK_MONOTONIC, &tpMono); + + double tSys = RTPTime_timespecToDouble(tpSys); + double tMono = RTPTime_timespecToDouble(tpMono); + + s_startOffet = tSys - tMono; + return tSys; + } + + struct timespec tpMono; + clock_gettime(CLOCK_MONOTONIC, &tpMono); + + double tMono0 = RTPTime_timespecToDouble(tpMono); + return tMono0 + s_startOffet; +} + +#else // gettimeofday fallback + +inline RTPTime RTPTime::CurrentTime() +{ + struct timeval tv; + + gettimeofday(&tv,0); + return RTPTime((uint64_t)tv.tv_sec,(uint32_t)tv.tv_usec); +} +#endif // RTP_HAVE_CLOCK_GETTIME + +inline void RTPTime::Wait(const RTPTime &delay) +{ + if (delay.m_t <= 0) + return; + + uint64_t sec = (uint64_t)delay.m_t; + uint64_t nanosec = (uint32_t)(1e9*(delay.m_t-(double)sec)); + + struct timespec req,rem; + int ret; + + req.tv_sec = (time_t)sec; + req.tv_nsec = ((long)nanosec); + do + { + ret = nanosleep(&req,&rem); + req = rem; + } while (ret == -1 && errno == EINTR); +} + +#endif // RTP_HAVE_QUERYPERFORMANCECOUNTER + +inline RTPTime &RTPTime::operator-=(const RTPTime &t) +{ + m_t -= t.m_t; + return *this; +} + +inline RTPTime &RTPTime::operator+=(const RTPTime &t) +{ + m_t += t.m_t; + return *this; +} + +inline RTPNTPTime RTPTime::GetNTPTime() const +{ + uint32_t sec = (uint32_t)m_t; + uint32_t microsec = (uint32_t)((m_t - (double)sec)*1e6); + + uint32_t msw = sec+RTP_NTPTIMEOFFSET; + uint32_t lsw; + double x; + + x = microsec/1000000.0; + x *= (65536.0*65536.0); + lsw = (uint32_t)x; + + return RTPNTPTime(msw,lsw); +} + +inline bool RTPTime::operator<(const RTPTime &t) const +{ + return m_t < t.m_t; +} + +inline bool RTPTime::operator>(const RTPTime &t) const +{ + return m_t > t.m_t; +} + +inline bool RTPTime::operator<=(const RTPTime &t) const +{ + return m_t <= t.m_t; +} + +inline bool RTPTime::operator>=(const RTPTime &t) const +{ + return m_t >= t.m_t; +} + +class JRTPLIB_IMPORTEXPORT RTPTimeInitializerObject +{ +public: + RTPTimeInitializerObject(); + void Dummy() { dummy++; } +private: + int dummy; +}; + +extern RTPTimeInitializerObject timeinit; + +} // end namespace + + +#endif // RTPTIMEUTILITIES_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtptransmitter.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtptransmitter.h new file mode 100644 index 0000000..3f29417 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtptransmitter.h @@ -0,0 +1,263 @@ +/* + + 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 rtptransmitter.h + */ + +#ifndef RTPTRANSMITTER_H + +#define RTPTRANSMITTER_H + +#include "rtpconfig.h" +#include "rtptypes.h" +#include "rtpmemoryobject.h" +#include "rtptimeutilities.h" + +namespace jrtplib +{ + +class RTPRawPacket; +class RTPAddress; +class RTPTransmissionParams; +class RTPTime; +class RTPTransmissionInfo; + +/** Abstract class from which actual transmission components should be derived. + * Abstract class from which actual transmission components should be derived. + * The abstract class RTPTransmitter specifies the interface for + * actual transmission components. Currently, three implementations exist: + * an UDP over IPv4 transmitter, an UDP over IPv6 transmitter and a transmitter + * which can be used to use an external transmission mechanism. + */ +class JRTPLIB_IMPORTEXPORT RTPTransmitter : public RTPMemoryObject +{ +public: + /** Used to identify a specific transmitter. + * If UserDefinedProto is used in the RTPSession::Create function, the RTPSession + * virtual member function NewUserDefinedTransmitter will be called to create + * a transmission component. + */ + enum TransmissionProtocol + { + IPv4UDPProto, /**< Specifies the internal UDP over IPv4 transmitter. */ + IPv6UDPProto, /**< Specifies the internal UDP over IPv6 transmitter. */ + TCPProto, /**< Specifies the internal TCP transmitter. */ + ExternalProto, /**< Specifies the transmitter which can send packets using an external mechanism, and which can have received packets injected into it - see RTPExternalTransmitter for additional information. */ + UserDefinedProto /**< Specifies a user defined, external transmitter. */ + }; + + /** Three kind of receive modes can be specified. */ + enum ReceiveMode + { + AcceptAll, /**< All incoming data is accepted, no matter where it originated from. */ + AcceptSome, /**< Only data coming from specific sources will be accepted. */ + IgnoreSome /**< All incoming data is accepted, except for data coming from a specific set of sources. */ + }; +protected: + /** Constructor in which you can specify a memory manager to use. */ + RTPTransmitter(RTPMemoryManager *mgr) : RTPMemoryObject(mgr) { timeinit.Dummy(); } +public: + virtual ~RTPTransmitter() { } + + /** This function must be called before the transmission component can be used. + * This function must be called before the transmission component can be used. Depending on + * the value of \c threadsafe, the component will be created for thread-safe usage or not. + */ + virtual int Init(bool threadsafe) = 0; + + /** Prepares the component to be used. + * Prepares the component to be used. The parameter \c maxpacksize specifies the maximum size + * a packet can have: if the packet is larger it will not be transmitted. The \c transparams + * parameter specifies a pointer to an RTPTransmissionParams instance. This is also an abstract + * class and each actual component will define its own parameters by inheriting a class + * from RTPTransmissionParams. If \c transparams is NULL, the default transmission parameters + * for the component will be used. + */ + virtual int Create(size_t maxpacksize,const RTPTransmissionParams *transparams) = 0; + + /** By calling this function, buffers are cleared and the component cannot be used anymore. + * By calling this function, buffers are cleared and the component cannot be used anymore. + * Only when the Create function is called again can the component be used again. */ + virtual void Destroy() = 0; + + /** Returns additional information about the transmitter. + * This function returns an instance of a subclass of RTPTransmissionInfo which will give + * some additional information about the transmitter (a list of local IP addresses for example). + * Currently, either an instance of RTPUDPv4TransmissionInfo or RTPUDPv6TransmissionInfo is + * returned, depending on the type of the transmitter. The user has to deallocate the returned + * instance when it is no longer needed, which can be done using RTPTransmitter::DeleteTransmissionInfo. + */ + virtual RTPTransmissionInfo *GetTransmissionInfo() = 0; + + /** Deallocates the information returned by RTPTransmitter::GetTransmissionInfo . + * Deallocates the information returned by RTPTransmitter::GetTransmissionInfo . + */ + virtual void DeleteTransmissionInfo(RTPTransmissionInfo *inf) = 0; + + /** Looks up the local host name. + * Looks up the local host name based upon internal information about the local host's + * addresses. This function might take some time since a DNS query might be done. \c bufferlength + * should initially contain the number of bytes that may be stored in \c buffer. If the function + * succeeds, \c bufferlength is set to the number of bytes stored in \c buffer. Note that the data + * in \c buffer is not NULL-terminated. If the function fails because the buffer isn't large enough, + * it returns \c ERR_RTP_TRANS_BUFFERLENGTHTOOSMALL and stores the number of bytes needed in + * \c bufferlength. + */ + virtual int GetLocalHostName(uint8_t *buffer,size_t *bufferlength) = 0; + + /** Returns \c true if the address specified by \c addr is one of the addresses of the transmitter. */ + virtual bool ComesFromThisTransmitter(const RTPAddress *addr) = 0; + + /** Returns the amount of bytes that will be added to the RTP packet by the underlying layers (excluding + * the link layer). */ + virtual size_t GetHeaderOverhead() = 0; + + /** Checks for incoming data and stores it. */ + virtual int Poll() = 0; + + /** Waits until incoming data is detected. + * Waits at most a time \c delay until incoming data has been detected. If \c dataavailable is not NULL, + * it should be set to \c true if data was actually read and to \c false otherwise. + */ + virtual int WaitForIncomingData(const RTPTime &delay,bool *dataavailable = 0) = 0; + + /** If the previous function has been called, this one aborts the waiting. */ + virtual int AbortWait() = 0; + + /** Send a packet with length \c len containing \c data to all RTP addresses of the current destination list. */ + virtual int SendRTPData(const void *data,size_t len) = 0; + + /** Send a packet with length \c len containing \c data to all RTCP addresses of the current destination list. */ + virtual int SendRTCPData(const void *data,size_t len) = 0; + + /** Adds the address specified by \c addr to the list of destinations. */ + virtual int AddDestination(const RTPAddress &addr) = 0; + + /** Deletes the address specified by \c addr from the list of destinations. */ + virtual int DeleteDestination(const RTPAddress &addr) = 0; + + /** Clears the list of destinations. */ + virtual void ClearDestinations() = 0; + + /** Returns \c true if the transmission component supports multicasting. */ + virtual bool SupportsMulticasting() = 0; + + /** Joins the multicast group specified by \c addr. */ + virtual int JoinMulticastGroup(const RTPAddress &addr) = 0; + + /** Leaves the multicast group specified by \c addr. */ + virtual int LeaveMulticastGroup(const RTPAddress &addr) = 0; + + /** Leaves all the multicast groups that have been joined. */ + virtual void LeaveAllMulticastGroups() = 0; + + /** Sets the receive mode. + * Sets the receive mode to \c m, which is one of the following: RTPTransmitter::AcceptAll, + * RTPTransmitter::AcceptSome or RTPTransmitter::IgnoreSome. Note that if the receive + * mode is changed, all information about the addresses to ignore to accept is lost. + */ + virtual int SetReceiveMode(RTPTransmitter::ReceiveMode m) = 0; + + /** Adds \c addr to the list of addresses to ignore. */ + virtual int AddToIgnoreList(const RTPAddress &addr) = 0; + + /** Deletes \c addr from the list of addresses to accept. */ + virtual int DeleteFromIgnoreList(const RTPAddress &addr)= 0; + + /** Clears the list of addresses to ignore. */ + virtual void ClearIgnoreList() = 0; + + /** Adds \c addr to the list of addresses to accept. */ + virtual int AddToAcceptList(const RTPAddress &addr) = 0; + + /** Deletes \c addr from the list of addresses to accept. */ + virtual int DeleteFromAcceptList(const RTPAddress &addr) = 0; + + /** Clears the list of addresses to accept. */ + virtual void ClearAcceptList() = 0; + + /** Sets the maximum packet size which the transmitter should allow to \c s. */ + virtual int SetMaximumPacketSize(size_t s) = 0; + + /** Returns \c true if packets can be obtained using the GetNextPacket member function. */ + virtual bool NewDataAvailable() = 0; + + /** Returns the raw data of a received RTP packet (received during the Poll function) + * in an RTPRawPacket instance. */ + virtual RTPRawPacket *GetNextPacket() = 0; +#ifdef RTPDEBUG + virtual void Dump() = 0; +#endif // RTPDEBUG +}; + +/** Base class for transmission parameters. + * This class is an abstract class which will have a specific implementation for a + * specific kind of transmission component. All actual implementations inherit the + * GetTransmissionProtocol function which identifies the component type for which + * these parameters are valid. + */ +class JRTPLIB_IMPORTEXPORT RTPTransmissionParams +{ +protected: + RTPTransmissionParams(RTPTransmitter::TransmissionProtocol p) { protocol = p; } +public: + virtual ~RTPTransmissionParams() { } + + /** Returns the transmitter type for which these parameters are valid. */ + RTPTransmitter::TransmissionProtocol GetTransmissionProtocol() const { return protocol; } +private: + RTPTransmitter::TransmissionProtocol protocol; +}; + +/** Base class for additional information about the transmitter. + * This class is an abstract class which will have a specific implementation for a + * specific kind of transmission component. All actual implementations inherit the + * GetTransmissionProtocol function which identifies the component type for which + * these parameters are valid. + */ +class JRTPLIB_IMPORTEXPORT RTPTransmissionInfo +{ +protected: + RTPTransmissionInfo(RTPTransmitter::TransmissionProtocol p) { protocol = p; } +public: + virtual ~RTPTransmissionInfo() { } + /** Returns the transmitter type for which these parameters are valid. */ + RTPTransmitter::TransmissionProtocol GetTransmissionProtocol() const { return protocol; } +private: + RTPTransmitter::TransmissionProtocol protocol; +}; + +} // end namespace + +#endif // RTPTRANSMITTER_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtptypes.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtptypes.h new file mode 100644 index 0000000..1612388 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtptypes.h @@ -0,0 +1,5 @@ +#include "rtpconfig.h" + + +#include +#include diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtptypes_win.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtptypes_win.h new file mode 100644 index 0000000..350e061 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtptypes_win.h @@ -0,0 +1,53 @@ +/* + + 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. + +*/ + +#ifndef RTPTYPES_WIN_H + +#define RTPTYPES_WIN_H + +#ifndef INTTYPES_DEFINED + +#define INTTYPES_DEFINED + +typedef char int8_t; +typedef unsigned char uint8_t; +typedef short int16_t; +typedef unsigned short uint16_t; +typedef int int32_t; +typedef unsigned int uint32_t; +typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; + +#endif // INTTYPES_DEFINED + +#endif // RTPTYPES_WIN_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpudpv4transmitter.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpudpv4transmitter.h new file mode 100644 index 0000000..144ec8c --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpudpv4transmitter.h @@ -0,0 +1,365 @@ +/* + + 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 rtpudpv4transmitter.h + */ + +#ifndef RTPUDPV4TRANSMITTER_H + +#define RTPUDPV4TRANSMITTER_H + +#include "rtpconfig.h" +#include "rtptransmitter.h" +#include "rtpipv4destination.h" +#include "rtphashtable.h" +#include "rtpkeyhashtable.h" +#include "rtpsocketutil.h" +#include "rtpabortdescriptors.h" +#include + +#ifdef RTP_SUPPORT_THREAD + #include +#endif // RTP_SUPPORT_THREAD + +#define RTPUDPV4TRANS_HASHSIZE 8317 +#define RTPUDPV4TRANS_DEFAULTPORTBASE 5000 + +#define RTPUDPV4TRANS_RTPRECEIVEBUFFER 32768 +#define RTPUDPV4TRANS_RTCPRECEIVEBUFFER 32768 +#define RTPUDPV4TRANS_RTPTRANSMITBUFFER 32768 +#define RTPUDPV4TRANS_RTCPTRANSMITBUFFER 32768 + +namespace jrtplib +{ + +/** Parameters for the UDP over IPv4 transmitter. */ +class JRTPLIB_IMPORTEXPORT RTPUDPv4TransmissionParams : public RTPTransmissionParams +{ +public: + RTPUDPv4TransmissionParams(); + + /** Sets the IP address which is used to bind the sockets to \c ip. */ + void SetBindIP(uint32_t ip) { bindIP = ip; } + + /** Sets the multicast interface IP address. */ + void SetMulticastInterfaceIP(uint32_t ip) { mcastifaceIP = ip; } + + /** Sets the RTP portbase to \c pbase, which has to be an even number + * unless RTPUDPv4TransmissionParams::SetAllowOddPortbase was called; + * a port number of zero will cause a port to be chosen automatically. */ + 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 &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. */ + uint32_t GetBindIP() const { return bindIP; } + + /** Returns the multicast interface IP address. */ + uint32_t GetMulticastInterfaceIP() const { return mcastifaceIP; } + + /** 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 &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; } + + /** Enables or disables multiplexing RTCP traffic over the RTP channel, so that only a single port is used. */ + void SetRTCPMultiplexing(bool f) { rtcpmux = f; } + + /** Can be used to allow the RTP port base to be any number, not just even numbers. */ + void SetAllowOddPortbase(bool f) { allowoddportbase = f; } + + /** Force the RTCP socket to use a specific port, not necessarily one more than + * the RTP port (set this to zero to disable). */ + void SetForcedRTCPPort(uint16_t rtcpport) { forcedrtcpport = rtcpport; } + + /** Use sockets that have already been created, no checks on port numbers + * will be done, and no buffer sizes will be set; you'll need to close + * the sockets yourself when done, it will **not** be done automatically. */ + void SetUseExistingSockets(SocketType rtpsocket, SocketType rtcpsocket) { rtpsock = rtpsocket; rtcpsock = rtcpsocket; useexistingsockets = true; } + + /** 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; } + + /** Returns a flag indicating if RTCP traffic will be multiplexed over the RTP channel. */ + bool GetRTCPMultiplexing() const { return rtcpmux; } + + /** If true, any RTP portbase will be allowed, not just even numbers. */ + bool GetAllowOddPortbase() const { return allowoddportbase; } + + /** If non-zero, the specified port will be used to receive RTCP traffic. */ + uint16_t GetForcedRTCPPort() const { return forcedrtcpport; } + + /** Returns true and fills in sockets if existing sockets were set + * using RTPUDPv4TransmissionParams::SetUseExistingSockets. */ + bool GetUseExistingSockets(SocketType &rtpsocket, SocketType &rtcpsocket) const { if (!useexistingsockets) return false; rtpsocket = rtpsock; rtcpsocket = rtcpsock; return true; } + + /** 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; + uint32_t bindIP, mcastifaceIP; + std::list localIPs; + uint8_t multicastTTL; + int rtpsendbuf, rtprecvbuf; + int rtcpsendbuf, rtcprecvbuf; + bool rtcpmux; + bool allowoddportbase; + uint16_t forcedrtcpport; + + SocketType rtpsock, rtcpsock; + bool useexistingsockets; + + RTPAbortDescriptors *m_pAbortDesc; +}; + +inline RTPUDPv4TransmissionParams::RTPUDPv4TransmissionParams() : RTPTransmissionParams(RTPTransmitter::IPv4UDPProto) +{ + portbase = RTPUDPV4TRANS_DEFAULTPORTBASE; + bindIP = 0; + multicastTTL = 1; + mcastifaceIP = 0; + rtpsendbuf = RTPUDPV4TRANS_RTPTRANSMITBUFFER; + rtprecvbuf = RTPUDPV4TRANS_RTPRECEIVEBUFFER; + rtcpsendbuf = RTPUDPV4TRANS_RTCPTRANSMITBUFFER; + rtcprecvbuf = RTPUDPV4TRANS_RTCPRECEIVEBUFFER; + rtcpmux = false; + allowoddportbase = false; + forcedrtcpport = 0; + useexistingsockets = false; + rtpsock = 0; + rtcpsock = 0; + m_pAbortDesc = 0; +} + +/** Additional information about the UDP over IPv4 transmitter. */ +class JRTPLIB_IMPORTEXPORT RTPUDPv4TransmissionInfo : public RTPTransmissionInfo +{ +public: + RTPUDPv4TransmissionInfo(std::list iplist,SocketType rtpsock,SocketType rtcpsock, + uint16_t rtpport, uint16_t rtcpport) : RTPTransmissionInfo(RTPTransmitter::IPv4UDPProto) + { localIPlist = iplist; rtpsocket = rtpsock; rtcpsocket = rtcpsock; m_rtpPort = rtpport; m_rtcpPort = rtcpport; } + + ~RTPUDPv4TransmissionInfo() { } + + /** Returns the list of IPv4 addresses the transmitter considers to be the local IP addresses. */ + std::list 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 localIPlist; + SocketType rtpsocket,rtcpsocket; + uint16_t m_rtpPort, m_rtcpPort; +}; + +class JRTPLIB_IMPORTEXPORT RTPUDPv4Trans_GetHashIndex_IPv4Dest +{ +public: + static int GetIndex(const RTPIPv4Destination &d) { return d.GetIP()%RTPUDPV4TRANS_HASHSIZE; } +}; + +class JRTPLIB_IMPORTEXPORT RTPUDPv4Trans_GetHashIndex_uint32_t +{ +public: + static int GetIndex(const uint32_t &k) { return k%RTPUDPV4TRANS_HASHSIZE; } +}; + +#define RTPUDPV4TRANS_HEADERSIZE (20+8) + +/** An UDP over IPv4 transmission component. + * This class inherits the RTPTransmitter interface and implements a transmission component + * which uses UDP over IPv4 to send and receive RTP and RTCP data. The component's parameters + * are described by the class RTPUDPv4TransmissionParams. The functions which have an RTPAddress + * argument require an argument of RTPIPv4Address. The GetTransmissionInfo member function + * returns an instance of type RTPUDPv4TransmissionInfo. + */ +class JRTPLIB_IMPORTEXPORT RTPUDPv4Transmitter : public RTPTransmitter +{ + JRTPLIB_NO_COPY(RTPUDPv4Transmitter) +public: + RTPUDPv4Transmitter(RTPMemoryManager *mgr); + ~RTPUDPv4Transmitter(); + + 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 RTPUDPV4TRANS_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(); +#ifdef RTPDEBUG + void Dump(); +#endif // RTPDEBUG +private: + int CreateLocalIPList(); + bool GetLocalIPList_Interfaces(); + void GetLocalIPList_DNS(); + void AddLoopbackAddress(); + void FlushPackets(); + int PollSocket(bool rtp); + int ProcessAddAcceptIgnoreEntry(uint32_t ip,uint16_t port); + int ProcessDeleteAcceptIgnoreEntry(uint32_t ip,uint16_t port); +#ifdef RTP_SUPPORT_IPV4MULTICAST + bool SetMulticastTTL(uint8_t ttl); +#endif // RTP_SUPPORT_IPV4MULTICAST + bool ShouldAcceptData(uint32_t srcip,uint16_t srcport); + void ClearAcceptIgnoreInfo(); + + bool init; + bool created; + bool waitingfordata; + SocketType rtpsock,rtcpsock; + uint32_t mcastifaceIP; + std::list localIPs; + uint16_t m_rtpPort, m_rtcpPort; + uint8_t multicastTTL; + RTPTransmitter::ReceiveMode receivemode; + + uint8_t *localhostname; + size_t localhostnamelength; + + RTPHashTable destinations; +#ifdef RTP_SUPPORT_IPV4MULTICAST + RTPHashTable multicastgroups; +#endif // RTP_SUPPORT_IPV4MULTICAST + std::list rawpacketlist; + + bool supportsmulticasting; + size_t maxpacksize; + + class PortInfo + { + public: + PortInfo() { all = false; } + + bool all; + std::list portlist; + }; + + RTPKeyHashTable acceptignoreinfo; + + bool closesocketswhendone; + RTPAbortDescriptors m_abortDesc; + RTPAbortDescriptors *m_pAbortDesc; // in case an external one was specified + +#ifdef RTP_SUPPORT_THREAD + jthread::JMutex mainmutex,waitmutex; + int threadsafe; +#endif // RTP_SUPPORT_THREAD +}; + +} // end namespace + +#endif // RTPUDPV4TRANSMITTER_H + diff --git a/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpudpv6transmitter.h b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpudpv6transmitter.h new file mode 100644 index 0000000..9b9432e --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/include/jrtplib3/rtpudpv6transmitter.h @@ -0,0 +1,333 @@ +/* + + 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 +#include + +#ifdef RTP_SUPPORT_THREAD + #include +#endif // RTP_SUPPORT_THREAD + +#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 jrtplib +{ + +/** 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 &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 &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 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 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 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 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 +{ + JRTPLIB_NO_COPY(RTPUDPv6Transmitter) +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(); +#ifdef RTPDEBUG + void Dump(); +#endif // RTPDEBUG +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 localIPs; + uint16_t portbase; + uint8_t multicastTTL; + RTPTransmitter::ReceiveMode receivemode; + + uint8_t *localhostname; + size_t localhostnamelength; + + RTPHashTable destinations; +#ifdef RTP_SUPPORT_IPV6MULTICAST + RTPHashTable multicastgroups; +#endif // RTP_SUPPORT_IPV6MULTICAST + std::list rawpacketlist; + + bool supportsmulticasting; + size_t maxpacksize; + + class PortInfo + { + public: + PortInfo() { all = false; } + + bool all; + std::list portlist; + }; + + RTPKeyHashTable acceptignoreinfo; + RTPAbortDescriptors m_abortDesc; + RTPAbortDescriptors *m_pAbortDesc; + +#ifdef RTP_SUPPORT_THREAD + jthread::JMutex mainmutex,waitmutex; + int threadsafe; +#endif // RTP_SUPPORT_THREAD +}; + +} // end namespace + +#endif // RTP_SUPPORT_IPV6 + +#endif // RTPUDPV6TRANSMITTER_H + diff --git a/3rdparty/jrtp_export/jrtplib/lib/cmake/JRTPLIB/JRTPLIBConfig.cmake b/3rdparty/jrtp_export/jrtplib/lib/cmake/JRTPLIB/JRTPLIBConfig.cmake new file mode 100644 index 0000000..9cc5878 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/lib/cmake/JRTPLIB/JRTPLIBConfig.cmake @@ -0,0 +1,7 @@ + +set(JRTPLIB_FOUND 1) + +set(JRTPLIB_INCLUDE_DIRS "/mnt/e/fiss/gb28181_stack/jrtplib_linux/export/jrtplib/include") + +set(JRTPLIB_LIBRARIES "-L/mnt/e/fiss/gb28181_stack/jrtplib_linux/export/jrtplib/lib" "-ljrtp") + diff --git a/3rdparty/jrtp_export/jrtplib/lib/libjrtp.a b/3rdparty/jrtp_export/jrtplib/lib/libjrtp.a new file mode 100644 index 0000000..a537c00 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/lib/libjrtp.a diff --git a/3rdparty/jrtp_export/jrtplib/lib/libjrtp.so b/3rdparty/jrtp_export/jrtplib/lib/libjrtp.so new file mode 100644 index 0000000..cd55d8d --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/lib/libjrtp.so diff --git a/3rdparty/jrtp_export/jrtplib/lib/libjrtp.so.3.11.2 b/3rdparty/jrtp_export/jrtplib/lib/libjrtp.so.3.11.2 new file mode 100644 index 0000000..cd55d8d --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/lib/libjrtp.so.3.11.2 diff --git a/3rdparty/jrtp_export/jrtplib/lib/pkgconfig/jrtplib.pc b/3rdparty/jrtp_export/jrtplib/lib/pkgconfig/jrtplib.pc new file mode 100644 index 0000000..96a26d2 --- /dev/null +++ b/3rdparty/jrtp_export/jrtplib/lib/pkgconfig/jrtplib.pc @@ -0,0 +1,6 @@ +Name: Jrtplib +Description: A full featured RTP library +Requires: +Version: 3.11.2 +Libs: -L/mnt/e/fiss/gb28181_stack/jrtplib_linux/export/jrtplib/lib -ljrtp +Cflags: -I/mnt/e/fiss/gb28181_stack/jrtplib_linux/export/jrtplib/include diff --git a/3rdparty/jrtp_export/jthread/include/jthread/jmutex.h b/3rdparty/jrtp_export/jthread/include/jthread/jmutex.h new file mode 100644 index 0000000..c28445d --- /dev/null +++ b/3rdparty/jrtp_export/jthread/include/jthread/jmutex.h @@ -0,0 +1,75 @@ +/* + + This file is a part of the JThread package, which contains some object- + oriented thread wrappers for different thread implementations. + + Copyright (c) 2000-2017 Jori Liesenborgs (jori.liesenborgs@gmail.com) + + 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. + +*/ + +#ifndef JTHREAD_JMUTEX_H + +#define JTHREAD_JMUTEX_H + +#include "jthreadconfig.h" +#ifdef JTHREAD_CONFIG_WIN32THREADS + #ifndef _WIN32_WCE + #include + #endif // _WIN32_WCE + #include + #include +#else // using pthread + #include +#endif // JTHREAD_CONFIG_WIN32THREADS + +#define ERR_JMUTEX_ALREADYINIT -1 +#define ERR_JMUTEX_NOTINIT -2 +#define ERR_JMUTEX_CANTCREATEMUTEX -3 + +namespace jthread +{ + +class JTHREAD_IMPORTEXPORT JMutex +{ +public: + JMutex(); + ~JMutex(); + int Init(); + int Lock(); + int Unlock(); + bool IsInitialized() { return initialized; } +private: +#ifdef JTHREAD_CONFIG_WIN32THREADS +#ifdef JTHREAD_CONFIG_JMUTEXCRITICALSECTION + CRITICAL_SECTION mutex; +#else // Use standard mutex + HANDLE mutex; +#endif // JTHREAD_CONFIG_JMUTEXCRITICALSECTION +#else // pthread mutex + pthread_mutex_t mutex; +#endif // JTHREAD_CONFIG_WIN32THREADS + bool initialized; +}; + +} // end namespace + +#endif // JTHREAD_JMUTEX_H + diff --git a/3rdparty/jrtp_export/jthread/include/jthread/jmutexautolock.h b/3rdparty/jrtp_export/jthread/include/jthread/jmutexautolock.h new file mode 100644 index 0000000..8e2981f --- /dev/null +++ b/3rdparty/jrtp_export/jthread/include/jthread/jmutexautolock.h @@ -0,0 +1,50 @@ +/* + + This file is a part of the JThread package, which contains some object- + oriented thread wrappers for different thread implementations. + + Copyright (c) 2000-2017 Jori Liesenborgs (jori.liesenborgs@gmail.com) + + 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. + +*/ + +#ifndef JTHREAD_JMUTEXAUTOLOCK_H + +#define JTHREAD_JMUTEXAUTOLOCK_H + +#include "jthreadconfig.h" +#include "jmutex.h" + +namespace jthread +{ + +class JTHREAD_IMPORTEXPORT JMutexAutoLock +{ +public: + JMutexAutoLock(JMutex &m) : mutex(m) { mutex.Lock(); } + ~JMutexAutoLock() { mutex.Unlock(); } +private: + JMutex &mutex; +}; + +} // end namespace + +#endif // JTHREAD_JMUTEXAUTOLOCK_H + diff --git a/3rdparty/jrtp_export/jthread/include/jthread/jthread.h b/3rdparty/jrtp_export/jthread/include/jthread/jthread.h new file mode 100644 index 0000000..4002d42 --- /dev/null +++ b/3rdparty/jrtp_export/jthread/include/jthread/jthread.h @@ -0,0 +1,84 @@ +/* + + This file is a part of the JThread package, which contains some object- + oriented thread wrappers for different thread implementations. + + Copyright (c) 2000-2017 Jori Liesenborgs (jori.liesenborgs@gmail.com) + + 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. + +*/ + +#ifndef JTHREAD_JTHREAD_H + +#define JTHREAD_JTHREAD_H + +#include "jthreadconfig.h" +#include "jmutex.h" + +#define ERR_JTHREAD_CANTINITMUTEX -1 +#define ERR_JTHREAD_CANTSTARTTHREAD -2 +#define ERR_JTHREAD_THREADFUNCNOTSET -3 +#define ERR_JTHREAD_NOTRUNNING -4 +#define ERR_JTHREAD_ALREADYRUNNING -5 + +namespace jthread +{ + +class JTHREAD_IMPORTEXPORT JThread +{ +public: + JThread(); + virtual ~JThread(); + int Start(); + int Kill(); + virtual void *Thread() = 0; + bool IsRunning(); + void *GetReturnValue(); + bool IsSameThread(); +protected: + void ThreadStarted(); +private: + +#ifdef JTHREAD_CONFIG_WIN32THREADS +#ifdef _WIN32_WCE + DWORD threadid; + static DWORD WINAPI TheThread(void *param); +#else + static UINT __stdcall TheThread(void *param); + UINT threadid; +#endif // _WIN32_WCE + HANDLE threadhandle; +#else // pthread type threads + static void *TheThread(void *param); + + pthread_t threadid; +#endif // JTHREAD_CONFIG_WIN32THREADS + void *retval; + bool running; + + JMutex runningmutex; + JMutex continuemutex,continuemutex2; + bool mutexinit; +}; + +} // end namespace + +#endif // JTHREAD_JTHREAD_H + diff --git a/3rdparty/jrtp_export/jthread/include/jthread/jthreadconfig.h b/3rdparty/jrtp_export/jthread/include/jthread/jthreadconfig.h new file mode 100644 index 0000000..7519a3e --- /dev/null +++ b/3rdparty/jrtp_export/jthread/include/jthread/jthreadconfig.h @@ -0,0 +1,45 @@ +/* + + This file is a part of the JThread package, which contains some object- + oriented thread wrappers for different thread implementations. + + Copyright (c) 2000-2017 Jori Liesenborgs (jori.liesenborgs@gmail.com) + + 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. + +*/ + +#ifndef JTHREADCONFIG_H + +#define JTHREADCONFIG_H + +#define JTHREAD_IMPORT +#define JTHREAD_EXPORT +#ifdef JTHREAD_COMPILING + #define JTHREAD_IMPORTEXPORT JTHREAD_EXPORT +#else + #define JTHREAD_IMPORTEXPORT JTHREAD_IMPORT +#endif // JTHREAD_COMPILING + +// Using pthread based threads + + + +#endif // JTHREADCONFIG_H + diff --git a/3rdparty/jrtp_export/jthread/lib/cmake/JThread/JThreadConfig.cmake b/3rdparty/jrtp_export/jthread/lib/cmake/JThread/JThreadConfig.cmake new file mode 100644 index 0000000..2b9bf07 --- /dev/null +++ b/3rdparty/jrtp_export/jthread/lib/cmake/JThread/JThreadConfig.cmake @@ -0,0 +1,8 @@ + +set(JTHREAD_FOUND 1) + +set(JTHREAD_INCLUDE_DIRS "/mnt/e/fiss/gb28181_stack/jrtplib_linux/export/jthread/include") + +set(JTHREAD_LIBRARIES "-L/mnt/e/fiss/gb28181_stack/jrtplib_linux/export/jthread/lib" "-ljthread" "-lpthread") + + diff --git a/3rdparty/jrtp_export/jthread/lib/libjthread.a b/3rdparty/jrtp_export/jthread/lib/libjthread.a new file mode 100644 index 0000000..dfd3187 --- /dev/null +++ b/3rdparty/jrtp_export/jthread/lib/libjthread.a diff --git a/3rdparty/jrtp_export/jthread/lib/libjthread.so b/3rdparty/jrtp_export/jthread/lib/libjthread.so new file mode 100644 index 0000000..4505f1d --- /dev/null +++ b/3rdparty/jrtp_export/jthread/lib/libjthread.so diff --git a/3rdparty/jrtp_export/jthread/lib/libjthread.so.1.3.3 b/3rdparty/jrtp_export/jthread/lib/libjthread.so.1.3.3 new file mode 100644 index 0000000..4505f1d --- /dev/null +++ b/3rdparty/jrtp_export/jthread/lib/libjthread.so.1.3.3 diff --git a/3rdparty/jrtp_export/jthread/lib/pkgconfig/jthread.pc b/3rdparty/jrtp_export/jthread/lib/pkgconfig/jthread.pc new file mode 100644 index 0000000..e9d16a2 --- /dev/null +++ b/3rdparty/jrtp_export/jthread/lib/pkgconfig/jthread.pc @@ -0,0 +1,6 @@ +Name: JThread +Description: Multi-platform thread/mutex library +Requires: +Version: 1.3.3 +Libs: -L/mnt/e/fiss/gb28181_stack/jrtplib_linux/export/jthread/lib -ljthread -lpthread +Cflags: -I/mnt/e/fiss/gb28181_stack/jrtplib_linux/export/jthread/include diff --git a/3rdparty/jrtplib-3.11.2/CMakeLists.txt b/3rdparty/jrtplib-3.11.2/CMakeLists.txt new file mode 100644 index 0000000..d362b77 --- /dev/null +++ b/3rdparty/jrtplib-3.11.2/CMakeLists.txt @@ -0,0 +1,258 @@ +cmake_minimum_required(VERSION 2.8) +if (POLICY CMP0042) + cmake_policy(SET CMP0042 NEW) +endif() + +project(jrtplib) +set(VERSION_MAJOR 3) +set(VERSION_MINOR 11) +set(VERSION_DEBUG 2) +set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_DEBUG}") + +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake") +if (CMAKE_INSTALL_PREFIX AND NOT CMAKE_PREFIX_PATH) + #message("Setting CMAKE_PREFIX_PATH to ${CMAKE_INSTALL_PREFIX}") + file(TO_CMAKE_PATH "${CMAKE_INSTALL_PREFIX}" CMAKE_PREFIX_PATH) +endif() + +set (_DEFAULT_LIBRARY_INSTALL_DIR lib) +if (EXISTS "${CMAKE_INSTALL_PREFIX}/lib32/" AND CMAKE_SIZEOF_VOID_P EQUAL 4) + set (_DEFAULT_LIBRARY_INSTALL_DIR lib32) +elseif (EXISTS "${CMAKE_INSTALL_PREFIX}/lib64/" AND CMAKE_SIZEOF_VOID_P EQUAL 8) + set (_DEFAULT_LIBRARY_INSTALL_DIR lib64) +endif () + +set(LIBRARY_INSTALL_DIR "${_DEFAULT_LIBRARY_INSTALL_DIR}" CACHE PATH "Library installation directory") +if(NOT IS_ABSOLUTE "${LIBRARY_INSTALL_DIR}") + set(LIBRARY_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${LIBRARY_INSTALL_DIR}") +endif() + +include(CheckCXXCompilerFlag) +include(CheckIncludeFile) +include(CheckIncludeFileCXX) +include(CheckCXXSourceCompiles) +include(TestBigEndian) +include(${PROJECT_SOURCE_DIR}/cmake/Macros.cmake) + +find_package(JThread) + +set(JRTPLIB_LINK_LIBS "") +set(JRTPLIB_INTERNAL_INCLUDES "") +set(JRTPLIB_EXTERNAL_INCLUDES "") + +add_additional_stuff(JRTPLIB_EXTERNAL_INCLUDES JRTPLIB_LINK_LIBS) + +jrtplib_support_option("Support SDES PRIV items" JRTPLIB_SUPPORT_SDESPRIV RTP_SUPPORT_SDESPRIV ON "// No support for SDES PRIV items") +jrtplib_support_option("Support the probation mechanism for a new source" JRTPLIB_SUPPORT_PROBATION RTP_SUPPORT_PROBATION ON "// Do not wait for a number of consecutive packets to validate source") +jrtplib_support_option("Support sending RTCP APP packets" JRTPLIB_SUPPORT_SENDAPP RTP_SUPPORT_SENDAPP ON "// No direct support for sending RTCP APP packets") +jrtplib_support_option("Support sending unknown RTCP packets" JRTPLIB_SUPPORT_RTCPUNKNOWN RTP_SUPPORT_RTCPUNKNOWN OFF "// No support for sending unknown RTCP packets") +jrtplib_support_option("Support memory management mechanism" JRTPLIB_SUPPORT_MEMORYMGMT RTP_SUPPORT_MEMORYMANAGEMENT ON "// No memory management support") + +jrtplib_include_test(sys/filio.h RTP_HAVE_SYS_FILIO "// Don't have ") +jrtplib_include_test(sys/sockio.h RTP_HAVE_SYS_SOCKIO "// Don't have ") +jrtplib_include_test(netinet/in.h RTP_SUPPORT_NETINET_IN "// Don't have ") + +if (JTHREAD_FOUND) + set(V "ON") +else (JTHREAD_FOUND) + set(V "OFF") +endif (JTHREAD_FOUND) + +option(JTHREAD_ENABLED "Thread support" ${V}) +if (JTHREAD_ENABLED) + set (RTP_SUPPORT_THREAD "#define RTP_SUPPORT_THREAD") + if (JTHREAD_FOUND) + save_paths(JRTPLIB_EXTERNAL_INCLUDES "${JTHREAD_INCLUDE_DIRS}") + save_paths(JRTPLIB_LINK_LIBS "${JTHREAD_LIBRARIES}") + endif(JTHREAD_FOUND) +else (JTHREAD_ENABLED) + set (RTP_SUPPORT_THREAD "// No support for JThread was enabled") +endif (JTHREAD_ENABLED) + +find_package(LIBSRTP) +if (LIBSRTP_FOUND) + set(V "ON") +else (LIBSRTP_FOUND) + set(V "OFF") +endif (LIBSRTP_FOUND) + +option(SRTP_ENABLED "Secure RTP (SRTP) support" ${V}) +if (SRTP_ENABLED) + set(RTP_SUPPORT_SRTP "#define RTP_SUPPORT_SRTP") + if (LIBSRTP_FOUND) + save_paths(JRTPLIB_EXTERNAL_INCLUDES "${LIBSRTP_INCLUDE_DIR}") + save_paths(JRTPLIB_LINK_LIBS "${LIBSRTP_LIBRARY_DIR}") + endif (LIBSRTP_FOUND) +else (SRTP_ENABLED) + set(RTP_SUPPORT_SRTP "// No SRTP support") +endif (SRTP_ENABLED) + +find_package(LIBSRTP2) +if (LIBSRTP2_FOUND) + set(V "ON") +else (LIBSRTP2_FOUND) + set(V "OFF") +endif (LIBSRTP2_FOUND) + +option(SRTP2_ENABLED "Secure RTP 2 (SRTP2) support" ${V}) +if (SRTP2_ENABLED) + set(RTP_SUPPORT_SRTP2 "#define RTP_SUPPORT_SRTP2") + if (LIBSRTP2_FOUND) + save_paths(JRTPLIB_EXTERNAL_INCLUDES "${LIBSRTP2_INCLUDE_DIR}") + save_paths(JRTPLIB_LINK_LIBS "${LIBSRTP2_LIBRARY_DIR}") + endif (LIBSRTP2_FOUND) +else (SRTP2_ENABLED) + set(RTP_SUPPORT_SRTP2 "// No SRTP2 support") +endif (SRTP2_ENABLED) + +if (SRTP2_ENABLED) + if (SRTP_ENABLED) + message(FATAL_ERROR "Can't enable both SRTP and SRTP2 at the same time") + endif() +endif () + +if (CMAKE_CROSSCOMPILING) + option (JRTPLIB_USE_BIGENDIAN "Target platform is big endian" ON) + if (JRTPLIB_USE_BIGENDIAN) + set(RTP_ENDIAN "#define RTP_BIG_ENDIAN") + else (JRTPLIB_USE_BIGENDIAN) + set(RTP_ENDIAN "// Little endian system") + endif (JRTPLIB_USE_BIGENDIAN) +else (CMAKE_CROSSCOMPILING) + test_big_endian(JRTPLIB_BIGENDIAN) + if (JRTPLIB_BIGENDIAN) + set(RTP_ENDIAN "#define RTP_BIG_ENDIAN") + else (JRTPLIB_BIGENDIAN) + set(RTP_ENDIAN "// Little endian system") + endif (JRTPLIB_BIGENDIAN) +endif (CMAKE_CROSSCOMPILING) + +option(JRTPLIB_COMPILE_TESTS "Compile various tests in the 'tests' subdirectory" NO) +option(JRTPLIB_COMPILE_EXAMPLES "Compile various examples in the 'examples' subdirectory" YES) + +# Check winsock first +set(TESTDEFS "") +set(EMPTYWSSTRING "// Not using winsock sockets") +jrtplib_test_feature(winsocktest RTP_SOCKETTYPE_WINSOCK FALSE "${EMPTYWSSTRING}" "${TESTDEFS}") +if ("${RTP_SOCKETTYPE_WINSOCK}" STREQUAL "${EMPTYWSSTRING}") + set(JRTPLIB_WINSOCK FALSE) +else () + set(JRTPLIB_WINSOCK TRUE) + set(TESTDEFS "${TESTDEFS} -DRTP_SOCKETTYPE_WINSOCK") +endif() + +jrtplib_test_feature(socklentest RTP_SOCKLENTYPE_UINT TRUE "// socklen_t is 'int'" "${TESTDEFS}") +jrtplib_test_feature(ipv4mcasttest RTP_SUPPORT_IPV4MULTICAST FALSE "// No IPv4 multicasting support" "${TESTDEFS}") +jrtplib_test_feature(salentest RTP_HAVE_SOCKADDR_LEN FALSE "// No sa_len member in struct sockaddr" "${TESTDEFS}") +jrtplib_test_feature(getloginrtest RTP_SUPPORT_GETLOGINR FALSE "// Not using getlogin_r" "${TESTDEFS}") +jrtplib_test_feature(ipv6test RTP_SUPPORT_IPV6 FALSE "// No IPv6 support" "${TESTDEFS}") +jrtplib_test_feature(ipv6mcasttest RTP_SUPPORT_IPV6MULTICAST FALSE "// No IPv6 multicasting support" "${TESTDEFS}") +jrtplib_test_feature(performancecounter RTP_HAVE_QUERYPERFORMANCECOUNTER FALSE "// No QueryPerformanceCounter support" "${TESTDEFS}") +jrtplib_test_feature(suffix RTP_HAVE_VSUINT64SUFFIX FALSE "// No ui64 suffix" "${TESTDEFS}") +jrtplib_test_feature(arrayalloc RTP_HAVE_ARRAYALLOC FALSE "// No custom new[]" "${TESTDEFS}") +jrtplib_test_feature(randstest RTP_HAVE_RAND_S FALSE "// No rand_s support" "${TESTDEFS}") +jrtplib_test_feature(strncpystest RTP_HAVE_STRNCPY_S FALSE "// No strncpy_s support" "${TESTDEFS}") +jrtplib_test_feature(clockgettimetest RTP_HAVE_CLOCK_GETTIME FALSE "// No clock_gettime support" "${TESTDEFS}") +jrtplib_test_feature(polltest RTP_HAVE_POLL FALSE "// No 'poll' support" "${TESTDEFS}") +jrtplib_test_feature(wsapolltest RTP_HAVE_WSAPOLL FALSE "// No 'WSAPoll' support" "${TESTDEFS}") +jrtplib_test_feature(msgnosignaltest RTP_HAVE_MSG_NOSIGNAL FALSE "// No MSG_NOSIGNAL option" "${TESTDEFS}") +jrtplib_test_feature(ifaddrstest RTP_SUPPORT_IFADDRS FALSE "// No ifaddrs support" "${TESTDEFS}") + +check_cxx_source_compiles("#include \n#include \nint main(void) { char s[1024]; _snprintf_s(s, 1024,\"%d\", 10);\n return 0; }" JRTPLIB_SNPRINTF_S) +if (JRTPLIB_SNPRINTF_S) + set(RTP_SNPRINTF_VERSION "#define RTP_HAVE_SNPRINTF_S") +else () + check_cxx_source_compiles("#include \n#include \nint main(void) { char s[1024]; _snprintf(s, 1024,\"%d\", 10);\n return 0; }" JRTPLIB_SNPRINTF) + if (JRTPLIB_SNPRINTF) + set(RTP_SNPRINTF_VERSION "#define RTP_HAVE_SNPRINTF") + else () + set(RTP_SNPRINTF_VERSION "// Stdio snprintf version") + endif() +endif() + +check_cxx_source_compiles("#include \n#include \nint main(void) { size_t a = 0 ; size_t b = a; uint32_t x = 0; uint32_t y = x; return 0; }" JRTPLIB_STDINT) +if (JRTPLIB_STDINT) + set(RTP_INTTYPE_HEADERS "#include \n#include ") +else (JRTPLIB_STDINT) + check_cxx_source_compiles("#include \n#include \nint main(void) { uint32_t x = 0; uint32_t y = x; return 0; }" JRTPLIB_INTTYPES) + if (JRTPLIB_INTTYPES) + set(RTP_INTTYPE_HEADERS "#include \n#include \n") + else (JRTPLIB_INTTYPES) + if (MSVC) + set(RTP_INTTYPE_HEADERS "#include \"rtptypes_win.h\"") + else (MSVC) + set(RTP_INTTYPE_HEADERS "#error Could not find header files that define types like 'uint32_t'. Please edit the file ${PROJECT_BINARY_DIR}/src/rtptypes_unix.h and make sure that the following types are defined: int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t") + message("\n\nError: Could not find header files that define types like 'uint32_t'.\nPlease edit the file ${PROJECT_BINARY_DIR}/src/rtptypes_unix.h\nand make sure that the following types are defined: \nint8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t\n\n") + endif (MSVC) + endif (JRTPLIB_INTTYPES) +endif (JRTPLIB_STDINT) + +if (JRTPLIB_WINSOCK) + set(RTP_WINSOCK_HEADERS "#ifdef RTP_SOCKETTYPE_WINSOCK\n #include \n #include \n#ifndef _WIN32_WCE\n #include \n#endif // _WIN32_WCE\n#endif // RTP_SOCKETTYPE_WINSOCK\n") + list(APPEND JRTPLIB_LINK_LIBS "ws2_32") +endif () + +if (MSVC) + set(JRTPLIB_COMPILE_STATIC ON CACHE BOOL "Flag indicating if a static library should be built, or a dynamic one") +endif () + +if (NOT MSVC OR JRTPLIB_COMPILE_STATIC) + set(JRTPLIB_IMPORT "") + set(JRTPLIB_EXPORT "") +else () + set(JRTPLIB_IMPORT "__declspec(dllimport)") + set(JRTPLIB_EXPORT "__declspec(dllexport)") +endif () + +configure_file("${PROJECT_SOURCE_DIR}/src/rtptypes.h.in" "${PROJECT_BINARY_DIR}/src/rtptypes.h") +configure_file("${PROJECT_SOURCE_DIR}/src/rtpconfig.h.in" "${PROJECT_BINARY_DIR}/src/rtpconfig.h") +configure_file("${PROJECT_SOURCE_DIR}/src/rtplibraryversioninternal.h.in" "${PROJECT_BINARY_DIR}/src/rtplibraryversioninternal.h") + +save_paths(JRTPLIB_INTERNAL_INCLUDES "${PROJECT_SOURCE_DIR}/src" "${PROJECT_BINARY_DIR}/src") + +add_subdirectory(src) + +if (JRTPLIB_COMPILE_EXAMPLES) + add_subdirectory(examples) +endif() + +if (JRTPLIB_COMPILE_TESTS) + add_subdirectory(tests) +endif() + +if (NOT MSVC) + set(JRTPLIB_LIBS "-L${LIBRARY_INSTALL_DIR}" "-ljrtp") +else () + set(JRTPLIB_LIBS optimized "${LIBRARY_INSTALL_DIR}/jrtplib.lib" + debug "${LIBRARY_INSTALL_DIR}/jrtplib_d.lib") +endif () + +set(JRTPLIB_INCDIRS ${JRTPLIB_EXTERNAL_INCLUDES} ${CMAKE_INSTALL_PREFIX}/include) +set(JRTPLIB_LIBS ${JRTPLIB_LIBS} ${JRTPLIB_LINK_LIBS}) +remove_empty(JRTPLIB_INCDIRS) +list(REMOVE_DUPLICATES JRTPLIB_INCDIRS) +remove_empty(JRTPLIB_LIBS) + +foreach(ARG ${JRTPLIB_LIBS}) + set(JRTPLIB_LIBS_CMAKECONFIG "${JRTPLIB_LIBS_CMAKECONFIG} \"${ARG}\"") +endforeach() +foreach(ARG ${JRTPLIB_INCDIRS}) + set(JRTPLIB_INCDIRS_CMAKECONFIG "${JRTPLIB_INCDIRS_CMAKECONFIG} \"${ARG}\"") +endforeach() + +configure_file("${PROJECT_SOURCE_DIR}/cmake/JRTPLIBConfig.cmake.in" "${PROJECT_BINARY_DIR}/cmake/JRTPLIBConfig.cmake") +install(FILES "${PROJECT_BINARY_DIR}/cmake/JRTPLIBConfig.cmake" DESTINATION ${LIBRARY_INSTALL_DIR}/cmake/JRTPLIB) + +if (NOT MSVC) + foreach(ARG ${JRTPLIB_LIBS}) + set(JRTPLIB_LIBS_PKGCONFIG "${JRTPLIB_LIBS_PKGCONFIG} ${ARG}") + endforeach() + foreach(ARG ${JRTPLIB_INCDIRS}) + set(JRTPLIB_INCDIRS_PKGCONFIG "${JRTPLIB_INCDIRS_PKGCONFIG} -I${ARG}") + endforeach() + + configure_file(${PROJECT_SOURCE_DIR}/pkgconfig/jrtplib.pc.in ${PROJECT_BINARY_DIR}/pkgconfig/jrtplib.pc) + install(FILES ${PROJECT_BINARY_DIR}/pkgconfig/jrtplib.pc DESTINATION ${LIBRARY_INSTALL_DIR}/pkgconfig) +endif () + + diff --git a/3rdparty/jrtplib-3.11.2/ChangeLog b/3rdparty/jrtplib-3.11.2/ChangeLog new file mode 100644 index 0000000..db468ac --- /dev/null +++ b/3rdparty/jrtplib-3.11.2/ChangeLog @@ -0,0 +1,417 @@ + + JRTPLIB ChangeLog + ----------------- + 3.11.2 (April 2020): + * Taking EINTR in nanosleep, poll and select calls into account. + Thanks to Filippo Guerzoni (filippo.guerzoni@gmail.com) for bringing + this to my attention. + * Disabled some copy constructors + * Bugfix in RTPExternalTransmitter: a buffer could fill up causing the + an operation to fail to get aborted + * Added constructor to RTPRawPacket to guess RTP/RTCP type + * Bugfixed regarding some calles being cut short due to an EINTR + + 3.11.1 (March 2017) + * Bugfix in rtpsources.cpp: if the RTP packet got deleted in + OnValidatedRTPPacket, then an illegal address would be accessed + when looking up the CSRC identifiers. Thanks to Lau Bakman for + reporting this. + + 3.11.0 (March 2017) + * In the RTPSession class, thread safety can be requested even + if the poll thread is not used. + * Moved the 'abort decriptor' stuff into a separate class and + made it possible for the UDPv4 transmitter to use a pre-created + instance. In turn this allows a single poll thread to be set up + for multiple RTPSession instances. Example8 illustrates this. + * Made an abstraction RTPSelect for the 'select' call. This can + use 'poll' or 'WSAPoll' depending on the availabity, which can + allow better scaling for a use case such as example8. + * Added RTPRandom::CreateDefaultRandomNumberGenerator to create + the default random number engine for the platform in use. + * When using gcc, warnings will be treated as error by default + (this can be disabled in the cmake options) + * Added a transmission component that allows packets to be sent + and received over TCP. + + 3.10.0 (December 2016) + * Support for MingW compilation was added + * Outgoing data or incoming data can be intercepted and changed + (useful for encryption) + * SRTP support (using libsrtp) through the RTPSecureSession class. + Thanks to Vladimir V. Pavluk (vladvic_r@mail.ru) and to + Alexey Obergan (alex.obergan@gmail.com) for providing very helpful + code. + * RTP packets can now be processed in RTPSession's + OnValidatedRTPPacket virtual function. + * Various virtual function were added to the RTPSession class to + get immediate notification of RTCP sender reports, receiver + reports, SDES data. + * Support for RTP and RTCP multiplexing over the same port, for the + UDPv4 transmitter. + * Added a member function to RTPSession to send raw data, i.e. to + send data directly over the RTP or RTCP channel of the transmitter. + * Added a member function to RTPSession by which you can retrieve the + next RTP sequence number. + * Specifying port 0 for the UDPv4 transmitter chooses a port pair + by itself. + * The UDPv4 transmitter can be initialized using pre-created RTP + and RTCP sockets. + * Modified RTPTime class to use an internal representation of a + double precision floating point number. Also using clock_gettime + if available instead of gettimeofday, to obtain times that are + not affected by clock adjustments. + + 3.9.2 (December 2016) + * Major bugfix: zero length UDP packets should no longer block + the reception of packets. + * Various compiler warnings were fixed. Thanks to Ruotger Skupin + (roddi@me.com) for supplying the patch. + + 3.9.1 (November 2011) + * Fixed a bug in the CMake configuration: was unable to handle + path names with spaces. + * Fixed bug in rtcpsdespacket.h: end namespace curly bracket + was in wrong place. + * In an MS-Windows environment you can now choose to build a + DLL instead of a static library. + + 3.9.0 (July 2011) + * Switched to CMake build system. + * Added the RTPByteAddress class, which can be used to describe + a host/port combination in a very general way. + * Added the RTPExternalTransmitter class which can be used if + one would like to use a transmission mechanism other than + the UDP based transmitters. + * Placed everything in namespace 'jrtplib'. + + 3.8.2 (February 2011) + * Fixed bug in RTPRandomRand48. The uint16_t version used a + & 0xff instead of & 0xffff. Thanks to Alexey Kumkov + (crazykum@ukr.net) for bringing this to my attention. + + 3.8.1 (October 2010) + * Initialization of the RTPRandomRandS class didn't work as + intended, causing the fall-back class RTPRandomRand48 always + being used on the Win32 platform. + + 3.8.0 (September 2010) + * Fixed bug in RTPSources implementation. An incorrect + 'GotoNextElement' call was replaced by a 'GotoPreviousElement' + call. + * Added functionality to send unknown RTCP packets. Patch + was supplied by Tom Harper (d.thomas.harper@gmail.com) + * Fixed bug in INF_GetEstimatedTimestampUnit (possibility of + division by zero). Thanks to Gilson Yi (gilson.yi@gmail.com) + for bringing this to my attention. + * Added some code to allow a specific SSRC to be used. + * Fixed bug in jitter calculation code. Thanks to Uwe Andersen + (uandersen@mayah.com) for bringing this to my attention. + * Added OnPollThreadStart and OnPollThreadStop to RTPSession. + Thanks to Daniele Barzotti (daniele.barzotti@eurocomtel.com) + for suggesting this. + * Added method to RTPSessionParams to force a specific CNAME. + Thanks to Lars Rohwedder (L.Rohwedder@mocotec.de) for the + suggestion. + * Removed old RTPRandom code and made RTPRandom an abstract + interface. Added a /dev/urandom implementation, a rand_s + implementation and a rand48 implementation. By default, + /dev/urandom and rand_s are tried, and rand48 is used as a + fall-back mechanism. + + 3.7.1 (May 2007) + * Fixed bug in the CurrentTime implementation (Win32/WinCE version). + Thanks to Dani Baeyens (dani@warp.es) and Eric Johnson + (EJohnson@pelco.com) for helping me solve this problem. + + 3.7.0 (January 2007) + * Send and receive socket buffer sizes can now be set in the + transmission parameters. Thanks to Dmitry Shandyba + (Dmitry.Shandyba@materialise.kiev.ua) for suggesting this. + * Changed a 'htons' call to a 'ntohs' call in ShouldAcceptData + in both the IPv4 and IPv6 transmitters. + * Fixed bug in RTPIPv6Destination. Thanks to Yi-Huan Chan + (yhchan@csie.nctu.edu.tw) and Franco Sinhori + (francosinhori@gmail.com) for bringing this to my attention. + + 3.6.0 (June 2006) + * Added a constructor to the RTCPCompoundPacket class to be able + to parse a compound packet out of a byte array (and not only + out of an RTPRawPacket instance). + * Added a method to RTPSession to send RTCP APP packets. Thanks + to Herman Bastiaens (herman.bastiaens@student.uhasselt.be) + for supplying the patch. + * Fixed Win32 rand_s bug. Thanks to Jeremy Noring + (jnoring@wilife.com) for supplying the patch. + * Removed the GetNumRTPPacketsSent and GetNumRTCPPacketsSent + functions in the transmitter. The counts were only used to + check if packets had been sent. Now, a flag in RTPSession is + used for this purpose. + * Added memory management support. + * Added a member function to RTPSession which allows passing an + RTPTransmitter instance. + * The instances in the destination lists now store struct + sockaddr variables. This makes sending data to each destination + more efficient. + + 3.5.2 (March 2006) + * Fixed bug in the random number functions which are used with + MS Visual Studio 2005. Thanks to Jun Ohasi (jun@jnb.odn.ne.jp) + for bringing the incorrect use of rand_s to my attention. + * Changed types like u_int32_t to types like uint32_t in the + documentation. + + 3.5.1 (March 2006) + * Fixed bug in RTCP scheduler. Due to -= operation on an RTPTime + instance, an incredibly large scheduling interval could be + calculated. + + 3.5.0 (March 2006) + * Now, the define RTP_SNPRINTF is used instead of snprintf, + _snprintf or _snprintf_s. + * In the RTPSources member function MultipleTimeouts, I neglected + to call the OnRemoveSource virtual function. Thanks to Adam Love + (alove@exceptionalinnovation.com) for bringing this to my attention. + * Added a OnSendRTCPCompoundPacket member function to the RTPSession + class. Useful for inspecting outgoing data. + * Modified the templates somewhat. Should cause less compiler problems + this way. Thanks tot Chris Hamilton (chamilton@cs.dal.ca) for + providing this solution. + * On Win32, if possible the functions rand_s and srand_s are now used. + + 3.4.0 (January 2006) + * Changed u_int32_t like types to uint32_t like types. Thanks to + Panagiotis Issaris (takis.issaris@uhasselt.be) for informing me + that these are C99 compliant. + * Changed sprintf functions to safer snprintf functions. Thanks to + Panagiotis Issaris (takis.issaris@uhasselt.be) for pointing this + out. + * Fixed bug in RTPSources (counters were not reset when the source + table was cleared). Thanks to Justin Matthews (jmatthewsr@yahoo.com) + for pointing this out. + * Fixed bug in RTPHashTable and RTPKeyHashTable. Thanks to + Tom Pijsel (tom.pijsel@twelvecubes.com) for bringing this to my + attention. + * Fixed bug in example3.cpp + + 3.3.0 (October 2005) + * Now it is possible to use a user-defined transmission component. + * Added GStreamer transmission component written by Philippe Khalaf + (burger@speedy.org). + + 3.2.1 (September 2005) + * The library wouldn't compile when probation support was disabled. + Thanks to Herman Bastiaens (herman.bastiaens@student.luc.ac.be) for + bringing this to my attention. + * When parsed from an RTPRawPacket, the receive time is also stored + in the RTPPacket instance. + + 3.2.0 (September 2005) + * Modified the routine in the RTPSession class which creates the + CNAME. Aparently on some systems, the 'getlogin' call returns + null. As an alternative, the library uses getenv("LOGNAME"). + Thanks to Mark Schiffmann (schima@neumann-elektronik.com) for + mentioning this to me. + * Added a OnBYEPacket method to the RTPSession class. Thanks to + Sigrid Thijs (sthijs@androme.be) for suggesting this. + * When probation support is enabled, a probation type can be selected + when the session is created. Supported types are "No probation", + "Use probation, but store packets" and "Use probation and discard + packets received in probation mode". Thanks to Chris Flerackers + (cflerackers@androme.be) for suggesting this feature. + * Added a parameter to WaitForIncomingData which indicates if + data is available when the function returns. Based on a suggestion + by Uwe Andersen (uandersen@mayah.com). + * Now using getifaddrs (if possible) to obtain our own IP addresses + (both in IPv4 version and IPv6 version). + * IPv6 code in Win32 version now works, but Visual Studio 2005 beta + has to be used. Thanks to Yi-Huan Chan (yhchan@csie.nctu.edu.tw) + for contributing some code. + * Added Win32 code for GetLocalIPList_Interfaces (both IPv4 and IPv6). + Thanks to Ivan Makushkin (camry@pisem.net) for pointing out how + this could be done. + * Added an option to use a SR packet when sending a BYE message. + Previously, a RR packet was always used, even if a session is + actually an active sender of data. Thanks to Uwe Andersen + (uandersen@mayah.com) for bringing this to my attention. + * Fixed bug in CNAME creation. + * Added WinCE support. Thanks to Maarten Daniels + (maarten.daniels@uhasselt.be) for supplying patches. + * Changed the CurrentTime implementation for the MS-Windows version. + Thanks to Maarten Daniels (maarten.daniels@uhasselt.be) and Chris + Flerackers (cflerackers@androme.be). + + 3.1.0 (October 2004) + * Added a callback OnPollThreadStep which is called at the end of + each loop of the poll thread + * Added the examples subdirectory to the package + * Fixed bug in rtpudpv4transmitter.cpp and rtpudpv6transmitter.cpp + which caused an infinite loop in LeaveAllMulticastGroups. Thanks + to Stijn Agten (stijn.agten@luc.ac.be) for pointing this out. + * Added a function GetTransmissionInfo to the RTPTransmitter class + (and subclasses). The function will return some additional + information about the transmitter, like local IP addresses and + socket descriptors. + + 3.0.2 (September 2004) + * Bugfix in rtpinternalsourcedata.cpp. The bug caused a crash when + duplicate packets were received. Thanks to Dominique Prunier + (dominique.prunier@micromedia-int.com) for informing me about + this. + + 3.0.1 (September 2004) + * Bugfix in rtpudpv4transmitter.cpp and rtpudpv6transmitter.cpp in + method SetReceiveMode + * Removed unused 'acceptownpackets' variable from + rtpudpv4transmitter.cpp and rtpudpv6transmitter.cpp + * Added a 'Dump' function (for debugging) in RTPUDPv4Transmitter + and RTPUDPv6Transmitter + * Now using JThread 1.1.0 + + 3.0.0 (August 2004) + * Complete rewrite of the library to provide better extensibility + and compliance with RFC 3550 + * Changes from the 2.x series: + - The 2.x series was created with the idea that the user + would only need to use the RTPSession class which meant + that the other classes were not very useful by themselves. + This version on the other hand, aims to provide many + useful components to aid the user in building RTP capable + applications. + - In this version, the code which is specific for the + underlying protocol by which RTP packets are transported, + is bundled in a class which inherits its interface from a + class called RTPTransmitter. This makes it easy for + different underlying protocols to be supported. Currently + there is support for UDP over IPv4 and UDP over IPv6. + + 2.9 (July 2004) + * Fixed bug in rtpsrclist.cpp. Thanks to Lukasz Bobowiec + (bobowiec@icslab.agh.edu.pl) + * Added function in RTPSourceData which returns the IP address + * Changed the random routines. Thanks to Jaap Keuter + (jaap.keuter@xs4all.nl) + * Made the shared library link against libstdc++ if possible. + Thanks to Anatoly Yakovenko (aeyakovenko@yahoo.com) for the + suggestion. + + 2.8 (January 2004) + * Added code to avoid a crash when receiving a malformed packet + * Fixed a memory leak (forgot to free memory when a malformed + packet was discarded) + * Changed debug routines for memory tracking + + 2.7b (November 2003) + * Only added --enable-fpic and --enable-fPIC to the configure script + + 2.7 (December 2002) + * Fixed important bug in rtpsources.cpp. This bug could cause + source information to get lost and could create a memory leak. + * Improved support for AIX in multicasting code (uses _AIX define). + Thanks to Klaus Matuschek (klaus.matuschek@infonova.com) + * Fixed possible buffer overrun in rtpcontributingsources.cpp + + 2.6 (January 2002) + * This release only contains some minor changes + * An 'install' target was added to the Makefile + * Some newlines were added add the end of certain files to avoid + compiler warnings + * Improved the jitter calculations somewhat + + 2.5 (December 2000) + * Added the possibility for the user to receive the raw RTCP packets. + * Fixed a bug in RTPContributingSources::CreateLocalCNAME(). In this + routine, the wrong length was passed to 'gethostname'. Thanks to + Sergey V.Shpital (sergey@page.net.ru) for bringing this to my + attention. + * Added a routine to set the Type of Service (ToS) field of the + outgoing packets (both RTP and RTCP). Thank to Philippe Cardon + (philippe.cardon@bt.com) for writing this code. + * Fixed a bug in the 'packets lost' calculation. Thank to Domingo + Cuevas Jr. (dcj@onebox.com) for helping me find this bug. + * Fixed a bug in the sequence number and jitter calculation: when + packets were received out of order, the sequence numbers and + jitter got messed up. Many thanks to Mohammad Tawsheeq Russool + (m.russool@eim.surrey.ac.uk) for helping me track down these + bugs. + * Added the possibility to set the timestamp unit for a particular + source. Previously, it was assumed that their timestamp unit + was the same as that of the local session. + + 2.4 (July 2000) + * Fixed a bug which caused all CSRS's except one to be incorrect. + * Added RTP header extension support (for both sending and receiving). + * Added some things (which should have been there already) to + RTPPacket. + * Adjusted the way in which the login name is retrieved on unix-like + systems. First I used a call to 'getlogin', but apparently this + function messes with timers through the use of 'alarm' calls (at + least on Linux). Now, I use a combination of 'geteuid' and + 'getpwuid' to obtain the necessary information. This does not + have that problem and is a lot cleaner since it doesn't depend + on login info (utmp) like 'getlogin'. Thanks to Roberto Jung Drebes + (drebes@inf.ufrgs.br) for pointing out the timer-problem. + * Made a LaTeX version of the manual and tutorial. Looks a lot nicer. + * Made it possible for the user to specify the local IP address + instead of letting the library figure it out itself. + * Fixed a bug which caused the 'fraction lost' in a RR packet to be + zero all the time. Thanks to Domingo Cuevas Jr. (dcj@onebox.com) for + pointing this out. + * Rewrote the RTCP packet sending routines. Now, they are much cleaner + and much more understandable :) + * Added better support for RTCP 'APP' packets. You can now both send + and receive APP packets. + + 2.3 (April 2000) + * The routine which creates and sends RTCP packets is now a bit faster. + * Added a sample that demonstrates the round-trip time function. + * Added functions to RTPSourceData: now the time when the last RR or + SR report was received can be retrieved. Also, the round trip time + can be retrieved: this is calculated as suggested in RFC 1889. + * Fixed a bug: the LSR value was not calculated correctly, now it is + (or should be ;-) ) + * Instead of specifying defines on the command line, they are now + defined in a config file. The unix version of this file is created + by the configure script. + * Added a member to RTPPacket which I had forgotten (the payload type, + which is obviously important :-) ). + * The library should now be able to work on a VxWorks platform. Thanks + to Dave Osborne (dosborne@argoneng.com) for his help. + * Added a tutorial and a small example application. + * Added some debugging routines (RTPDebug class) to check for memory + leaks. It turned out that there weren't any, so I'm pretty pleased ;) + * I've added a 'configure' script to make compilation a bit easier + across different platforms. Thanks to Qi Han (qh1c4@mizzou.edu) for + helping me to improve the support for the Solaris platform. Also + many thanks to Dario Maggiorini (dario@netdev.usr.dsi.unimi.it) for + helping me test the script on several platforms. + * Added multicasting support. + * A bug in rtpsourcedata.cpp was pointed out and fixed by Ramon Clout + (ramonc@win.tue.nl). Many thanks for this, Ramon. + + 2.2 (February 2000) + * Extra support for Sun and HP. Thanks to Henry Lau (hlau@nuera.com) + and Justin Matthews (jmatthews@nuera.com) for this information. + * The 'Poll' routine in rtpconnection.cpp has been altered. Now, the + routine should work even if there's that ioctl bug (previously, this + bug was only taken into consideration on a Windows platform). + Thanks to Justin Matthews (jmatthews@nuera.com) for his bugreport. + * Added some routines to RTPSession to get the local IP address and the + port number of the sending socket. + * 'install' rule added to the makefile. + * Added the define 'RTP_SOCKLENTYPE_UINT'. See README.TXT for more + information about this. + + 2.1 (December 1999) + * First release of jrtplib. + * Added member functions of RTPSession to retrieve the used sockets. + * Made the destination list faster by using a hash table. + + 2.0 (August 1999) + * First decent implementation of RTP. Entirely rewritten since 1.0. + + 1.0 (August 1999) + * First implementation of RTP. There were a lot of things that weren't + quite right and the organisation of the classes was quite nasty. + However, I learned a lot about RTP making this version, and so it + allowed me to make a good start on version 2.0. diff --git a/3rdparty/jrtplib-3.11.2/Doxyfile b/3rdparty/jrtplib-3.11.2/Doxyfile new file mode 100644 index 0000000..957d57e --- /dev/null +++ b/3rdparty/jrtplib-3.11.2/Doxyfile @@ -0,0 +1,2371 @@ +# Doxyfile 1.8.9.1 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all text +# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv +# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv +# for the list of possible encodings. +# The default value is: UTF-8. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. + +PROJECT_NAME = JRTPLIB + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. + +PROJECT_NUMBER = "{X.X.X}" + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer a +# quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = + +# With the PROJECT_LOGO tag one can specify a logo or an icon that is included +# in the documentation. The maximum height of the logo should not exceed 55 +# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy +# the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path +# into which the generated documentation will be written. If a relative path is +# entered, it will be relative to the location where doxygen was started. If +# left blank the current directory will be used. + +OUTPUT_DIRECTORY = + +# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- +# directories (in 2 levels) under the output directory of each output format and +# will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. +# The default value is: NO. + +CREATE_SUBDIRS = NO + +# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII +# characters to appear in the names of generated files. If set to NO, non-ASCII +# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode +# U+3044. +# The default value is: NO. + +ALLOW_UNICODE_NAMES = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, +# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), +# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, +# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, +# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, +# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, +# Ukrainian and Vietnamese. +# The default value is: English. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member +# descriptions after the members that are listed in the file and class +# documentation (similar to Javadoc). Set to NO to disable this. +# The default value is: YES. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief +# description of a member or function before the detailed description +# +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. +# The default value is: YES. + +REPEAT_BRIEF = NO + +# This tag implements a quasi-intelligent brief description abbreviator that is +# used to form the text in various listings. Each string in this list, if found +# as the leading text of the brief description, will be stripped from the text +# and the result, after processing the whole list, is used as the annotated +# text. Otherwise, the brief description is used as-is. If left blank, the +# following values are used ($name is automatically replaced with the name of +# the entity):The $name class, The $name widget, The $name file, is, provides, +# specifies, contains, represents, a, an and the. + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# doxygen will generate a detailed section even if there is only a brief +# description. +# The default value is: NO. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. +# The default value is: NO. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path +# before files name in the file list and in the header files. If set to NO the +# shortest path that makes the file name unique will be used +# The default value is: YES. + +FULL_PATH_NAMES = YES + +# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. +# Stripping is only done if one of the specified strings matches the left-hand +# part of the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the path to +# strip. +# +# Note that you can specify absolute paths here, but also relative paths, which +# will be relative from the directory where doxygen is started. +# This tag requires that the tag FULL_PATH_NAMES is set to YES. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the +# path mentioned in the documentation of a class, which tells the reader which +# header file to include in order to use a class. If left blank only the name of +# the header file containing the class definition is used. Otherwise one should +# specify the list of include paths that are normally passed to the compiler +# using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but +# less readable) file names. This can be useful is your file systems doesn't +# support long names like on DOS, Mac, or CD-ROM. +# The default value is: NO. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the +# first line (until the first dot) of a Javadoc-style comment as the brief +# description. If set to NO, the Javadoc-style will behave just like regular Qt- +# style comments (thus requiring an explicit @brief command for a brief +# description.) +# The default value is: NO. + +JAVADOC_AUTOBRIEF = YES + +# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first +# line (until the first dot) of a Qt-style comment as the brief description. If +# set to NO, the Qt-style will behave just like regular Qt-style comments (thus +# requiring an explicit \brief command for a brief description.) +# The default value is: NO. + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a +# multi-line C++ special comment block (i.e. a block of //! or /// comments) as +# a brief description. This used to be the default behavior. The new default is +# to treat a multi-line C++ comment block as a detailed description. Set this +# tag to YES if you prefer the old behavior instead. +# +# Note that setting this tag to YES also means that rational rose comments are +# not recognized any more. +# The default value is: NO. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the +# documentation from any documented member that it re-implements. +# The default value is: YES. + +INHERIT_DOCS = NO + +# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new +# page for each member. If set to NO, the documentation of a member will be part +# of the file/class/namespace that contains it. +# The default value is: NO. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen +# uses this value to replace tabs by spaces in code fragments. +# Minimum value: 1, maximum value: 16, default value: 4. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that act as commands in +# the documentation. An alias has the form: +# name=value +# For example adding +# "sideeffect=@par Side Effects:\n" +# will allow you to put the command \sideeffect (or @sideeffect) in the +# documentation, which will result in a user-defined paragraph with heading +# "Side Effects:". You can put \n's in the value part of an alias to insert +# newlines. + +ALIASES = + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding "class=itcl::class" +# will allow you to use the command class in the itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. For +# instance, some of the names that are used will be different. The list of all +# members will be omitted, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for VHDL. +# The default value is: NO. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, and +# language is one of the parsers supported by doxygen: IDL, Java, Javascript, +# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran: +# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: +# Fortran. In the later case the parser tries to guess whether the code is fixed +# or free formatted code, this is the default for Fortran type files), VHDL. For +# instance to make doxygen treat .inc files as Fortran files (default is PHP), +# and .f files as C (default is Fortran), use: inc=Fortran f=C. +# +# Note: For files without extension you can use no_extension as a placeholder. +# +# Note that for custom extensions you also need to set FILE_PATTERNS otherwise +# the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments +# according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you can +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in +# case of backward compatibilities issues. +# The default value is: YES. + +MARKDOWN_SUPPORT = YES + +# When enabled doxygen tries to link words that correspond to documented +# classes, or namespaces to their corresponding documentation. Such a link can +# be prevented in individual cases by putting a % sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. +# The default value is: YES. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should set this +# tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); +# versus func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. +# The default value is: NO. + +BUILTIN_STL_SUPPORT = YES + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. +# The default value is: NO. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: +# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen +# will parse them like normal C++ but will assume all classes use public instead +# of private inheritance when no explicit protection keyword is present. +# The default value is: NO. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES will make +# doxygen to replace the get and set methods by a property in the documentation. +# This will only work if the methods are indeed getting or setting a simple +# type. If this is not the case, or you want to show the methods anyway, you +# should set this option to NO. +# The default value is: YES. + +IDL_PROPERTY_SUPPORT = NO + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. +# The default value is: NO. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES to allow class member groups of the same type +# (for instance a group of public functions) to be put as a subgroup of that +# type (e.g. under the Public Functions section). Set it to NO to prevent +# subgrouping. Alternatively, this can be done per class using the +# \nosubgrouping command. +# The default value is: YES. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions +# are shown inside the group in which they are included (e.g. using \ingroup) +# instead of on a separate page (for HTML and Man pages) or section (for LaTeX +# and RTF). +# +# Note that this feature does not work in combination with +# SEPARATE_MEMBER_PAGES. +# The default value is: NO. + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions +# with only public data fields or simple typedef fields will be shown inline in +# the documentation of the scope in which they are defined (i.e. file, +# namespace, or group documentation), provided this scope is documented. If set +# to NO, structs, classes, and unions are shown on a separate page (for HTML and +# Man pages) or section (for LaTeX and RTF). +# The default value is: NO. + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or +# enum is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically be +# useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. +# The default value is: NO. + +TYPEDEF_HIDES_STRUCT = NO + +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This +# cache is used to resolve symbols given their name and scope. Since this can be +# an expensive process and often the same symbol appears multiple times in the +# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small +# doxygen will become slower. If the cache is too large, memory is wasted. The +# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range +# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 +# symbols. At the end of a run doxygen will report the cache usage and suggest +# the optimal cache size from a speed point of view. +# Minimum value: 0, maximum value: 9, default value: 0. + +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in +# documentation are documented, even if no documentation was available. Private +# class members and static file members will be hidden unless the +# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. +# Note: This will also disable the warnings about undocumented members that are +# normally produced when WARNINGS is set to YES. +# The default value is: NO. + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will +# be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal +# scope will be included in the documentation. +# The default value is: NO. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be +# included in the documentation. +# The default value is: NO. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined +# locally in source files will be included in the documentation. If set to NO, +# only classes defined in header files are included. Does not have any effect +# for Java sources. +# The default value is: YES. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. If set to YES, local methods, +# which are defined in the implementation section but not in the interface are +# included in the documentation. If set to NO, only methods in the interface are +# included. +# The default value is: NO. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base name of +# the file that contains the anonymous namespace. By default anonymous namespace +# are hidden. +# The default value is: NO. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all +# undocumented members inside documented classes or files. If set to NO these +# members will be included in the various overviews, but no documentation +# section is generated. This option has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_MEMBERS = YES + +# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. If set +# to NO, these classes will be included in the various overviews. This option +# has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_CLASSES = YES + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend +# (class|struct|union) declarations. If set to NO, these declarations will be +# included in the documentation. +# The default value is: NO. + +HIDE_FRIEND_COMPOUNDS = YES + +# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any +# documentation blocks found inside the body of a function. If set to NO, these +# blocks will be appended to the function's detailed documentation block. +# The default value is: NO. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation that is typed after a +# \internal command is included. If the tag is set to NO then the documentation +# will be excluded. Set it to YES to include the internal documentation. +# The default value is: NO. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file +# names in lower-case letters. If set to YES, upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. +# The default value is: system dependent. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with +# their full class and namespace scopes in the documentation. If set to YES, the +# scope will be hidden. +# The default value is: NO. + +HIDE_SCOPE_NAMES = NO + +# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will +# append additional text to a page's title, such as Class Reference. If set to +# YES the compound reference will be hidden. +# The default value is: NO. + +HIDE_COMPOUND_REFERENCE= NO + +# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of +# the files that are included by a file in the documentation of that file. +# The default value is: YES. + +SHOW_INCLUDE_FILES = YES + +# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each +# grouped member an include statement to the documentation, telling the reader +# which file to include in order to use the member. +# The default value is: NO. + +SHOW_GROUPED_MEMB_INC = NO + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include +# files with double quotes in the documentation rather than with sharp brackets. +# The default value is: NO. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the +# documentation for inline members. +# The default value is: YES. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the +# (detailed) documentation of file and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. +# The default value is: YES. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief +# descriptions of file, namespace and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. Note that +# this will also influence the order of the classes in the class list. +# The default value is: NO. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the +# (brief and detailed) documentation of class members so that constructors and +# destructors are listed first. If set to NO the constructors will appear in the +# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. +# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief +# member documentation. +# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting +# detailed member documentation. +# The default value is: NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy +# of group names into alphabetical order. If set to NO the group names will +# appear in their defined order. +# The default value is: NO. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by +# fully-qualified names, including namespaces. If set to NO, the class list will +# be sorted only by class name, not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the alphabetical +# list. +# The default value is: NO. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper +# type resolution of all parameters of a function it will reject a match between +# the prototype and the implementation of a member function even if there is +# only one candidate or it is obvious which candidate to choose by doing a +# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still +# accept a match between prototype and implementation in such cases. +# The default value is: NO. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo +# list. This list is created by putting \todo commands in the documentation. +# The default value is: YES. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test +# list. This list is created by putting \test commands in the documentation. +# The default value is: YES. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug +# list. This list is created by putting \bug commands in the documentation. +# The default value is: YES. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) +# the deprecated list. This list is created by putting \deprecated commands in +# the documentation. +# The default value is: YES. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional documentation +# sections, marked by \if ... \endif and \cond +# ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the +# initial value of a variable or macro / define can have for it to appear in the +# documentation. If the initializer consists of more lines than specified here +# it will be hidden. Use a value of 0 to hide initializers completely. The +# appearance of the value of individual variables and macros / defines can be +# controlled using \showinitializer or \hideinitializer command in the +# documentation regardless of this setting. +# Minimum value: 0, maximum value: 10000, default value: 30. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at +# the bottom of the documentation of classes and structs. If set to YES, the +# list will mention the files that were used to generate the documentation. +# The default value is: YES. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This +# will remove the Files entry from the Quick Index and from the Folder Tree View +# (if specified). +# The default value is: YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces +# page. This will remove the Namespaces entry from the Quick Index and from the +# Folder Tree View (if specified). +# The default value is: YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command command input-file, where command is the value of the +# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided +# by doxygen. Whatever the program writes to standard output is used as the file +# version. For an example see the documentation. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. You can +# optionally specify a file name after the option, if omitted DoxygenLayout.xml +# will be used as the name of the layout file. +# +# Note that if you run doxygen from a directory containing a file called +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE +# tag is left empty. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files containing +# the reference definitions. This must be a list of .bib files. The .bib +# extension is automatically appended if omitted. This requires the bibtex tool +# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. +# For LaTeX the style of the bibliography can be controlled using +# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the +# search path. See also \cite for info how to create references. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated to +# standard output by doxygen. If QUIET is set to YES this implies that the +# messages are off. +# The default value is: NO. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES +# this implies that the warnings are on. +# +# Tip: Turn warnings on while writing the documentation. +# The default value is: YES. + +WARNINGS = YES + +# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate +# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: YES. + +WARN_IF_UNDOCUMENTED = YES + +# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some parameters +# in a documented function, or documenting parameters that don't exist or using +# markup commands wrongly. +# The default value is: YES. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that +# are documented, but have no documentation for their parameters or return +# value. If set to NO, doxygen will only warn about wrong or incomplete +# parameter documentation, but not about the absence of documentation. +# The default value is: NO. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that doxygen +# can produce. The string should contain the $file, $line, and $text tags, which +# will be replaced by the file and line number from which the warning originated +# and the warning text. Optionally the format may contain $version, which will +# be replaced by the version of the file (if it could be obtained via +# FILE_VERSION_FILTER) +# The default value is: $file:$line: $text. + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning and error +# messages should be written. If left blank the output is written to standard +# error (stderr). + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag is used to specify the files and/or directories that contain +# documented source files. You may enter file names like myfile.cpp or +# directories like /usr/src/myproject. Separate the files or directories with +# spaces. +# Note: If this tag is empty the current directory is searched. + +INPUT = src/ doc/ + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv +# documentation (see: http://www.gnu.org/software/libiconv) for the list of +# possible encodings. +# The default value is: UTF-8. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank the +# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii, +# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp, +# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown, +# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, +# *.qsf, *.as and *.js. + +FILE_PATTERNS = *.h + +# The RECURSIVE tag can be used to specify whether or not subdirectories should +# be searched for input files as well. +# The default value is: NO. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. +# The default value is: NO. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories use the pattern */test/* + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or directories +# that contain example code fragments that are included (see the \include +# command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank all +# files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude commands +# irrespective of the value of the RECURSIVE tag. +# The default value is: NO. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or directories +# that contain images that are to be included in the documentation (see the +# \image command). + +IMAGE_PATH = doc/ + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command: +# +# +# +# where is the value of the INPUT_FILTER tag, and is the +# name of an input file. Doxygen will then use the output that the filter +# program writes to standard output. If FILTER_PATTERNS is specified, this tag +# will be ignored. +# +# Note that the filter must not add or remove lines; it is applied before the +# code is scanned, but not when the output code is generated. If lines are added +# or removed, the anchors will not be placed correctly. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: pattern=filter +# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how +# filters are used. If the FILTER_PATTERNS tag is empty or if none of the +# patterns match the file name, INPUT_FILTER is applied. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will also be used to filter the input files that are used for +# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). +# The default value is: NO. + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and +# it is also possible to disable source filtering for a specific pattern using +# *.ext= (so without naming a filter). +# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page +# (index.html). This can be useful if you have a project on for instance GitHub +# and want to reuse the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = + +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will be +# generated. Documented entities will be cross-referenced with these sources. +# +# Note: To get rid of all source code in the generated output, make sure that +# also VERBATIM_HEADERS is set to NO. +# The default value is: NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body of functions, +# classes and enums directly into the documentation. +# The default value is: NO. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any +# special comment blocks from generated source code fragments. Normal C, C++ and +# Fortran comments will always remain visible. +# The default value is: YES. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES then for each documented +# function all documented functions referencing it will be listed. +# The default value is: NO. + +REFERENCED_BY_RELATION = YES + +# If the REFERENCES_RELATION tag is set to YES then for each documented function +# all documented entities called/used by that function will be listed. +# The default value is: NO. + +REFERENCES_RELATION = YES + +# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set +# to YES then the hyperlinks from functions in REFERENCES_RELATION and +# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will +# link to the documentation. +# The default value is: YES. + +REFERENCES_LINK_SOURCE = YES + +# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the +# source code will show a tooltip with additional information such as prototype, +# brief description and links to the definition and documentation. Since this +# will make the HTML file larger and loading of large files a bit slower, you +# can opt to disable this feature. +# The default value is: YES. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +SOURCE_TOOLTIPS = YES + +# If the USE_HTAGS tag is set to YES then the references to source code will +# point to the HTML generated by the htags(1) tool instead of doxygen built-in +# source browser. The htags tool is part of GNU's global source tagging system +# (see http://www.gnu.org/software/global/global.html). You will need version +# 4.8.6 or higher. +# +# To use it do the following: +# - Install the latest version of global +# - Enable SOURCE_BROWSER and USE_HTAGS in the config file +# - Make sure the INPUT points to the root of the source tree +# - Run doxygen as normal +# +# Doxygen will invoke htags (and that will in turn invoke gtags), so these +# tools must be available from the command line (i.e. in the search path). +# +# The result: instead of the source browser generated by doxygen, the links to +# source code will now point to the output of htags. +# The default value is: NO. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a +# verbatim copy of the header file for each class for which an include is +# specified. Set to NO to disable this. +# See also: Section \class. +# The default value is: YES. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all +# compounds will be generated. Enable this if the project contains a lot of +# classes, structs, unions or interfaces. +# The default value is: YES. + +ALPHABETICAL_INDEX = NO + +# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in +# which the alphabetical index list will be split. +# Minimum value: 1, maximum value: 20, default value: 5. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all classes will +# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag +# can be used to specify a prefix (or a list of prefixes) that should be ignored +# while generating the index headers. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output +# The default value is: YES. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_OUTPUT = documentation + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each +# generated HTML page (for example: .htm, .php, .asp). +# The default value is: .html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a user-defined HTML header file for +# each generated HTML page. If the tag is left blank doxygen will generate a +# standard header. +# +# To get valid HTML the header file that includes any scripts and style sheets +# that doxygen needs, which is dependent on the configuration options used (e.g. +# the setting GENERATE_TREEVIEW). It is highly recommended to start with a +# default header using +# doxygen -w html new_header.html new_footer.html new_stylesheet.css +# YourConfigFile +# and then modify the file new_header.html. See also section "Doxygen usage" +# for information on how to generate the default header that doxygen normally +# uses. +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. For a description +# of the possible markers and block names see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each +# generated HTML page. If the tag is left blank doxygen will generate a standard +# footer. See HTML_HEADER for more information on how to generate a default +# footer and what special commands can be used inside the footer. See also +# section "Doxygen usage" for information on how to generate the default footer +# that doxygen normally uses. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style +# sheet that is used by each HTML page. It can be used to fine-tune the look of +# the HTML output. If left blank doxygen will generate a default style sheet. +# See also section "Doxygen usage" for information on how to generate the style +# sheet that doxygen normally uses. +# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as +# it is more robust and this tag (HTML_STYLESHEET) will in the future become +# obsolete. +# This tag requires that the tag GENERATE_HTML is set to YES. + +#HTML_STYLESHEET = doc/jrtplib.css + +# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined +# cascading style sheets that are included after the standard style sheets +# created by doxygen. Using this option one can overrule certain style aspects. +# This is preferred over using HTML_STYLESHEET since it does not replace the +# standard style sheet and is therefore more robust against future updates. +# Doxygen will copy the style sheet files to the output directory. +# Note: The order of the extra style sheet files is of importance (e.g. the last +# style sheet in the list overrules the setting of the previous ones in the +# list). For an example see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that the +# files will be copied as-is; there are no commands or markers available. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen +# will adjust the colors in the style sheet and background images according to +# this color. Hue is specified as an angle on a colorwheel, see +# http://en.wikipedia.org/wiki/Hue for more information. For instance the value +# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 +# purple, and 360 is red again. +# Minimum value: 0, maximum value: 359, default value: 220. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors +# in the HTML output. For a value of 0 the output will use grayscales only. A +# value of 255 will produce the most vivid colors. +# Minimum value: 0, maximum value: 255, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the +# luminance component of the colors in the HTML output. Values below 100 +# gradually make the output lighter, whereas values above 100 make the output +# darker. The value divided by 100 is the actual gamma applied, so 80 represents +# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not +# change the gamma. +# Minimum value: 40, maximum value: 240, default value: 80. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting this +# to NO can help when comparing the output of multiple runs. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_TIMESTAMP = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries +# shown in the various tree structured indices initially; the user can expand +# and collapse entries dynamically later on. Doxygen will expand the tree to +# such a level that at most the specified number of entries are visible (unless +# a fully collapsed tree already exceeds this amount). So setting the number of +# entries 1 will produce a full collapsed tree by default. 0 is a special value +# representing an infinite number of entries and will result in a full expanded +# tree by default. +# Minimum value: 0, maximum value: 9999, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files will be +# generated that can be used as input for Apple's Xcode 3 integrated development +# environment (see: http://developer.apple.com/tools/xcode/), introduced with +# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a +# Makefile in the HTML output directory. Running make will produce the docset in +# that directory and running make install will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at +# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_DOCSET = NO + +# This tag determines the name of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# The default value is: Doxygen generated docs. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# This tag specifies a string that should uniquely identify the documentation +# set bundle. This should be a reverse domain-name style string, e.g. +# com.mycompany.MyDocSet. Doxygen will append .docset to the name. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. +# The default value is: org.doxygen.Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. +# The default value is: Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three +# additional HTML index files: index.hhp, index.hhc, and index.hhk. The +# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop +# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on +# Windows. +# +# The HTML Help Workshop contains a compiler that can convert all HTML output +# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML +# files are now used as the Windows 98 help format, and will replace the old +# Windows help format (.hlp) on all Windows platforms in the future. Compressed +# HTML files also contain an index, a table of contents, and you can search for +# words in the documentation. The HTML workshop also contains a viewer for +# compressed HTML files. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_HTMLHELP = NO + +# The CHM_FILE tag can be used to specify the file name of the resulting .chm +# file. You can add a path in front of the file if the result should not be +# written to the html output directory. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_FILE = + +# The HHC_LOCATION tag can be used to specify the location (absolute path +# including file name) of the HTML help compiler (hhc.exe). If non-empty, +# doxygen will try to run the HTML help compiler on the generated index.hhp. +# The file has to be specified with full path. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +HHC_LOCATION = + +# The GENERATE_CHI flag controls if a separate .chi index file is generated +# (YES) or that it should be included in the master .chm file (NO). +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +GENERATE_CHI = NO + +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) +# and project file content. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_INDEX_ENCODING = + +# The BINARY_TOC flag controls whether a binary table of contents is generated +# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it +# enables the Previous and Next buttons. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members to +# the table of contents of the HTML help documentation and to the tree view. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that +# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help +# (.qch) of the generated HTML documentation. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify +# the file name of the resulting .qch file. The path specified is relative to +# the HTML output folder. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help +# Project output. For more information please see Qt Help Project / Namespace +# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt +# Help Project output. For more information please see Qt Help Project / Virtual +# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- +# folders). +# The default value is: doc. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_VIRTUAL_FOLDER = doc + +# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom +# filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's filter section matches. Qt Help Project / Filter Attributes (see: +# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_SECT_FILTER_ATTRS = + +# The QHG_LOCATION tag can be used to specify the location of Qt's +# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the +# generated .qhp file. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be +# generated, together with the HTML files, they form an Eclipse help plugin. To +# install this plugin and make it available under the help contents menu in +# Eclipse, the contents of the directory containing the HTML and XML files needs +# to be copied into the plugins directory of eclipse. The name of the directory +# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. +# After copying Eclipse needs to be restarted before the help appears. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the Eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have this +# name. Each documentation set should have its own identifier. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# If you want full control over the layout of the generated HTML pages it might +# be necessary to disable the index and replace it with your own. The +# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top +# of each HTML page. A value of NO enables the index and the value YES disables +# it. Since the tabs in the index contain the same information as the navigation +# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. If the tag +# value is set to YES, a side panel will be generated containing a tree-like +# index structure (just like the one that is generated for HTML Help). For this +# to work a browser that supports JavaScript, DHTML, CSS and frames is required +# (i.e. any modern browser). Windows users are probably better off using the +# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can +# further fine-tune the look of the index. As an example, the default style +# sheet generated by doxygen has an example that shows how to put an image at +# the root of the tree instead of the PROJECT_NAME. Since the tree basically has +# the same information as the tab index, you could consider setting +# DISABLE_INDEX to YES when enabling this option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_TREEVIEW = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that +# doxygen will group on one line in the generated HTML documentation. +# +# Note that a value of 0 will completely suppress the enum values from appearing +# in the overview section. +# Minimum value: 0, maximum value: 20, default value: 4. +# This tag requires that the tag GENERATE_HTML is set to YES. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used +# to set the initial width (in pixels) of the frame in which the tree is shown. +# Minimum value: 0, maximum value: 1500, default value: 250. +# This tag requires that the tag GENERATE_HTML is set to YES. + +TREEVIEW_WIDTH = 250 + +# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to +# external symbols imported via tag files in a separate window. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of LaTeX formulas included as images in +# the HTML documentation. When you change the font size after a successful +# doxygen run you need to manually remove any form_*.png images from the HTML +# output directory to force them to be regenerated. +# Minimum value: 8, maximum value: 50, default value: 10. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are not +# supported properly for IE 6.0, but are supported on all modern browsers. +# +# Note that when changing this option you need to delete any form_*.png files in +# the HTML output directory before the changes have effect. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see +# http://www.mathjax.org) which uses client side Javascript for the rendering +# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX +# installed or if you want to formulas look prettier in the HTML output. When +# enabled you may also need to install MathJax separately and configure the path +# to it using the MATHJAX_RELPATH option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +USE_MATHJAX = NO + +# When MathJax is enabled you can set the default output format to be used for +# the MathJax output. See the MathJax site (see: +# http://docs.mathjax.org/en/latest/output.html) for more details. +# Possible values are: HTML-CSS (which is slower, but has the best +# compatibility), NativeMML (i.e. MathML) and SVG. +# The default value is: HTML-CSS. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the HTML +# output directory using the MATHJAX_RELPATH option. The destination directory +# should contain the MathJax.js script. For instance, if the mathjax directory +# is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax +# Content Delivery Network so you can quickly see the result without installing +# MathJax. However, it is strongly recommended to install a local copy of +# MathJax from http://www.mathjax.org before deployment. +# The default value is: http://cdn.mathjax.org/mathjax/latest. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest + +# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax +# extension names that should be enabled during MathJax rendering. For example +# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_EXTENSIONS = + +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces +# of code that will be used on startup of the MathJax code. See the MathJax site +# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# example see the documentation. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_CODEFILE = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box for +# the HTML output. The underlying search engine uses javascript and DHTML and +# should work on any modern browser. Note that when using HTML help +# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) +# there is already a search function so this one should typically be disabled. +# For large projects the javascript based search engine can be slow, then +# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to +# search using the keyboard; to jump to the search box use + S +# (what the is depends on the OS and browser, but it is typically +# , /