# rtpep.h

Go to the documentation of this file.

    00001 /*
    00002  * Endpoint abstraction
    00003  *
    00004  * Open Phone Abstraction Library (OPAL)
    00005  *
    00006  * Copyright (C) 2007 Post Increment
    00007  *
    00008  * The contents of this file are subject to the Mozilla Public License
    00009  * Version 1.0 (the "License"); you may not use this file except in
    00010  * compliance with the License. You may obtain a copy of the License at
    00011  * http://www.mozilla.org/MPL/
    00012  *
    00013  * Software distributed under the License is distributed on an "AS IS"
    00014  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
    00015  * the License for the specific language governing rights and limitations
    00016  * under the License.
    00017  *
    00018  * The Original Code is Open Phone Abstraction Library.
    00019  *
    00020  * The Initial Developer of the Original Code is Post Increment
    00021  *
    00022  * Contributor(s): ______________________________________.
    00023  *
    00024  * $Revision: 28481 $
    00025  * $Author: rjongbloed $
    00026  * $Date: 2012-10-05 03:13:17 -0500 (Fri, 05 Oct 2012) $
    00027  */
    00028
    00029 #ifndef OPAL_OPAL_RTPEP_H
    00030 #define OPAL_OPAL_RTPEP_H
    00031
    00032 #ifdef P_USE_PRAGMA
    00033 #pragma interface
    00034 #endif
    00035
    00036 #include <opal/buildopts.h>
    00037
    00038 #include <opal/endpoint.h>
    00039
    00040
    00044 class OpalRTPEndPoint : public OpalEndPoint
    00045 {
    00046   PCLASSINFO(OpalRTPEndPoint, OpalEndPoint);
    00047
    00052     OpalRTPEndPoint(
    00053       OpalManager & manager,
    00054       const PCaselessString & prefix,
    00055       unsigned attributes
    00056     );
    00057
    00060     ~OpalRTPEndPoint();
    00062
    00074     virtual OpalMediaFormatList GetMediaFormats() const;
    00075
    00081     virtual void OnClosedMediaStream(
    00082       const OpalMediaStream & stream
    00083     );
    00085
    00105     virtual PBoolean IsRTPNATEnabled(
    00106       OpalConnection & connection,
    00107       const PIPSocket::Address & localAddr,
    00108       const PIPSocket::Address & peerAddr,
    00109       const PIPSocket::Address & signalAddr,
    00110       PBoolean incoming
    00111     );
    00112
    00125     virtual bool OnLocalRTP(
    00126       OpalConnection & connection1,
    00127       OpalConnection & connection2,
    00128       unsigned sessionID,
    00129       bool opened
    00130     ) const;
    00131
    00132     // Check for local RTP connection. Internal function.
    00133     bool CheckForLocalRTP(const OpalRTPMediaStream & stream);
    00134
    00135     // Check for local RTP connection. Internal function.
    00136     void CheckEndLocalRTP(OpalConnection & connection, OpalRTPSession * rtp);
    00137
    00138     void SetConnectionByRtpLocalPort(OpalRTPSession * rtp, OpalConnection * connection);
    00140
    00141   protected:
    00142     struct LocalRtpInfo {
    00143       LocalRtpInfo(OpalConnection & connection) : m_connection(connection), m_previousResult(-1) { }
    00144
    00145       OpalConnection & m_connection;
    00146       int              m_previousResult;
    00147     };
    00148     typedef std::map<OpalTransportAddress, LocalRtpInfo> LocalRtpInfoMap;
    00149     LocalRtpInfoMap m_connectionsByRtpLocalAddr;
    00150     PMutex          m_connectionsByRtpMutex;
    00151 };
    00152
    00153
    00154 #endif // OPAL_OPAL_RTPEP_H