rtpconn.h

Go to the documentation of this file.
00001 /*
00002  * rtpconn.h
00003  *
00004  * Connection abstraction
00005  *
00006  * Open Phone Abstraction Library (OPAL)
00007  *
00008  * Copyright (C) 2007 Post Increment
00009  *
00010  * The contents of this file are subject to the Mozilla Public License
00011  * Version 1.0 (the "License"); you may not use this file except in
00012  * compliance with the License. You may obtain a copy of the License at
00013  * http://www.mozilla.org/MPL/
00014  *
00015  * Software distributed under the License is distributed on an "AS IS"
00016  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
00017  * the License for the specific language governing rights and limitations
00018  * under the License.
00019  *
00020  * The Original Code is Open Phone Abstraction Library.
00021  *
00022  * The Initial Developer of the Original Code is Post Increment
00023  *
00024  * Contributor(s): ______________________________________.
00025  *
00026  * $Revision: 29837 $
00027  * $Author: rjongbloed $
00028  * $Date: 2013-05-30 02:31:47 -0500 (Thu, 30 May 2013) $
00029  */
00030 
00031 #ifndef OPAL_OPAL_RTPCONN_H
00032 #define OPAL_OPAL_RTPCONN_H
00033 
00034 #ifdef P_USE_PRAGMA
00035 #pragma interface
00036 #endif
00037 
00038 #include <opal/buildopts.h>
00039 
00040 #include <opal/connection.h>
00041 #include <opal/mediatype.h>
00042 #include <opal/mediasession.h>
00043 #include <rtp/rtp_session.h>
00044 #include <ptlib/bitwise_enum.h>
00045 
00046 
00047 class OpalRTPEndPoint;
00048 
00049 
00053 class OpalRTPConnection : public OpalConnection
00054 {
00055     PCLASSINFO(OpalRTPConnection, OpalConnection);
00056   public:
00061     OpalRTPConnection(
00062       OpalCall & call,                         
00063       OpalRTPEndPoint & endpoint,              
00064       const PString & token,                   
00065       unsigned options = 0,                    
00066       OpalConnection::StringOptions * stringOptions = NULL     
00067     );  
00068 
00071     ~OpalRTPConnection();
00072 
00090     virtual void OnReleased();
00092 
00093 
00108     virtual OpalMediaStream * CreateMediaStream(
00109       const OpalMediaFormat & mediaFormat, 
00110       unsigned sessionID,                  
00111       PBoolean isSource                        
00112     );
00113 
00123     virtual bool GetMediaTransportAddresses(
00124       const OpalMediaType & mediaType,       
00125       OpalTransportAddressArray & transports 
00126     ) const;
00127 
00141     virtual void AdjustMediaFormats(
00142       bool local,                             
00143       const OpalConnection * otherConnection, 
00144       OpalMediaFormatList & mediaFormats      
00145     ) const;
00146 
00155     virtual void OnPatchMediaStream(
00156       PBoolean isSource,        
00157       OpalMediaPatch & patch    
00158     );
00159 
00165     virtual bool OnMediaCommand(
00166       OpalMediaStream & stream,         
00167       const OpalMediaCommand & command  
00168     );
00169 
00170     virtual PBoolean SendUserInputTone(
00171       char tone,        
00172       unsigned duration = 0  
00173     );
00175 
00176 
00181     virtual unsigned GetNextSessionID(
00182       const OpalMediaType & mediaType,   
00183       bool isSource                      
00184     );
00185 
00186     P_DECLARE_BITWISE_ENUM(CreateMediaSessionsSecurity, 2, (e_NoMediaSessions, e_ClearMediaSession, e_SecureMediaSession));
00187 
00197     vector<bool> CreateAllMediaSessions(
00198       CreateMediaSessionsSecurity security  
00199     );
00200 
00205     virtual OpalMediaSession * CreateMediaSession(
00206       unsigned sessionId,               
00207       const OpalMediaType & mediaType,  
00208       const PString & sessionType = PString::Empty() 
00209     );
00210 
00214     virtual OpalMediaSession * GetMediaSession(
00215       unsigned sessionID    
00216     ) const;
00217 
00221     virtual OpalMediaSession * FindSessionByLocalPort(
00222       WORD port    
00223     ) const;
00224 
00233     virtual OpalMediaSession * UseMediaSession(
00234       unsigned sessionId,               
00235       const OpalMediaType & mediaType,  
00236       const PString & sessionType = PString::Empty() 
00237     );
00238 
00241     virtual void ReleaseMediaSession(
00242       unsigned sessionID    
00243     );
00244 
00250     virtual bool ChangeSessionID(
00251       unsigned fromSessionID,   
00252       unsigned toSessionID      
00253     );
00254 
00257     virtual void ReplaceMediaSession(
00258       unsigned sessionId,             
00259       OpalMediaSession * mediaSession 
00260     );
00261 
00264     virtual bool SetSessionQoS(
00265       OpalRTPSession * session
00266     );
00268 
00288     virtual void DetermineRTPNAT(
00289       const PIPSocket::Address & localAddr,   
00290       const PIPSocket::Address & peerAddr,    
00291       const PIPSocket::Address & signalAddr   
00292     );
00294 
00295     class SessionMap : public PSafeDictionary<PKey<unsigned>, OpalMediaSession>
00296     {
00297     public:
00298       void MoveFrom(SessionMap & other);
00299     };
00300 
00301   protected:
00302     virtual bool GarbageCollection();
00303     PDECLARE_NOTIFIER(OpalRFC2833Info, OpalRTPConnection, OnUserInputInlineRFC2833);
00304 
00305     void CheckForMediaBypass(OpalMediaSession & session);
00306 
00307     SessionMap m_sessions;
00308     bool m_remoteBehindNAT;
00309 
00310     OpalRFC2833Proto * m_rfc2833Handler;
00311 #if OPAL_T38_CAPABILITY
00312     OpalRFC2833Proto * m_ciscoNSEHandler;
00313 #endif
00314 
00315 #if OPAL_VIDEO
00316     PSimpleTimer m_rtcpIntraFrameRequestTimer;
00317 #endif
00318 
00319     P_REMOVE_VIRTUAL(PBoolean,IsRTPNATEnabled(const PIPSocket::Address&,const PIPSocket::Address&,const PIPSocket::Address&,PBoolean),false);
00320 };
00321 
00322 
00323 #endif // OPAL_OPAL_RTPCONN_H

Generated on 21 Jun 2013 for OPAL by  doxygen 1.4.7