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 RTP_JitterBuffer * jitter;
00800
00801 PBoolean ignoreOutOfOrderPackets;
00802 DWORD syncSourceOut;
00803 DWORD syncSourceIn;
00804 DWORD lastSentTimestamp;
00805 bool allowAnySyncSource;
00806 bool allowOneSyncSourceChange;
00807 PBoolean allowRemoteTransmitAddressChange;
00808 PBoolean allowSequenceChange;
00809 PTimeInterval reportTimeInterval;
00810 unsigned txStatisticsInterval;
00811 unsigned rxStatisticsInterval;
00812 WORD lastSentSequenceNumber;
00813 WORD expectedSequenceNumber;
00814 PTimeInterval lastSentPacketTime;
00815 PTimeInterval lastReceivedPacketTime;
00816 WORD lastRRSequenceNumber;
00817 PINDEX consecutiveOutOfOrderPackets;
00818
00819 PMutex sendDataMutex;
00820 DWORD timeStampOffs;
00821 PBoolean oobTimeStampBaseEstablished;
00822 DWORD oobTimeStampOutBase;
00823 PTimeInterval oobTimeStampBase;
00824
00825
00826 DWORD packetsSent;
00827 DWORD rtcpPacketsSent;
00828 DWORD octetsSent;
00829 DWORD packetsReceived;
00830 DWORD octetsReceived;
00831 DWORD packetsLost;
00832 DWORD packetsOutOfOrder;
00833 DWORD averageSendTime;
00834 DWORD maximumSendTime;
00835 DWORD minimumSendTime;
00836 DWORD averageReceiveTime;
00837 DWORD maximumReceiveTime;
00838 DWORD minimumReceiveTime;
00839 DWORD jitterLevel;
00840 DWORD maximumJitterLevel;
00841
00842 DWORD markerSendCount;
00843 DWORD markerRecvCount;
00844
00845 unsigned txStatisticsCount;
00846 unsigned rxStatisticsCount;
00847
00848 DWORD averageSendTimeAccum;
00849 DWORD maximumSendTimeAccum;
00850 DWORD minimumSendTimeAccum;
00851 DWORD averageReceiveTimeAccum;
00852 DWORD maximumReceiveTimeAccum;
00853 DWORD minimumReceiveTimeAccum;
00854 DWORD packetsLostSinceLastRR;
00855 DWORD lastTransitTime;
00856
00857 RTP_DataFrame::PayloadTypes lastReceivedPayloadType;
00858 PBoolean ignorePayloadTypeChanges;
00859
00860 PMutex reportMutex;
00861 PTimer reportTimer;
00862
00863 #if OPAL_RTP_AGGREGATE
00864 PHandleAggregator * aggregator;
00865 #endif
00866
00867 PBoolean closeOnBye;
00868 PBoolean byeSent;
00869 };
00870
00871
00874 class RTP_SessionManager : public PObject
00875 {
00876 PCLASSINFO(RTP_SessionManager, PObject);
00877
00878 public:
00883 RTP_SessionManager();
00884 RTP_SessionManager(const RTP_SessionManager & sm);
00885 RTP_SessionManager & operator=(const RTP_SessionManager & sm);
00887
00888
00902 RTP_Session * UseSession(
00903 unsigned sessionID
00904 );
00905
00912 void AddSession(
00913 RTP_Session * session
00914 );
00915
00919 void ReleaseSession(
00920 unsigned sessionID,
00921 PBoolean clearAll = PFalse
00922 );
00923
00928 RTP_Session * GetSession(
00929 unsigned sessionID
00930 ) const;
00931
00948 RTP_Session * First();
00949
00956 RTP_Session * Next();
00957
00965 void Exit();
00967
00968
00969 protected:
00970 PDICTIONARY(SessionDict, POrdinalKey, RTP_Session);
00971 SessionDict sessions;
00972 PMutex mutex;
00973 PINDEX enumerationIndex;
00974 };
00975
00976
00977
00980 class RTP_UDP : public RTP_Session
00981 {
00982 PCLASSINFO(RTP_UDP, RTP_Session);
00983
00984 public:
00989 RTP_UDP(
00990 #if OPAL_RTP_AGGREGATE
00991 PHandleAggregator * aggregator,
00992 #endif
00993 unsigned id,
00994 PBoolean remoteIsNAT
00995 );
00996
00998 ~RTP_UDP();
01000
01008 virtual PBoolean ReadData(RTP_DataFrame & frame, PBoolean loop);
01009
01012 virtual PBoolean WriteData(RTP_DataFrame & frame);
01013
01017 virtual PBoolean WriteOOBData(RTP_DataFrame & frame, bool setTimeStamp = true);
01018
01021 virtual PBoolean WriteControl(RTP_ControlFrame & frame);
01022
01025 virtual void Close(
01026 PBoolean reading
01027 );
01028
01031 virtual PString GetLocalHostName();
01033
01036 virtual PBoolean ModifyQOS(RTP_QOS * rtpqos);
01037
01042 virtual PBoolean Open(
01043 PIPSocket::Address localAddress,
01044 WORD portBase,
01045 WORD portMax,
01046 BYTE ipTypeOfService,
01047 PSTUNClient * stun = NULL,
01048 RTP_QOS * rtpqos = NULL
01049 );
01051
01054 virtual void Reopen(PBoolean isReading);
01056
01061 virtual PIPSocket::Address GetLocalAddress() const { return localAddress; }
01062
01065 virtual void SetLocalAddress(
01066 const PIPSocket::Address & addr
01067 ) { localAddress = addr; }
01068
01071 PIPSocket::Address GetRemoteAddress() const { return remoteAddress; }
01072
01075 virtual WORD GetLocalDataPort() const { return localDataPort; }
01076
01079 virtual WORD GetLocalControlPort() const { return localControlPort; }
01080
01083 virtual WORD GetRemoteDataPort() const { return remoteDataPort; }
01084
01087 virtual WORD GetRemoteControlPort() const { return remoteControlPort; }
01088
01091 virtual PUDPSocket & GetDataSocket() { return *dataSocket; }
01092
01095 virtual PUDPSocket & GetControlSocket() { return *controlSocket; }
01096
01099 virtual PBoolean SetRemoteSocketInfo(
01100 PIPSocket::Address address,
01101 WORD port,
01102 PBoolean isDataPort
01103 );
01104
01107 virtual void ApplyQOS(
01108 const PIPSocket::Address & addr
01109 );
01111
01112 virtual int GetDataSocketHandle() const
01113 { return dataSocket != NULL ? dataSocket->GetHandle() : -1; }
01114
01115 virtual int GetControlSocketHandle() const
01116 { return controlSocket != NULL ? controlSocket->GetHandle() : -1; }
01117
01118 protected:
01119 virtual int WaitForPDU(PUDPSocket & dataSocket, PUDPSocket & controlSocket, const PTimeInterval & timer);
01120 virtual SendReceiveStatus ReadDataPDU(RTP_DataFrame & frame);
01121 virtual SendReceiveStatus ReadControlPDU();
01122 virtual SendReceiveStatus ReadDataOrControlPDU(
01123 PUDPSocket & socket,
01124 PBYTEArray & frame,
01125 PBoolean fromDataChannel
01126 );
01127
01128 PIPSocket::Address localAddress;
01129 WORD localDataPort;
01130 WORD localControlPort;
01131
01132 PIPSocket::Address remoteAddress;
01133 WORD remoteDataPort;
01134 WORD remoteControlPort;
01135
01136 PIPSocket::Address remoteTransmitAddress;
01137
01138 PBoolean shutdownRead;
01139 PBoolean shutdownWrite;
01140
01141 PUDPSocket * dataSocket;
01142 PUDPSocket * controlSocket;
01143
01144 PBoolean appliedQOS;
01145 PBoolean remoteIsNAT;
01146 PBoolean first;
01147 };
01148
01150
01151 class SecureRTP_UDP : public RTP_UDP
01152 {
01153 PCLASSINFO(SecureRTP_UDP, RTP_UDP);
01154
01155 public:
01160 SecureRTP_UDP(
01161 #if OPAL_RTP_AGGREGATE
01162 PHandleAggregator * aggregator,
01163 #endif
01164 unsigned id,
01165 PBoolean remoteIsNAT
01166 );
01167
01169 ~SecureRTP_UDP();
01170
01171 virtual void SetSecurityMode(OpalSecurityMode * srtpParms);
01172 virtual OpalSecurityMode * GetSecurityParms() const;
01173
01174 protected:
01175 OpalSecurityMode * securityParms;
01176 };
01177
01178 #endif // __OPAL_RTP_H
01179