00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef __OPAL_RTP_H
00035 #define __OPAL_RTP_H
00036
00037 #ifdef P_USE_PRAGMA
00038 #pragma interface
00039 #endif
00040
00041 #include <opal/buildopts.h>
00042 #include <ptlib/sockets.h>
00043
00044
00045 class RTP_JitterBuffer;
00046 class PSTUNClient;
00047 class OpalSecurityMode;
00048
00049 #if OPAL_RTP_AGGREGATE
00050 #include <ptclib/sockagg.h>
00051 #else
00052 typedef void * PHandleAggregator;
00053 typedef void * RTP_AggregatedHandle;
00054 #endif
00055
00057
00058
00059
00060 class RTP_QOS : public PObject
00061 {
00062 PCLASSINFO(RTP_QOS,PObject);
00063 public:
00064 PQoS dataQoS;
00065 PQoS ctrlQoS;
00066 };
00067
00069
00070
00073 class RTP_DataFrame : public PBYTEArray
00074 {
00075 PCLASSINFO(RTP_DataFrame, PBYTEArray);
00076
00077 public:
00078 RTP_DataFrame(PINDEX payloadSize = 2048);
00079 RTP_DataFrame(const BYTE * data, PINDEX len, PBoolean dynamic = PTrue);
00080
00081 enum {
00082 ProtocolVersion = 2,
00083 MinHeaderSize = 12,
00084
00085 MaxMtuPayloadSize = (576-20-16-12)
00086 };
00087
00088 enum PayloadTypes {
00089 PCMU,
00090 FS1016,
00091 G721,
00092 G726 = G721,
00093 GSM,
00094 G7231,
00095 DVI4_8k,
00096 DVI4_16k,
00097 LPC,
00098 PCMA,
00099 G722,
00100 L16_Stereo,
00101 L16_Mono,
00102 G723,
00103 CN,
00104 MPA,
00105 G728,
00106 DVI4_11k,
00107 DVI4_22k,
00108 G729,
00109 Cisco_CN,
00110
00111 CelB = 25,
00112 JPEG,
00113 H261 = 31,
00114 MPV,
00115 MP2T,
00116 H263,
00117
00118 LastKnownPayloadType,
00119
00120 DynamicBase = 96,
00121 MaxPayloadType = 127,
00122 IllegalPayloadType
00123 };
00124
00125 typedef std::map<PayloadTypes, PayloadTypes> PayloadMapType;
00126
00127 unsigned GetVersion() const { return (theArray[0]>>6)&3; }
00128
00129 PBoolean GetExtension() const { return (theArray[0]&0x10) != 0; }
00130 void SetExtension(PBoolean ext);
00131
00132 PBoolean GetMarker() const { return (theArray[1]&0x80) != 0; }
00133 void SetMarker(PBoolean m);
00134
00135 bool GetPadding() const { return (theArray[0]&0x20) != 0; }
00136 void SetPadding(bool v) { if (v) theArray[0] |= 0x20; else theArray[0] &= 0xdf; }
00137
00138 unsigned GetPaddingSize() const;
00139
00140 PayloadTypes GetPayloadType() const { return (PayloadTypes)(theArray[1]&0x7f); }
00141 void SetPayloadType(PayloadTypes t);
00142
00143 WORD GetSequenceNumber() const { return *(PUInt16b *)&theArray[2]; }
00144 void SetSequenceNumber(WORD n) { *(PUInt16b *)&theArray[2] = n; }
00145
00146 DWORD GetTimestamp() const { return *(PUInt32b *)&theArray[4]; }
00147 void SetTimestamp(DWORD t) { *(PUInt32b *)&theArray[4] = t; }
00148
00149 DWORD GetSyncSource() const { return *(PUInt32b *)&theArray[8]; }
00150 void SetSyncSource(DWORD s) { *(PUInt32b *)&theArray[8] = s; }
00151
00152 PINDEX GetContribSrcCount() const { return theArray[0]&0xf; }
00153 DWORD GetContribSource(PINDEX idx) const;
00154 void SetContribSource(PINDEX idx, DWORD src);
00155
00156 PINDEX GetHeaderSize() const;
00157
00158 int GetExtensionType() const;
00159 void SetExtensionType(int type);
00160 PINDEX GetExtensionSize() const;
00161 PBoolean SetExtensionSize(PINDEX sz);
00162 BYTE * GetExtensionPtr() const;
00163
00164 PINDEX GetPayloadSize() const { return payloadSize - GetPaddingSize(); }
00165 PBoolean SetPayloadSize(PINDEX sz);
00166 BYTE * GetPayloadPtr() const { return (BYTE *)(theArray+GetHeaderSize()); }
00167
00168 virtual void PrintOn(ostream & strm) const;
00169
00170 protected:
00171 PINDEX payloadSize;
00172
00173 #if PTRACING
00174 friend ostream & operator<<(ostream & o, PayloadTypes t);
00175 #endif
00176 };
00177
00178 PLIST(RTP_DataFrameList, RTP_DataFrame);
00179
00180
00183 class RTP_ControlFrame : public PBYTEArray
00184 {
00185 PCLASSINFO(RTP_ControlFrame, PBYTEArray);
00186
00187 public:
00188 RTP_ControlFrame(PINDEX compoundSize = 2048);
00189
00190 unsigned GetVersion() const { return (BYTE)theArray[compoundOffset]>>6; }
00191
00192 unsigned GetCount() const { return (BYTE)theArray[compoundOffset]&0x1f; }
00193 void SetCount(unsigned count);
00194
00195 enum PayloadTypes {
00196 e_IntraFrameRequest = 192,
00197 e_SenderReport = 200,
00198 e_ReceiverReport,
00199 e_SourceDescription,
00200 e_Goodbye,
00201 e_ApplDefined
00202 };
00203
00204 unsigned GetPayloadType() const { return (BYTE)theArray[compoundOffset+1]; }
00205 void SetPayloadType(unsigned t);
00206
00207 PINDEX GetPayloadSize() const { return 4*(*(PUInt16b *)&theArray[compoundOffset+2]); }
00208 void SetPayloadSize(PINDEX sz);
00209
00210 BYTE * GetPayloadPtr() const;
00211
00212 PBoolean ReadNextPacket();
00213 PBoolean StartNewPacket();
00214 void EndPacket();
00215
00216 PINDEX GetCompoundSize() const;
00217
00218 void Reset(PINDEX size);
00219
00220 #pragma pack(1)
00221 struct ReceiverReport {
00222 PUInt32b ssrc;
00223 BYTE fraction;
00224 BYTE lost[3];
00225 PUInt32b last_seq;
00226 PUInt32b jitter;
00227 PUInt32b lsr;
00228 PUInt32b dlsr;
00229
00230 unsigned GetLostPackets() const { return (lost[0]<<16U)+(lost[1]<<8U)+lost[2]; }
00231 void SetLostPackets(unsigned lost);
00232 };
00233
00234 struct SenderReport {
00235 PUInt32b ntp_sec;
00236 PUInt32b ntp_frac;
00237 PUInt32b rtp_ts;
00238 PUInt32b psent;
00239 PUInt32b osent;
00240 };
00241
00242 enum DescriptionTypes {
00243 e_END,
00244 e_CNAME,
00245 e_NAME,
00246 e_EMAIL,
00247 e_PHONE,
00248 e_LOC,
00249 e_TOOL,
00250 e_NOTE,
00251 e_PRIV,
00252 NumDescriptionTypes
00253 };
00254
00255 struct SourceDescription {
00256 PUInt32b src;
00257 struct Item {
00258 BYTE type;
00259 BYTE length;
00260 char data[1];
00261
00262
00263
00264
00265
00266 unsigned int GetLengthTotal() const {return (unsigned int)(length + 2);}
00267 const Item * GetNextItem() const { return (const Item *)((char *)this + length + 2); }
00268 Item * GetNextItem() { return (Item *)((char *)this + length + 2); }
00269 } item[1];
00270 };
00271
00272 void StartSourceDescription(
00273 DWORD src
00274 );
00275
00276 void AddSourceDescriptionItem(
00277 unsigned type,
00278 const PString & data
00279 );
00280 #pragma pack()
00281
00282 protected:
00283 PINDEX compoundOffset;
00284 PINDEX payloadSize;
00285 };
00286
00287
00288 class RTP_Session;
00289
00291
00292 #ifdef OPAL_STATISTICS
00293
00296 class OpalMediaStatistics : public PObject
00297 {
00298 PCLASSINFO(OpalMediaStatistics, PObject);
00299 public:
00300 OpalMediaStatistics();
00301
00302
00303 PUInt64 m_totalBytes;
00304 unsigned m_totalPackets;
00305 unsigned m_packetsLost;
00306 unsigned m_packetsOutOfOrder;
00307 unsigned m_packetsTooLate;
00308 unsigned m_packetOverruns;
00309 unsigned m_minimumPacketTime;
00310 unsigned m_averagePacketTime;
00311 unsigned m_maximumPacketTime;
00312
00313
00314 unsigned m_averageJitter;
00315 unsigned m_maximumJitter;
00316
00317
00318 unsigned m_totalFrames;
00319 unsigned m_keyFrames;
00320 };
00321
00322 #endif
00323
00324
00329 class RTP_UserData : public PObject
00330 {
00331 PCLASSINFO(RTP_UserData, PObject);
00332
00333 public:
00340 virtual void OnTxStatistics(
00341 const RTP_Session & session
00342 ) const;
00343
00350 virtual void OnRxStatistics(
00351 const RTP_Session & session
00352 ) const;
00353
00354 #if OPAL_VIDEO
00355
00360 virtual void OnTxIntraFrameRequest(
00361 const RTP_Session & session
00362 ) const;
00363
00369 virtual void OnRxIntraFrameRequest(
00370 const RTP_Session & session
00371 ) const;
00372 #endif
00373 };
00374
00375
00378 class RTP_Session : public PObject
00379 {
00380 PCLASSINFO(RTP_Session, PObject);
00381
00382 public:
00387 RTP_Session(
00388 #if OPAL_RTP_AGGREGATE
00389 PHandleAggregator * aggregator,
00390 #endif
00391 unsigned id,
00392 RTP_UserData * userData = NULL,
00393 PBoolean autoDeleteUserData = PTrue
00394 );
00395
00399 ~RTP_Session();
00401
00413 void SetJitterBufferSize(
00414 unsigned minJitterDelay,
00415 unsigned maxJitterDelay,
00416 unsigned timeUnits = 8,
00417 PINDEX stackSize = 30000
00418 );
00419
00425 unsigned GetJitterBufferSize() const;
00426
00429 unsigned GetJitterTimeUnits() const;
00430
00432 virtual PBoolean ModifyQOS(RTP_QOS * )
00433 { return PFalse; }
00434
00440 virtual PBoolean ReadBufferedData(
00441 RTP_DataFrame & frame
00442 );
00443
00449 virtual PBoolean ReadData(
00450 RTP_DataFrame & frame,
00451 PBoolean loop
00452 ) = 0;
00453
00456 virtual PBoolean WriteData(
00457 RTP_DataFrame & frame
00458 ) = 0;
00459
00463 virtual PBoolean WriteOOBData(
00464 RTP_DataFrame & frame,
00465 bool rewriteTimeStamp = true
00466 );
00467
00470 virtual PBoolean WriteControl(
00471 RTP_ControlFrame & frame
00472 ) = 0;
00473
00476 virtual PBoolean SendReport();
00477
00480 virtual void Close(
00481 PBoolean reading
00482 ) = 0;
00483
00486 virtual void Reopen(
00487 PBoolean isReading
00488 ) = 0;
00489
00492 virtual PString GetLocalHostName() = 0;
00493
00494 #ifdef OPAL_STATISTICS
00495 virtual void GetStatistics(OpalMediaStatistics & statistics, bool receiver) const;
00496 #endif
00497
00498
00501 enum SendReceiveStatus {
00502 e_ProcessPacket,
00503 e_IgnorePacket,
00504 e_AbortTransport
00505 };
00506 virtual SendReceiveStatus OnSendData(RTP_DataFrame & frame);
00507 virtual SendReceiveStatus OnSendControl(RTP_ControlFrame & frame, PINDEX & len);
00508 virtual SendReceiveStatus OnReceiveData(RTP_DataFrame & frame);
00509 virtual SendReceiveStatus OnReceiveControl(RTP_ControlFrame & frame);
00510
00511 class ReceiverReport : public PObject {
00512 PCLASSINFO(ReceiverReport, PObject);
00513 public:
00514 void PrintOn(ostream &) const;
00515
00516 DWORD sourceIdentifier;
00517 DWORD fractionLost;
00518 DWORD totalLost;
00519 DWORD lastSequenceNumber;
00520 DWORD jitter;
00521 PTimeInterval lastTimestamp;
00522 PTimeInterval delay;
00523 };
00524 PARRAY(ReceiverReportArray, ReceiverReport);
00525
00526 class SenderReport : public PObject {
00527 PCLASSINFO(SenderReport, PObject);
00528 public:
00529 void PrintOn(ostream &) const;
00530
00531 DWORD sourceIdentifier;
00532 PTime realTimestamp;
00533 DWORD rtpTimestamp;
00534 DWORD packetsSent;
00535 DWORD octetsSent;
00536 };
00537 virtual void OnRxSenderReport(const SenderReport & sender,
00538 const ReceiverReportArray & reports);
00539 virtual void OnRxReceiverReport(DWORD src,
00540 const ReceiverReportArray & reports);
00541
00542 class SourceDescription : public PObject {
00543 PCLASSINFO(SourceDescription, PObject);
00544 public:
00545 SourceDescription(DWORD src) { sourceIdentifier = src; }
00546 void PrintOn(ostream &) const;
00547
00548 DWORD sourceIdentifier;
00549 POrdinalToString items;
00550 };
00551 PARRAY(SourceDescriptionArray, SourceDescription);
00552 virtual void OnRxSourceDescription(const SourceDescriptionArray & descriptions);
00553
00554 virtual void OnRxGoodbye(const PDWORDArray & sources,
00555 const PString & reason);
00556
00557 virtual void OnRxApplDefined(const PString & type, unsigned subtype, DWORD src,
00558 const BYTE * data, PINDEX size);
00560
00565 unsigned GetSessionID() const { return sessionID; }
00566
00569 bool IsAudio() const { return isAudio; }
00570
00573 void SetAudio(
00574 bool aud
00575 ) { isAudio = aud; }
00576
00579 PString GetCanonicalName() const;
00580
00583 void SetCanonicalName(const PString & name);
00584
00587 PString GetToolName() const;
00588
00591 void SetToolName(const PString & name);
00592
00595 RTP_UserData * GetUserData() const { return userData; }
00596
00599 void SetUserData(
00600 RTP_UserData * data,
00601 PBoolean autoDeleteUserData = PTrue
00602 );
00603
00606 DWORD GetSyncSourceOut() const { return syncSourceOut; }
00607
00610 void IncrementReference() { referenceCount++; }
00611
00614 PBoolean DecrementReference() { return --referenceCount == 0; }
00615
00618 bool AllowAnySyncSource() const { return allowAnySyncSource; }
00619
00622 void SetAnySyncSource(
00623 bool allow
00624 ) { allowAnySyncSource = allow; }
00625
00628 PBoolean WillIgnoreOutOfOrderPackets() const { return ignoreOutOfOrderPackets; }
00629
00632 void SetIgnoreOutOfOrderPackets(
00633 PBoolean ignore
00634 ) { ignoreOutOfOrderPackets = ignore; }
00635
00638 void SetIgnorePayloadTypeChanges(
00639 PBoolean ignore
00640 ) { ignorePayloadTypeChanges = ignore; }
00641
00644 const PTimeInterval & GetReportTimeInterval() { return reportTimeInterval; }
00645
00648 void SetReportTimeInterval(
00649 const PTimeInterval & interval
00650 ) { reportTimeInterval = interval; }
00651
00654 PTimeInterval GetReportTimer()
00655 { return reportTimer; }
00656
00659 unsigned GetTxStatisticsInterval() { return txStatisticsInterval; }
00660
00663 void SetTxStatisticsInterval(
00664 unsigned packets
00665 );
00666
00669 unsigned GetRxStatisticsInterval() { return rxStatisticsInterval; }
00670
00673 void SetRxStatisticsInterval(
00674 unsigned packets
00675 );
00676
00679 DWORD GetPacketsSent() const { return packetsSent; }
00680
00683 DWORD GetOctetsSent() const { return octetsSent; }
00684
00687 DWORD GetPacketsReceived() const { return packetsReceived; }
00688
00691 DWORD GetOctetsReceived() const { return octetsReceived; }
00692
00695 DWORD GetPacketsLost() const { return packetsLost; }
00696
00699 DWORD GetPacketsOutOfOrder() const { return packetsOutOfOrder; }
00700
00703 DWORD GetPacketsTooLate() const;
00704
00707 DWORD GetPacketOverruns() const;
00708
00713 DWORD GetAverageSendTime() const { return averageSendTime; }
00714
00719 DWORD GetMarkerRecvCount() const { return markerRecvCount; }
00720
00725 DWORD GetMarkerSendCount() const { return markerSendCount; }
00726
00731 DWORD GetMaximumSendTime() const { return maximumSendTime; }
00732
00737 DWORD GetMinimumSendTime() const { return minimumSendTime; }
00738
00743 DWORD GetAverageReceiveTime() const { return averageReceiveTime; }
00744
00749 DWORD GetMaximumReceiveTime() const { return maximumReceiveTime; }
00750
00755 DWORD GetMinimumReceiveTime() const { return minimumReceiveTime; }
00756
00761 DWORD GetAvgJitterTime() const { return jitterLevel>>7; }
00762
00766 DWORD GetMaxJitterTime() const { return maximumJitterLevel>>7; }
00768
00771 virtual int GetDataSocketHandle() const
00772 { return -1; }
00773 virtual int GetControlSocketHandle() const
00774 { return -1; }
00776
00777 virtual void SendBYE();
00778 virtual void SetCloseOnBYE(PBoolean v) { closeOnBye = v; }
00779
00780 #if OPAL_VIDEO
00781
00785 virtual void SendIntraFrameRequest();
00786 #endif
00787
00788 protected:
00789 void AddReceiverReport(RTP_ControlFrame::ReceiverReport & receiver);
00790 PBoolean InsertReportPacket(RTP_ControlFrame & report);
00791
00792 unsigned sessionID;
00793 bool isAudio;
00794 PString canonicalName;
00795 PString toolName;
00796 unsigned referenceCount;
00797 RTP_UserData * userData;
00798 PBoolean autoDeleteUserData;
00799 PMutex jitterMutex;
00800 RTP_JitterBuffer * jitter;
00801
00802 PBoolean ignoreOutOfOrderPackets;
00803 DWORD syncSourceOut;
00804 DWORD syncSourceIn;
00805 DWORD lastSentTimestamp;
00806 bool allowAnySyncSource;
00807 bool allowOneSyncSourceChange;
00808 PBoolean allowRemoteTransmitAddressChange;
00809 PBoolean allowSequenceChange;
00810 PTimeInterval reportTimeInterval;
00811 unsigned txStatisticsInterval;
00812 unsigned rxStatisticsInterval;
00813 WORD lastSentSequenceNumber;
00814 WORD expectedSequenceNumber;
00815 PTimeInterval lastSentPacketTime;
00816 PTimeInterval lastReceivedPacketTime;
00817 WORD lastRRSequenceNumber;
00818 PINDEX consecutiveOutOfOrderPackets;
00819
00820 PMutex dataMutex;
00821 DWORD timeStampOffs;
00822 PBoolean oobTimeStampBaseEstablished;
00823 DWORD oobTimeStampOutBase;
00824 PTimeInterval oobTimeStampBase;
00825
00826
00827 DWORD packetsSent;
00828 DWORD rtcpPacketsSent;
00829 DWORD octetsSent;
00830 DWORD packetsReceived;
00831 DWORD octetsReceived;
00832 DWORD packetsLost;
00833 DWORD packetsOutOfOrder;
00834 DWORD averageSendTime;
00835 DWORD maximumSendTime;
00836 DWORD minimumSendTime;
00837 DWORD averageReceiveTime;
00838 DWORD maximumReceiveTime;
00839 DWORD minimumReceiveTime;
00840 DWORD jitterLevel;
00841 DWORD maximumJitterLevel;
00842
00843 DWORD markerSendCount;
00844 DWORD markerRecvCount;
00845
00846 unsigned txStatisticsCount;
00847 unsigned rxStatisticsCount;
00848
00849 DWORD averageSendTimeAccum;
00850 DWORD maximumSendTimeAccum;
00851 DWORD minimumSendTimeAccum;
00852 DWORD averageReceiveTimeAccum;
00853 DWORD maximumReceiveTimeAccum;
00854 DWORD minimumReceiveTimeAccum;
00855 DWORD packetsLostSinceLastRR;
00856 DWORD lastTransitTime;
00857
00858 RTP_DataFrame::PayloadTypes lastReceivedPayloadType;
00859 PBoolean ignorePayloadTypeChanges;
00860
00861 PMutex reportMutex;
00862 PTimer reportTimer;
00863
00864 #if OPAL_RTP_AGGREGATE
00865 PHandleAggregator * aggregator;
00866 #endif
00867
00868 PBoolean closeOnBye;
00869 PBoolean byeSent;
00870 };
00871
00872
00875 class RTP_SessionManager : public PObject
00876 {
00877 PCLASSINFO(RTP_SessionManager, PObject);
00878
00879 public:
00884 RTP_SessionManager();
00885 RTP_SessionManager(const RTP_SessionManager & sm);
00886 RTP_SessionManager & operator=(const RTP_SessionManager & sm);
00888
00889
00903 RTP_Session * UseSession(
00904 unsigned sessionID
00905 );
00906
00913 void AddSession(
00914 RTP_Session * session
00915 );
00916
00920 void ReleaseSession(
00921 unsigned sessionID,
00922 PBoolean clearAll = PFalse
00923 );
00924
00929 RTP_Session * GetSession(
00930 unsigned sessionID
00931 ) const;
00932
00949 RTP_Session * First();
00950
00957 RTP_Session * Next();
00958
00966 void Exit();
00968
00969
00970 protected:
00971 PDICTIONARY(SessionDict, POrdinalKey, RTP_Session);
00972 SessionDict sessions;
00973 PMutex mutex;
00974 PINDEX enumerationIndex;
00975 };
00976
00977
00978
00981 class RTP_UDP : public RTP_Session
00982 {
00983 PCLASSINFO(RTP_UDP, RTP_Session);
00984
00985 public:
00990 RTP_UDP(
00991 #if OPAL_RTP_AGGREGATE
00992 PHandleAggregator * aggregator,
00993 #endif
00994 unsigned id,
00995 PBoolean remoteIsNAT
00996 );
00997
00999 ~RTP_UDP();
01001
01009 virtual PBoolean ReadData(RTP_DataFrame & frame, PBoolean loop);
01010
01013 virtual PBoolean WriteData(RTP_DataFrame & frame);
01014
01018 virtual PBoolean WriteOOBData(RTP_DataFrame & frame, bool setTimeStamp = true);
01019
01022 virtual PBoolean WriteControl(RTP_ControlFrame & frame);
01023
01026 virtual void Close(
01027 PBoolean reading
01028 );
01029
01032 virtual PString GetLocalHostName();
01034
01037 virtual PBoolean ModifyQOS(RTP_QOS * rtpqos);
01038
01043 virtual PBoolean Open(
01044 PIPSocket::Address localAddress,
01045 WORD portBase,
01046 WORD portMax,
01047 BYTE ipTypeOfService,
01048 PSTUNClient * stun = NULL,
01049 RTP_QOS * rtpqos = NULL
01050 );
01052
01055 virtual void Reopen(PBoolean isReading);
01057
01062 virtual PIPSocket::Address GetLocalAddress() const { return localAddress; }
01063
01066 virtual void SetLocalAddress(
01067 const PIPSocket::Address & addr
01068 ) { localAddress = addr; }
01069
01072 PIPSocket::Address GetRemoteAddress() const { return remoteAddress; }
01073
01076 virtual WORD GetLocalDataPort() const { return localDataPort; }
01077
01080 virtual WORD GetLocalControlPort() const { return localControlPort; }
01081
01084 virtual WORD GetRemoteDataPort() const { return remoteDataPort; }
01085
01088 virtual WORD GetRemoteControlPort() const { return remoteControlPort; }
01089
01092 virtual PUDPSocket & GetDataSocket() { return *dataSocket; }
01093
01096 virtual PUDPSocket & GetControlSocket() { return *controlSocket; }
01097
01100 virtual PBoolean SetRemoteSocketInfo(
01101 PIPSocket::Address address,
01102 WORD port,
01103 PBoolean isDataPort
01104 );
01105
01108 virtual void ApplyQOS(
01109 const PIPSocket::Address & addr
01110 );
01112
01113 virtual int GetDataSocketHandle() const
01114 { return dataSocket != NULL ? dataSocket->GetHandle() : -1; }
01115
01116 virtual int GetControlSocketHandle() const
01117 { return controlSocket != NULL ? controlSocket->GetHandle() : -1; }
01118
01119 protected:
01120 virtual int WaitForPDU(PUDPSocket & dataSocket, PUDPSocket & controlSocket, const PTimeInterval & timer);
01121 virtual SendReceiveStatus ReadDataPDU(RTP_DataFrame & frame);
01122 virtual SendReceiveStatus ReadControlPDU();
01123 virtual SendReceiveStatus ReadDataOrControlPDU(
01124 PUDPSocket & socket,
01125 PBYTEArray & frame,
01126 PBoolean fromDataChannel
01127 );
01128
01129 PIPSocket::Address localAddress;
01130 WORD localDataPort;
01131 WORD localControlPort;
01132
01133 PIPSocket::Address remoteAddress;
01134 WORD remoteDataPort;
01135 WORD remoteControlPort;
01136
01137 PIPSocket::Address remoteTransmitAddress;
01138
01139 PBoolean shutdownRead;
01140 PBoolean shutdownWrite;
01141
01142 PUDPSocket * dataSocket;
01143 PUDPSocket * controlSocket;
01144
01145 PBoolean appliedQOS;
01146 PBoolean remoteIsNAT;
01147 PBoolean first;
01148 };
01149
01151
01152 class SecureRTP_UDP : public RTP_UDP
01153 {
01154 PCLASSINFO(SecureRTP_UDP, RTP_UDP);
01155
01156 public:
01161 SecureRTP_UDP(
01162 #if OPAL_RTP_AGGREGATE
01163 PHandleAggregator * aggregator,
01164 #endif
01165 unsigned id,
01166 PBoolean remoteIsNAT
01167 );
01168
01170 ~SecureRTP_UDP();
01171
01172 virtual void SetSecurityMode(OpalSecurityMode * srtpParms);
01173 virtual OpalSecurityMode * GetSecurityParms() const;
01174
01175 protected:
01176 OpalSecurityMode * securityParms;
01177 };
01178
01179 #endif // __OPAL_RTP_H
01180