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: 20808 $
00028  * $Author: csoutheren $
00029  * $Date: 2008-09-01 08:20:19 +0000 (Mon, 01 Sep 2008) $
00030  */
00031 
00032 #ifndef __OPAL_LOCAL_H
00033 #define __OPAL_LOCAL_H
00034 
00035 #ifdef P_USE_PRAGMA
00036 #pragma interface
00037 #endif
00038 
00039 #include <opal/endpoint.h>
00040 
00041 class OpalLocalConnection;
00042 
00043 
00048 class OpalLocalEndPoint : public OpalEndPoint
00049 {
00050     PCLASSINFO(OpalLocalEndPoint, OpalEndPoint);
00051   public:
00056     OpalLocalEndPoint(
00057       OpalManager & manager,        
00058       const char * prefix = "local" 
00059     );
00060 
00063     ~OpalLocalEndPoint();
00065 
00097     virtual PBoolean MakeConnection(
00098       OpalCall & call,           
00099       const PString & party,     
00100       void * userData = NULL,    
00101       unsigned int options = 0,  
00102       OpalConnection::StringOptions * stringOptions  = NULL
00103     );
00105 
00114     PSafePtr<OpalLocalConnection> GetLocalConnectionWithLock(
00115       const PString & token,     
00116       PSafetyMode mode = PSafeReadWrite
00117     ) { return GetConnectionWithLockAs<OpalLocalConnection>(token, mode); }
00118 
00122     virtual OpalLocalConnection * CreateConnection(
00123       OpalCall & call,    
00124       void * userData     
00125     );
00126 
00132     virtual bool OnOutgoingCall(
00133       const OpalLocalConnection & connection 
00134     );
00135 
00141     virtual bool OnIncomingCall(
00142       OpalLocalConnection & connection 
00143     );
00144 
00149     virtual bool AcceptIncomingCall(
00150       const PString & token 
00151     );
00152 
00157     virtual bool RejectIncomingCall(
00158       const PString & token 
00159     );
00160 
00166     virtual bool OnUserInput(
00167       const OpalLocalConnection & connection, 
00168       const PString & indication
00169     );
00170 
00176     virtual bool OnReadMediaFrame(
00177       const OpalLocalConnection & connection, 
00178       const OpalMediaStream & mediaStream,    
00179       RTP_DataFrame & frame                   
00180     );
00181 
00188     virtual bool OnWriteMediaFrame(
00189       const OpalLocalConnection & connection, 
00190       const OpalMediaStream & mediaStream,    
00191       RTP_DataFrame & frame                   
00192     );
00193 
00199     virtual bool OnReadMediaData(
00200       const OpalLocalConnection & connection, 
00201       const OpalMediaStream & mediaStream,    
00202       void * data,                            
00203       PINDEX size,                            
00204       PINDEX & length                         
00205     );
00206 
00212     virtual bool OnWriteMediaData(
00213       const OpalLocalConnection & connection, 
00214       const OpalMediaStream & mediaStream,    
00215       const void * data,                      
00216       PINDEX length,                          
00217       PINDEX & written                        
00218     );
00219 
00232     virtual bool IsSynchronous() const;
00234 };
00235 
00236 
00239 class OpalLocalConnection : public OpalConnection
00240 {
00241     PCLASSINFO(OpalLocalConnection, OpalConnection);
00242   public:
00247     OpalLocalConnection(
00248       OpalCall & call,              
00249       OpalLocalEndPoint & endpoint, 
00250       void * userData               
00251     );
00252 
00255     ~OpalLocalConnection();
00257 
00268     virtual PBoolean IsNetworkConnection() const { return false; }
00269 
00276     virtual PBoolean SetUpConnection();
00277 
00288     virtual PBoolean SetAlerting(
00289       const PString & calleeName,   
00290       PBoolean withMedia            
00291     );
00292 
00307     virtual OpalMediaStream * CreateMediaStream(
00308       const OpalMediaFormat & mediaFormat, 
00309       unsigned sessionID,                  
00310       PBoolean isSource                    
00311     );
00312 
00320     virtual PBoolean SendUserInputString(
00321       const PString & value                   
00322     );
00324 
00329     virtual void AcceptIncoming();
00331     void * GetUserData() const  { return userData; }
00332     void SetUserData(void * v)  { userData = v; }
00333 
00334   protected:
00335     OpalLocalEndPoint & endpoint;
00336     void * userData;
00337 };
00338 
00339 
00343 class OpalLocalMediaStream : public OpalMediaStream, public OpalMediaStreamPacing
00344 {
00345     PCLASSINFO(OpalLocalMediaStream, OpalMediaStream);
00346   public:
00351     OpalLocalMediaStream(
00352       OpalLocalConnection & conn,
00353       const OpalMediaFormat & mediaFormat, 
00354       unsigned sessionID,                  
00355       bool isSource,                       
00356       bool isSynchronous                   
00357     );
00359 
00367     virtual PBoolean ReadPacket(
00368       RTP_DataFrame & packet
00369     );
00370 
00376     virtual PBoolean WritePacket(
00377       RTP_DataFrame & packet
00378     );
00379 
00383     virtual PBoolean ReadData(
00384       BYTE * data,      
00385       PINDEX size,      
00386       PINDEX & length   
00387     );
00388 
00392     virtual PBoolean WriteData(
00393       const BYTE * data,   
00394       PINDEX length,       
00395       PINDEX & written     
00396     );
00397 
00401     virtual PBoolean IsSynchronous() const;
00403 
00404   protected:
00405     bool m_isSynchronous;
00406 };
00407 
00408 
00409 #endif // __OPAL_LOCAL_H
00410 
00411 // End of File ///////////////////////////////////////////////////////////////

Generated on Mon Sep 15 11:49:12 2008 for OPAL by  doxygen 1.5.1