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
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345 #ifndef __OPAL_RTP_H
00346 #define __OPAL_RTP_H
00347
00348 #ifdef P_USE_PRAGMA
00349 #pragma interface
00350 #endif
00351
00352 #include <opal/buildopts.h>
00353 #include <ptlib/sockets.h>
00354
00355
00356 class RTP_JitterBuffer;
00357 class PSTUNClient;
00358 class OpalSecurityMode;
00359
00360 #if OPAL_RTP_AGGREGATE
00361 #include <ptclib/sockagg.h>
00362 #else
00363 typedef void * PHandleAggregator;
00364 typedef void * RTP_AggregatedHandle;
00365 #endif
00366
00368
00369
00370
00371 class RTP_QOS : public PObject
00372 {
00373 PCLASSINFO(RTP_QOS,PObject);
00374 public:
00375 PQoS dataQoS;
00376 PQoS ctrlQoS;
00377 };
00378
00380
00381
00384 class RTP_DataFrame : public PBYTEArray
00385 {
00386 PCLASSINFO(RTP_DataFrame, PBYTEArray);
00387
00388 public:
00389 RTP_DataFrame(PINDEX payloadSize = 2048);
00390 RTP_DataFrame(const BYTE * data, PINDEX len, BOOL dynamic = TRUE);
00391
00392 enum {
00393 ProtocolVersion = 2,
00394 MinHeaderSize = 12,
00395
00396 MaxEthernetPayloadSize = (1518-14-4-8-20-16-12)
00397 };
00398
00399 enum PayloadTypes {
00400 PCMU,
00401 FS1016,
00402 G721,
00403 G726 = G721,
00404 GSM,
00405 G7231,
00406 DVI4_8k,
00407 DVI4_16k,
00408 LPC,
00409 PCMA,
00410 G722,
00411 L16_Stereo,
00412 L16_Mono,
00413 G723,
00414 CN,
00415 MPA,
00416 G728,
00417 DVI4_11k,
00418 DVI4_22k,
00419 G729,
00420 Cisco_CN,
00421
00422 CelB = 25,
00423 JPEG,
00424 H261 = 31,
00425 MPV,
00426 MP2T,
00427 H263,
00428
00429 LastKnownPayloadType,
00430
00431 DynamicBase = 96,
00432 MaxPayloadType = 127,
00433 IllegalPayloadType
00434 };
00435
00436 typedef std::map<PayloadTypes, PayloadTypes> PayloadMapType;
00437
00438 unsigned GetVersion() const { return (theArray[0]>>6)&3; }
00439
00440 BOOL GetExtension() const { return (theArray[0]&0x10) != 0; }
00441 void SetExtension(BOOL ext);
00442
00443 BOOL GetMarker() const { return (theArray[1]&0x80) != 0; }
00444 void SetMarker(BOOL m);
00445
00446 PayloadTypes GetPayloadType() const { return (PayloadTypes)(theArray[1]&0x7f); }
00447 void SetPayloadType(PayloadTypes t);
00448
00449 WORD GetSequenceNumber() const { return *(PUInt16b *)&theArray[2]; }
00450 void SetSequenceNumber(WORD n) { *(PUInt16b *)&theArray[2] = n; }
00451
00452 DWORD GetTimestamp() const { return *(PUInt32b *)&theArray[4]; }
00453 void SetTimestamp(DWORD t) { *(PUInt32b *)&theArray[4] = t; }
00454
00455 DWORD GetSyncSource() const { return *(PUInt32b *)&theArray[8]; }
00456 void SetSyncSource(DWORD s) { *(PUInt32b *)&theArray[8] = s; }
00457
00458 PINDEX GetContribSrcCount() const { return theArray[0]&0xf; }
00459 DWORD GetContribSource(PINDEX idx) const;
00460 void SetContribSource(PINDEX idx, DWORD src);
00461
00462 PINDEX GetHeaderSize() const;
00463
00464 int GetExtensionType() const;
00465 void SetExtensionType(int type);
00466 PINDEX GetExtensionSize() const;
00467 BOOL SetExtensionSize(PINDEX sz);
00468 BYTE * GetExtensionPtr() const;
00469
00470 PINDEX GetPayloadSize() const { return payloadSize; }
00471 BOOL SetPayloadSize(PINDEX sz);
00472 BYTE * GetPayloadPtr() const { return (BYTE *)(theArray+GetHeaderSize()); }
00473
00474 virtual void PrintOn(ostream & strm) const;
00475
00476 protected:
00477 PINDEX payloadSize;
00478
00479 #if PTRACING
00480 friend ostream & operator<<(ostream & o, PayloadTypes t);
00481 #endif
00482 };
00483
00484 PLIST(RTP_DataFrameList, RTP_DataFrame);
00485
00486
00489 class RTP_ControlFrame : public PBYTEArray
00490 {
00491 PCLASSINFO(RTP_ControlFrame, PBYTEArray);
00492
00493 public:
00494 RTP_ControlFrame(PINDEX compoundSize = 2048);
00495
00496 unsigned GetVersion() const { return (BYTE)theArray[compoundOffset]>>6; }
00497
00498 unsigned GetCount() const { return (BYTE)theArray[compoundOffset]&0x1f; }
00499 void SetCount(unsigned count);
00500
00501 enum PayloadTypes {
00502 e_IntraFrameRequest = 192,
00503 e_SenderReport = 200,
00504 e_ReceiverReport,
00505 e_SourceDescription,
00506 e_Goodbye,
00507 e_ApplDefined
00508 };
00509
00510 unsigned GetPayloadType() const { return (BYTE)theArray[compoundOffset+1]; }
00511 void SetPayloadType(unsigned t);
00512
00513 PINDEX GetPayloadSize() const { return 4*(*(PUInt16b *)&theArray[compoundOffset+2]); }
00514 void SetPayloadSize(PINDEX sz);
00515
00516 BYTE * GetPayloadPtr() const;
00517
00518 BOOL ReadNextPacket();
00519 BOOL StartNewPacket();
00520 void EndPacket();
00521
00522 PINDEX GetCompoundSize() const;
00523
00524 BOOL GetPadding() const { return theArray[compoundOffset & 0x20] != 0; }
00525 void SetPadding(BOOL v) { if (v) theArray[compoundOffset] |= 0x20; else theArray[compoundOffset] &= 0xdf; }
00526
00527 void Reset(PINDEX size);
00528
00529 #pragma pack(1)
00530 struct ReceiverReport {
00531 PUInt32b ssrc;
00532 BYTE fraction;
00533 BYTE lost[3];
00534 PUInt32b last_seq;
00535 PUInt32b jitter;
00536 PUInt32b lsr;
00537 PUInt32b dlsr;
00538
00539 unsigned GetLostPackets() const { return (lost[0]<<16U)+(lost[1]<<8U)+lost[2]; }
00540 void SetLostPackets(unsigned lost);
00541 };
00542
00543 struct SenderReport {
00544 PUInt32b ntp_sec;
00545 PUInt32b ntp_frac;
00546 PUInt32b rtp_ts;
00547 PUInt32b psent;
00548 PUInt32b osent;
00549 };
00550
00551 enum DescriptionTypes {
00552 e_END,
00553 e_CNAME,
00554 e_NAME,
00555 e_EMAIL,
00556 e_PHONE,
00557 e_LOC,
00558 e_TOOL,
00559 e_NOTE,
00560 e_PRIV,
00561 NumDescriptionTypes
00562 };
00563
00564 struct SourceDescription {
00565 PUInt32b src;
00566 struct Item {
00567 BYTE type;
00568 BYTE length;
00569 char data[1];
00570
00571
00572
00573
00574
00575 unsigned int GetLengthTotal() const {return (unsigned int)(length + 2);}
00576 const Item * GetNextItem() const { return (const Item *)((char *)this + length + 2); }
00577 Item * GetNextItem() { return (Item *)((char *)this + length + 2); }
00578 } item[1];
00579 };
00580
00581 void StartSourceDescription(
00582 DWORD src
00583 );
00584
00585 void AddSourceDescriptionItem(
00586 unsigned type,
00587 const PString & data
00588 );
00589 #pragma pack()
00590
00591 protected:
00592 PINDEX compoundOffset;
00593 PINDEX payloadSize;
00594 };
00595
00596
00597 class RTP_Session;
00598
00603 class RTP_UserData : public PObject
00604 {
00605 PCLASSINFO(RTP_UserData, PObject);
00606
00607 public:
00614 virtual void OnTxStatistics(
00615 const RTP_Session & session
00616 ) const;
00617
00624 virtual void OnRxStatistics(
00625 const RTP_Session & session
00626 ) const;
00627
00628 #if OPAL_VIDEO
00629
00634 virtual void OnTxIntraFrameRequest(
00635 const RTP_Session & session
00636 ) const;
00637
00643 virtual void OnRxIntraFrameRequest(
00644 const RTP_Session & session
00645 ) const;
00646 #endif
00647 };
00648
00649
00652 class RTP_Session : public PObject
00653 {
00654 PCLASSINFO(RTP_Session, PObject);
00655
00656 public:
00661 RTP_Session(
00662 PHandleAggregator * aggregator,
00663 unsigned id,
00664 RTP_UserData * userData = NULL,
00665 BOOL autoDeleteUserData = TRUE
00666 );
00667
00671 ~RTP_Session();
00673
00685 void SetJitterBufferSize(
00686 unsigned minJitterDelay,
00687 unsigned maxJitterDelay,
00688 unsigned timeUnits = 8,
00689 PINDEX stackSize = 30000
00690 );
00691
00697 unsigned GetJitterBufferSize() const;
00698
00701 unsigned GetJitterTimeUnits() const;
00702
00704 virtual BOOL ModifyQOS(RTP_QOS * )
00705 { return FALSE; }
00706
00712 virtual BOOL ReadBufferedData(
00713 DWORD timestamp,
00714 RTP_DataFrame & frame
00715 );
00716
00722 virtual BOOL ReadData(
00723 RTP_DataFrame & frame,
00724 BOOL loop
00725 ) = 0;
00726
00729 virtual BOOL WriteData(
00730 RTP_DataFrame & frame
00731 ) = 0;
00732
00736 virtual BOOL WriteOOBData(
00737 RTP_DataFrame & frame
00738 );
00739
00742 virtual BOOL WriteControl(
00743 RTP_ControlFrame & frame
00744 ) = 0;
00745
00748 virtual BOOL SendReport();
00749
00752 virtual void Close(
00753 BOOL reading
00754 ) = 0;
00755
00758 virtual void Reopen(
00759 BOOL isReading
00760 ) = 0;
00761
00764 virtual PString GetLocalHostName() = 0;
00766
00769 enum SendReceiveStatus {
00770 e_ProcessPacket,
00771 e_IgnorePacket,
00772 e_AbortTransport
00773 };
00774 virtual SendReceiveStatus OnSendData(RTP_DataFrame & frame);
00775 virtual SendReceiveStatus OnSendControl(RTP_ControlFrame & frame, PINDEX & len);
00776 virtual SendReceiveStatus OnReceiveData(RTP_DataFrame & frame);
00777 virtual SendReceiveStatus OnReceiveControl(RTP_ControlFrame & frame);
00778
00779 class ReceiverReport : public PObject {
00780 PCLASSINFO(ReceiverReport, PObject);
00781 public:
00782 void PrintOn(ostream &) const;
00783
00784 DWORD sourceIdentifier;
00785 DWORD fractionLost;
00786 DWORD totalLost;
00787 DWORD lastSequenceNumber;
00788 DWORD jitter;
00789 PTimeInterval lastTimestamp;
00790 PTimeInterval delay;
00791 };
00792 PARRAY(ReceiverReportArray, ReceiverReport);
00793
00794 class SenderReport : public PObject {
00795 PCLASSINFO(SenderReport, PObject);
00796 public:
00797 void PrintOn(ostream &) const;
00798
00799 DWORD sourceIdentifier;
00800 PTime realTimestamp;
00801 DWORD rtpTimestamp;
00802 DWORD packetsSent;
00803 DWORD octetsSent;
00804 };
00805 virtual void OnRxSenderReport(const SenderReport & sender,
00806 const ReceiverReportArray & reports);
00807 virtual void OnRxReceiverReport(DWORD src,
00808 const ReceiverReportArray & reports);
00809
00810 class SourceDescription : public PObject {
00811 PCLASSINFO(SourceDescription, PObject);
00812 public:
00813 SourceDescription(DWORD src) { sourceIdentifier = src; }
00814 void PrintOn(ostream &) const;
00815
00816 DWORD sourceIdentifier;
00817 POrdinalToString items;
00818 };
00819 PARRAY(SourceDescriptionArray, SourceDescription);
00820 virtual void OnRxSourceDescription(const SourceDescriptionArray & descriptions);
00821
00822 virtual void OnRxGoodbye(const PDWORDArray & sources,
00823 const PString & reason);
00824
00825 virtual void OnRxApplDefined(const PString & type, unsigned subtype, DWORD src,
00826 const BYTE * data, PINDEX size);
00828
00833 unsigned GetSessionID() const { return sessionID; }
00834
00837 PString GetCanonicalName() const;
00838
00841 void SetCanonicalName(const PString & name);
00842
00845 PString GetToolName() const;
00846
00849 void SetToolName(const PString & name);
00850
00853 RTP_UserData * GetUserData() const { return userData; }
00854
00857 void SetUserData(
00858 RTP_UserData * data,
00859 BOOL autoDeleteUserData = TRUE
00860 );
00861
00864 DWORD GetSyncSourceOut() const { return syncSourceOut; }
00865
00868 void IncrementReference() { referenceCount++; }
00869
00872 BOOL DecrementReference() { return --referenceCount == 0; }
00873
00876 BOOL WillIgnoreOtherSources() const { return ignoreOtherSources; }
00877
00880 void SetIgnoreOtherSources(
00881 BOOL ignore
00882 ) { ignoreOtherSources = ignore; }
00883
00886 BOOL WillIgnoreOutOfOrderPackets() const { return ignoreOutOfOrderPackets; }
00887
00890 void SetIgnoreOutOfOrderPackets(
00891 BOOL ignore
00892 ) { ignoreOutOfOrderPackets = ignore; }
00893
00896 void SetIgnorePayloadTypeChanges(
00897 BOOL ignore
00898 ) { ignorePayloadTypeChanges = ignore; }
00899
00902 const PTimeInterval & GetReportTimeInterval() { return reportTimeInterval; }
00903
00906 void SetReportTimeInterval(
00907 const PTimeInterval & interval
00908 ) { reportTimeInterval = interval; }
00909
00912 PTimeInterval GetReportTimer()
00913 { return reportTimer; }
00914
00917 unsigned GetTxStatisticsInterval() { return txStatisticsInterval; }
00918
00921 void SetTxStatisticsInterval(
00922 unsigned packets
00923 );
00924
00927 unsigned GetRxStatisticsInterval() { return rxStatisticsInterval; }
00928
00931 void SetRxStatisticsInterval(
00932 unsigned packets
00933 );
00934
00937 DWORD GetPacketsSent() const { return packetsSent; }
00938
00941 DWORD GetOctetsSent() const { return octetsSent; }
00942
00945 DWORD GetPacketsReceived() const { return packetsReceived; }
00946
00949 DWORD GetOctetsReceived() const { return octetsReceived; }
00950
00953 DWORD GetPacketsLost() const { return packetsLost; }
00954
00957 DWORD GetPacketsOutOfOrder() const { return packetsOutOfOrder; }
00958
00961 DWORD GetPacketsTooLate() const;
00962
00967 DWORD GetAverageSendTime() const { return averageSendTime; }
00968
00973 DWORD GetMarkerRecvCount() const { return markerRecvCount; }
00974
00979 DWORD GetMarkerSendCount() const { return markerSendCount; }
00980
00985 DWORD GetMaximumSendTime() const { return maximumSendTime; }
00986
00991 DWORD GetMinimumSendTime() const { return minimumSendTime; }
00992
00997 DWORD GetAverageReceiveTime() const { return averageReceiveTime; }
00998
01003 DWORD GetMaximumReceiveTime() const { return maximumReceiveTime; }
01004
01009 DWORD GetMinimumReceiveTime() const { return minimumReceiveTime; }
01010
01015 DWORD GetAvgJitterTime() const { return jitterLevel>>7; }
01016
01020 DWORD GetMaxJitterTime() const { return maximumJitterLevel>>7; }
01022
01025 virtual int GetDataSocketHandle() const
01026 { return -1; }
01027 virtual int GetControlSocketHandle() const
01028 { return -1; }
01030
01031 virtual void SendBYE();
01032 virtual void SetCloseOnBYE(BOOL v) { closeOnBye = v; }
01033 #if OPAL_VIDEO
01034
01038 virtual void SendIntraFrameRequest();
01039 #endif
01040 protected:
01041 void AddReceiverReport(RTP_ControlFrame::ReceiverReport & receiver);
01042 BOOL InsertReportPacket(RTP_ControlFrame & report);
01043
01044 unsigned sessionID;
01045 PString canonicalName;
01046 PString toolName;
01047 unsigned referenceCount;
01048 RTP_UserData * userData;
01049 BOOL autoDeleteUserData;
01050 RTP_JitterBuffer * jitter;
01051
01052 BOOL ignoreOtherSources;
01053 BOOL ignoreOutOfOrderPackets;
01054 DWORD syncSourceOut;
01055 DWORD syncSourceIn;
01056 DWORD lastSentTimestamp;
01057 BOOL allowSyncSourceInChange;
01058 BOOL allowRemoteTransmitAddressChange;
01059 BOOL allowSequenceChange;
01060 PTimeInterval reportTimeInterval;
01061 unsigned txStatisticsInterval;
01062 unsigned rxStatisticsInterval;
01063 WORD lastSentSequenceNumber;
01064 WORD expectedSequenceNumber;
01065 PTimeInterval lastSentPacketTime;
01066 PTimeInterval lastReceivedPacketTime;
01067 WORD lastRRSequenceNumber;
01068 PINDEX consecutiveOutOfOrderPackets;
01069
01070 PMutex sendDataMutex;
01071 DWORD timeStampOut;
01072 DWORD timeStampOffs;
01073 BOOL timeStampOffsetEstablished;
01074 BOOL timeStampIsPremedia;
01075
01076
01077 DWORD packetsSent;
01078 DWORD rtcpPacketsSent;
01079 DWORD octetsSent;
01080 DWORD packetsReceived;
01081 DWORD octetsReceived;
01082 DWORD packetsLost;
01083 DWORD packetsOutOfOrder;
01084 DWORD averageSendTime;
01085 DWORD maximumSendTime;
01086 DWORD minimumSendTime;
01087 DWORD averageReceiveTime;
01088 DWORD maximumReceiveTime;
01089 DWORD minimumReceiveTime;
01090 DWORD jitterLevel;
01091 DWORD maximumJitterLevel;
01092
01093 DWORD markerSendCount;
01094 DWORD markerRecvCount;
01095
01096 unsigned txStatisticsCount;
01097 unsigned rxStatisticsCount;
01098
01099 DWORD averageSendTimeAccum;
01100 DWORD maximumSendTimeAccum;
01101 DWORD minimumSendTimeAccum;
01102 DWORD averageReceiveTimeAccum;
01103 DWORD maximumReceiveTimeAccum;
01104 DWORD minimumReceiveTimeAccum;
01105 DWORD packetsLostSinceLastRR;
01106 DWORD lastTransitTime;
01107
01108 RTP_DataFrame::PayloadTypes lastReceivedPayloadType;
01109 BOOL ignorePayloadTypeChanges;
01110
01111 PMutex reportMutex;
01112 PTimer reportTimer;
01113
01114 PHandleAggregator * aggregator;
01115
01116 BOOL closeOnBye;
01117 BOOL byeSent;
01118 };
01119
01120
01123 class RTP_SessionManager : public PObject
01124 {
01125 PCLASSINFO(RTP_SessionManager, PObject);
01126
01127 public:
01132 RTP_SessionManager();
01133 RTP_SessionManager(const RTP_SessionManager & sm);
01134 RTP_SessionManager & operator=(const RTP_SessionManager & sm);
01136
01137
01151 RTP_Session * UseSession(
01152 unsigned sessionID
01153 );
01154
01161 void AddSession(
01162 RTP_Session * session
01163 );
01164
01168 void ReleaseSession(
01169 unsigned sessionID,
01170 BOOL clearAll = FALSE
01171 );
01172
01177 RTP_Session * GetSession(
01178 unsigned sessionID
01179 ) const;
01180
01197 RTP_Session * First();
01198
01205 RTP_Session * Next();
01206
01214 void Exit();
01216
01217
01218 protected:
01219 PDICTIONARY(SessionDict, POrdinalKey, RTP_Session);
01220 SessionDict sessions;
01221 PMutex mutex;
01222 PINDEX enumerationIndex;
01223 };
01224
01225
01226
01229 class RTP_UDP : public RTP_Session
01230 {
01231 PCLASSINFO(RTP_UDP, RTP_Session);
01232
01233 public:
01238 RTP_UDP(
01239 PHandleAggregator * aggregator,
01240 unsigned id,
01241 BOOL remoteIsNAT
01242 );
01243
01245 ~RTP_UDP();
01247
01255 virtual BOOL ReadData(RTP_DataFrame & frame, BOOL loop);
01256
01259 virtual BOOL WriteData(RTP_DataFrame & frame);
01260
01264 virtual BOOL WriteOOBData(RTP_DataFrame & frame);
01265
01268 virtual BOOL WriteControl(RTP_ControlFrame & frame);
01269
01272 virtual void Close(
01273 BOOL reading
01274 );
01275
01278 virtual PString GetLocalHostName();
01280
01283 virtual BOOL ModifyQOS(RTP_QOS * rtpqos);
01284
01289 virtual BOOL Open(
01290 PIPSocket::Address localAddress,
01291 WORD portBase,
01292 WORD portMax,
01293 BYTE ipTypeOfService,
01294 PSTUNClient * stun = NULL,
01295 RTP_QOS * rtpqos = NULL
01296 );
01298
01301 virtual void Reopen(BOOL isReading);
01303
01308 virtual PIPSocket::Address GetLocalAddress() const { return localAddress; }
01309
01312 virtual void SetLocalAddress(
01313 const PIPSocket::Address & addr
01314 ) { localAddress = addr; }
01315
01318 PIPSocket::Address GetRemoteAddress() const { return remoteAddress; }
01319
01322 virtual WORD GetLocalDataPort() const { return localDataPort; }
01323
01326 virtual WORD GetLocalControlPort() const { return localControlPort; }
01327
01330 virtual WORD GetRemoteDataPort() const { return remoteDataPort; }
01331
01334 virtual WORD GetRemoteControlPort() const { return remoteControlPort; }
01335
01338 virtual PUDPSocket & GetDataSocket() { return *dataSocket; }
01339
01342 virtual PUDPSocket & GetControlSocket() { return *controlSocket; }
01343
01346 virtual BOOL SetRemoteSocketInfo(
01347 PIPSocket::Address address,
01348 WORD port,
01349 BOOL isDataPort
01350 );
01351
01354 virtual void ApplyQOS(
01355 const PIPSocket::Address & addr
01356 );
01358
01359 virtual int GetDataSocketHandle() const
01360 { return dataSocket != NULL ? dataSocket->GetHandle() : -1; }
01361
01362 virtual int GetControlSocketHandle() const
01363 { return controlSocket != NULL ? controlSocket->GetHandle() : -1; }
01364
01365 protected:
01366 virtual int WaitForPDU(PUDPSocket & dataSocket, PUDPSocket & controlSocket, const PTimeInterval & timer);
01367 virtual SendReceiveStatus ReadDataPDU(RTP_DataFrame & frame);
01368 virtual SendReceiveStatus ReadControlPDU();
01369 virtual SendReceiveStatus ReadDataOrControlPDU(
01370 PUDPSocket & socket,
01371 PBYTEArray & frame,
01372 BOOL fromDataChannel
01373 );
01374
01375 PIPSocket::Address localAddress;
01376 WORD localDataPort;
01377 WORD localControlPort;
01378
01379 PIPSocket::Address remoteAddress;
01380 WORD remoteDataPort;
01381 WORD remoteControlPort;
01382
01383 PIPSocket::Address remoteTransmitAddress;
01384
01385 BOOL shutdownRead;
01386 BOOL shutdownWrite;
01387
01388 PUDPSocket * dataSocket;
01389 PUDPSocket * controlSocket;
01390
01391 BOOL appliedQOS;
01392 BOOL remoteIsNAT;
01393 BOOL first;
01394 };
01395
01397
01398 class SecureRTP_UDP : public RTP_UDP
01399 {
01400 PCLASSINFO(SecureRTP_UDP, RTP_UDP);
01401
01402 public:
01407 SecureRTP_UDP(
01408 PHandleAggregator * aggregator,
01409 unsigned id,
01410 BOOL remoteIsNAT
01411 );
01412
01414 ~SecureRTP_UDP();
01415
01416 virtual void SetSecurityMode(OpalSecurityMode * srtpParms);
01417 virtual OpalSecurityMode * GetSecurityParms() const;
01418
01419 protected:
01420 OpalSecurityMode * securityParms;
01421 };
01422
01423 #endif // __OPAL_RTP_H
01424