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: 23008 $
00028  * $Author: rjongbloed $
00029  * $Date: 2009-06-28 23:24:23 -0500 (Sun, 28 Jun 2009) $
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 
00080     virtual OpalMediaFormatList GetMediaFormats() const;
00081 
00111     virtual PSafePtr<OpalConnection> MakeConnection(
00112       OpalCall & call,           
00113       const PString & party,     
00114       void * userData = NULL,    
00115       unsigned int options = 0,  
00116       OpalConnection::StringOptions * stringOptions  = NULL
00117     );
00119 
00128     PSafePtr<OpalLocalConnection> GetLocalConnectionWithLock(
00129       const PString & token,     
00130       PSafetyMode mode = PSafeReadWrite
00131     ) { return GetConnectionWithLockAs<OpalLocalConnection>(token, mode); }
00132 
00136     virtual OpalLocalConnection * CreateConnection(
00137       OpalCall & call,    
00138       void * userData,    
00139       unsigned options,
00140       OpalConnection::StringOptions * stringOptions
00141     );
00142 
00148     virtual bool OnOutgoingCall(
00149       const OpalLocalConnection & connection 
00150     );
00151 
00157     virtual bool OnIncomingCall(
00158       OpalLocalConnection & connection 
00159     );
00160 
00165     virtual bool AlertingIncomingCall(
00166       const PString & token 
00167     );
00168 
00173     virtual bool AcceptIncomingCall(
00174       const PString & token 
00175     );
00176 
00181     virtual bool RejectIncomingCall(
00182       const PString & token 
00183     );
00184 
00190     virtual bool OnUserInput(
00191       const OpalLocalConnection & connection, 
00192       const PString & indication
00193     );
00194 
00200     virtual bool OnReadMediaFrame(
00201       const OpalLocalConnection & connection, 
00202       const OpalMediaStream & mediaStream,    
00203       RTP_DataFrame & frame                   
00204     );
00205 
00212     virtual bool OnWriteMediaFrame(
00213       const OpalLocalConnection & connection, 
00214       const OpalMediaStream & mediaStream,    
00215       RTP_DataFrame & frame                   
00216     );
00217 
00223     virtual bool OnReadMediaData(
00224       const OpalLocalConnection & connection, 
00225       const OpalMediaStream & mediaStream,    
00226       void * data,                            
00227       PINDEX size,                            
00228       PINDEX & length                         
00229     );
00230 
00236     virtual bool OnWriteMediaData(
00237       const OpalLocalConnection & connection, 
00238       const OpalMediaStream & mediaStream,    
00239       const void * data,                      
00240       PINDEX length,                          
00241       PINDEX & written                        
00242     );
00243 
00256     virtual bool IsSynchronous() const;
00257 
00260     bool IsDeferredAlerting() const { return m_deferredAlerting; }
00262 
00263   protected:
00264     bool m_deferredAlerting;
00265 
00266   private:
00267     P_REMOVE_VIRTUAL(OpalLocalConnection *, CreateConnection(OpalCall &, void *), 0);
00268 };
00269 
00270 
00275 class OpalLocalConnection : public OpalConnection
00276 {
00277     PCLASSINFO(OpalLocalConnection, OpalConnection);
00278   public:
00283     OpalLocalConnection(
00284       OpalCall & call,              
00285       OpalLocalEndPoint & endpoint, 
00286       void * userData,              
00287       unsigned options,
00288       OpalConnection::StringOptions * stringOptions,
00289       char tokenPrefix = 'L'
00290     );
00291 
00294     ~OpalLocalConnection();
00296 
00307     virtual PBoolean IsNetworkConnection() const { return false; }
00308 
00315     virtual PBoolean SetUpConnection();
00316 
00327     virtual PBoolean SetAlerting(
00328       const PString & calleeName,   
00329       PBoolean withMedia            
00330     );
00331 
00342     virtual PBoolean SetConnected();
00343 
00358     virtual OpalMediaStream * CreateMediaStream(
00359       const OpalMediaFormat & mediaFormat, 
00360       unsigned sessionID,                  
00361       PBoolean isSource                    
00362     );
00363 
00366     virtual OpalMediaStreamPtr OpenMediaStream(
00367       const OpalMediaFormat & mediaFormat, 
00368       unsigned sessionID,                  
00369       bool isSource                        
00370     );
00371 
00379     virtual PBoolean SendUserInputString(
00380       const PString & value                   
00381     );
00383 
00388     virtual void AlertingIncoming();
00389 
00392     virtual void AcceptIncoming();
00394 
00397 
00398     void * GetUserData() const  { return userData; }
00399 
00401     void SetUserData(void * v)  { userData = v; }
00403 
00404   protected:
00405     OpalLocalEndPoint & endpoint;
00406     void * userData;
00407 };
00408 
00409 
00414 class OpalLocalMediaStream : public OpalMediaStream, public OpalMediaStreamPacing
00415 {
00416     PCLASSINFO(OpalLocalMediaStream, OpalMediaStream);
00417   public:
00422     OpalLocalMediaStream(
00423       OpalLocalConnection & conn,          
00424       const OpalMediaFormat & mediaFormat, 
00425       unsigned sessionID,                  
00426       bool isSource,                       
00427       bool isSynchronous                   
00428     );
00430 
00438     virtual PBoolean ReadPacket(
00439       RTP_DataFrame & packet
00440     );
00441 
00447     virtual PBoolean WritePacket(
00448       RTP_DataFrame & packet
00449     );
00450 
00454     virtual PBoolean ReadData(
00455       BYTE * data,      
00456       PINDEX size,      
00457       PINDEX & length   
00458     );
00459 
00463     virtual PBoolean WriteData(
00464       const BYTE * data,   
00465       PINDEX length,       
00466       PINDEX & written     
00467     );
00468 
00472     virtual PBoolean IsSynchronous() const;
00474 
00475   protected:
00476     bool m_isSynchronous;
00477 };
00478 
00479 
00480 #endif // OPAL_OPAL_LOCALEP_H
00481 
00482 
00483 // End of File ///////////////////////////////////////////////////////////////

Generated on Mon Feb 21 20:19:21 2011 for OPAL by  doxygen 1.4.7