OPAL Version 3.10.2
|
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: 26069 $ 00028 * $Author: rjongbloed $ 00029 * $Date: 2011-06-23 19:56:50 -0500 (Thu, 23 Jun 2011) $ 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 00160 virtual bool OnIncomingCall( 00161 OpalLocalConnection & connection 00162 ); 00163 00168 virtual bool AlertingIncomingCall( 00169 const PString & token 00170 ); 00171 00176 virtual bool AcceptIncomingCall( 00177 const PString & token 00178 ); 00179 00184 virtual bool RejectIncomingCall( 00185 const PString & token, 00186 const OpalConnection::CallEndReason & reason = OpalConnection::EndedByAnswerDenied 00187 ); 00188 00194 virtual bool OnUserInput( 00195 const OpalLocalConnection & connection, 00196 const PString & indication 00197 ); 00198 00204 virtual bool OnReadMediaFrame( 00205 const OpalLocalConnection & connection, 00206 const OpalMediaStream & mediaStream, 00207 RTP_DataFrame & frame 00208 ); 00209 00216 virtual bool OnWriteMediaFrame( 00217 const OpalLocalConnection & connection, 00218 const OpalMediaStream & mediaStream, 00219 RTP_DataFrame & frame 00220 ); 00221 00227 virtual bool OnReadMediaData( 00228 const OpalLocalConnection & connection, 00229 const OpalMediaStream & mediaStream, 00230 void * data, 00231 PINDEX size, 00232 PINDEX & length 00233 ); 00234 00240 virtual bool OnWriteMediaData( 00241 const OpalLocalConnection & connection, 00242 const OpalMediaStream & mediaStream, 00243 const void * data, 00244 PINDEX length, 00245 PINDEX & written 00246 ); 00247 00260 virtual bool IsSynchronous() const; 00261 00264 bool IsDeferredAlerting() const { return m_deferredAlerting; } 00265 00268 void SetDeferredAlerting(bool defer) { m_deferredAlerting = defer; } 00269 00272 bool IsDeferredAnswer() const { return m_deferredAnswer; } 00273 00276 void SetDeferredAnswer(bool defer) { m_deferredAnswer = defer; } 00278 00279 protected: 00280 bool m_deferredAlerting; 00281 bool m_deferredAnswer; 00282 00283 private: 00284 P_REMOVE_VIRTUAL(OpalLocalConnection *, CreateConnection(OpalCall &, void *), 0); 00285 }; 00286 00287 00292 class OpalLocalConnection : public OpalConnection 00293 { 00294 PCLASSINFO(OpalLocalConnection, OpalConnection); 00295 public: 00300 OpalLocalConnection( 00301 OpalCall & call, 00302 OpalLocalEndPoint & endpoint, 00303 void * userData, 00304 unsigned options, 00305 OpalConnection::StringOptions * stringOptions, 00306 char tokenPrefix = 'L' 00307 ); 00308 00311 ~OpalLocalConnection(); 00313 00324 virtual PBoolean IsNetworkConnection() const { return false; } 00325 00332 virtual PBoolean SetUpConnection(); 00333 00344 virtual PBoolean SetAlerting( 00345 const PString & calleeName, 00346 PBoolean withMedia 00347 ); 00348 00359 virtual PBoolean SetConnected(); 00360 00375 virtual OpalMediaStream * CreateMediaStream( 00376 const OpalMediaFormat & mediaFormat, 00377 unsigned sessionID, 00378 PBoolean isSource 00379 ); 00380 00383 virtual OpalMediaStreamPtr OpenMediaStream( 00384 const OpalMediaFormat & mediaFormat, 00385 unsigned sessionID, 00386 bool isSource 00387 ); 00388 00396 virtual PBoolean SendUserInputString( 00397 const PString & value 00398 ); 00400 00405 virtual void AlertingIncoming(); 00406 00409 virtual void AcceptIncoming(); 00411 00414 00415 void * GetUserData() const { return userData; } 00416 00418 void SetUserData(void * v) { userData = v; } 00420 00421 protected: 00422 OpalLocalEndPoint & endpoint; 00423 void * userData; 00424 }; 00425 00426 00431 class OpalLocalMediaStream : public OpalMediaStream, public OpalMediaStreamPacing 00432 { 00433 PCLASSINFO(OpalLocalMediaStream, OpalMediaStream); 00434 public: 00439 OpalLocalMediaStream( 00440 OpalLocalConnection & conn, 00441 const OpalMediaFormat & mediaFormat, 00442 unsigned sessionID, 00443 bool isSource, 00444 bool isSynchronous 00445 ); 00447 00455 virtual PBoolean ReadPacket( 00456 RTP_DataFrame & packet 00457 ); 00458 00464 virtual PBoolean WritePacket( 00465 RTP_DataFrame & packet 00466 ); 00467 00471 virtual PBoolean ReadData( 00472 BYTE * data, 00473 PINDEX size, 00474 PINDEX & length 00475 ); 00476 00480 virtual PBoolean WriteData( 00481 const BYTE * data, 00482 PINDEX length, 00483 PINDEX & written 00484 ); 00485 00489 virtual PBoolean IsSynchronous() const; 00491 00492 protected: 00493 bool m_isSynchronous; 00494 }; 00495 00496 00497 #endif // OPAL_OPAL_LOCALEP_H 00498 00499 00500 // End of File ///////////////////////////////////////////////////////////////