localep.h

Go to the documentation of this file.
00001 /*
00002  * localep.h
00003  *
00004  * Local EndPoint/Connection.
00005  *
00006  * Open Phone Abstraction Library (OPAL)
00007  * Formally known as the Open H323 project.
00008  *
00009  * Copyright (c) 2008 Vox Lucida Pty. Ltd.
00010  *
00011  * The contents of this file are subject to the Mozilla Public License
00012  * Version 1.0 (the "License"); you may not use this file except in
00013  * compliance with the License. You may obtain a copy of the License at
00014  * http://www.mozilla.org/MPL/
00015  *
00016  * Software distributed under the License is distributed on an "AS IS"
00017  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
00018  * the License for the specific language governing rights and limitations
00019  * under the License.
00020  *
00021  * The Original Code is Open Phone Abstraction Library.
00022  *
00023  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
00024  *
00025  * Contributor(s): ______________________________________.
00026  *
00027  * $Revision: 21293 $
00028  * $Author: rjongbloed $
00029  * $Date: 2008-10-12 23:24:41 +0000 (Sun, 12 Oct 2008) $
00030  */
00031 
00032 #ifndef OPAL_OPAL_LOCALEP_H
00033 #define OPAL_OPAL_LOCALEP_H
00034 
00035 #ifdef P_USE_PRAGMA
00036 #pragma interface
00037 #endif
00038 
00039 #include <opal/buildopts.h>
00040 
00041 #include <opal/endpoint.h>
00042 
00043 class OpalLocalConnection;
00044 
00045 
00050 class OpalLocalEndPoint : public OpalEndPoint
00051 {
00052     PCLASSINFO(OpalLocalEndPoint, OpalEndPoint);
00053   public:
00058     OpalLocalEndPoint(
00059       OpalManager & manager,        
00060       const char * prefix = "local" 
00061     );
00062 
00065     ~OpalLocalEndPoint();
00067 
00099     virtual PBoolean MakeConnection(
00100       OpalCall & call,           
00101       const PString & party,     
00102       void * userData = NULL,    
00103       unsigned int options = 0,  
00104       OpalConnection::StringOptions * stringOptions  = NULL
00105     );
00107 
00116     PSafePtr<OpalLocalConnection> GetLocalConnectionWithLock(
00117       const PString & token,     
00118       PSafetyMode mode = PSafeReadWrite
00119     ) { return GetConnectionWithLockAs<OpalLocalConnection>(token, mode); }
00120 
00124     virtual OpalLocalConnection * CreateConnection(
00125       OpalCall & call,    
00126       void * userData     
00127     );
00128 
00134     virtual bool OnOutgoingCall(
00135       const OpalLocalConnection & connection 
00136     );
00137 
00143     virtual bool OnIncomingCall(
00144       OpalLocalConnection & connection 
00145     );
00146 
00151     virtual bool AcceptIncomingCall(
00152       const PString & token 
00153     );
00154 
00159     virtual bool RejectIncomingCall(
00160       const PString & token 
00161     );
00162 
00168     virtual bool OnUserInput(
00169       const OpalLocalConnection & connection, 
00170       const PString & indication
00171     );
00172 
00178     virtual bool OnReadMediaFrame(
00179       const OpalLocalConnection & connection, 
00180       const OpalMediaStream & mediaStream,    
00181       RTP_DataFrame & frame                   
00182     );
00183 
00190     virtual bool OnWriteMediaFrame(
00191       const OpalLocalConnection & connection, 
00192       const OpalMediaStream & mediaStream,    
00193       RTP_DataFrame & frame                   
00194     );
00195 
00201     virtual bool OnReadMediaData(
00202       const OpalLocalConnection & connection, 
00203       const OpalMediaStream & mediaStream,    
00204       void * data,                            
00205       PINDEX size,                            
00206       PINDEX & length                         
00207     );
00208 
00214     virtual bool OnWriteMediaData(
00215       const OpalLocalConnection & connection, 
00216       const OpalMediaStream & mediaStream,    
00217       const void * data,                      
00218       PINDEX length,                          
00219       PINDEX & written                        
00220     );
00221 
00234     virtual bool IsSynchronous() const;
00236 };
00237 
00238 
00241 class OpalLocalConnection : public OpalConnection
00242 {
00243     PCLASSINFO(OpalLocalConnection, OpalConnection);
00244   public:
00249     OpalLocalConnection(
00250       OpalCall & call,              
00251       OpalLocalEndPoint & endpoint, 
00252       void * userData               
00253     );
00254 
00257     ~OpalLocalConnection();
00259 
00270     virtual PBoolean IsNetworkConnection() const { return false; }
00271 
00278     virtual PBoolean SetUpConnection();
00279 
00290     virtual PBoolean SetAlerting(
00291       const PString & calleeName,   
00292       PBoolean withMedia            
00293     );
00294 
00309     virtual OpalMediaStream * CreateMediaStream(
00310       const OpalMediaFormat & mediaFormat, 
00311       unsigned sessionID,                  
00312       PBoolean isSource                    
00313     );
00314 
00322     virtual PBoolean SendUserInputString(
00323       const PString & value                   
00324     );
00326 
00331     virtual void AcceptIncoming();
00333     void * GetUserData() const  { return userData; }
00334     void SetUserData(void * v)  { userData = v; }
00335 
00336   protected:
00337     OpalLocalEndPoint & endpoint;
00338     void * userData;
00339 };
00340 
00341 
00345 class OpalLocalMediaStream : public OpalMediaStream, public OpalMediaStreamPacing
00346 {
00347     PCLASSINFO(OpalLocalMediaStream, OpalMediaStream);
00348   public:
00353     OpalLocalMediaStream(
00354       OpalLocalConnection & conn,
00355       const OpalMediaFormat & mediaFormat, 
00356       unsigned sessionID,                  
00357       bool isSource,                       
00358       bool isSynchronous                   
00359     );
00361 
00369     virtual PBoolean ReadPacket(
00370       RTP_DataFrame & packet
00371     );
00372 
00378     virtual PBoolean WritePacket(
00379       RTP_DataFrame & packet
00380     );
00381 
00385     virtual PBoolean ReadData(
00386       BYTE * data,      
00387       PINDEX size,      
00388       PINDEX & length   
00389     );
00390 
00394     virtual PBoolean WriteData(
00395       const BYTE * data,   
00396       PINDEX length,       
00397       PINDEX & written     
00398     );
00399 
00403     virtual PBoolean IsSynchronous() const;
00405 
00406   protected:
00407     bool m_isSynchronous;
00408 };
00409 
00410 
00411 #endif // OPAL_OPAL_LOCALEP_H
00412 
00413 
00414 // End of File ///////////////////////////////////////////////////////////////

Generated on Mon Feb 1 00:25:50 2010 for OPAL by  doxygen 1.5.1