OPAL  Version 3.12.9
localep.h
Go to the documentation of this file.
1 /*
2  * localep.h
3  *
4  * Local EndPoint/Connection.
5  *
6  * Open Phone Abstraction Library (OPAL)
7  * Formally known as the Open H323 project.
8  *
9  * Copyright (c) 2008 Vox Lucida Pty. Ltd.
10  *
11  * The contents of this file are subject to the Mozilla Public License
12  * Version 1.0 (the "License"); you may not use this file except in
13  * compliance with the License. You may obtain a copy of the License at
14  * http://www.mozilla.org/MPL/
15  *
16  * Software distributed under the License is distributed on an "AS IS"
17  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
18  * the License for the specific language governing rights and limitations
19  * under the License.
20  *
21  * The Original Code is Open Phone Abstraction Library.
22  *
23  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
24  *
25  * Contributor(s): ______________________________________.
26  *
27  * $Revision: 31065 $
28  * $Author: rjongbloed $
29  * $Date: 2013-12-11 17:08:05 +1100 (Wed, 11 Dec 2013) $
30  */
31 
32 #ifndef OPAL_OPAL_LOCALEP_H
33 #define OPAL_OPAL_LOCALEP_H
34 
35 #ifdef P_USE_PRAGMA
36 #pragma interface
37 #endif
38 
39 #include <opal/buildopts.h>
40 
41 #include <opal/endpoint.h>
42 
44 
45 
46 #define OPAL_LOCAL_PREFIX "local"
47 
48 
54 {
55  PCLASSINFO(OpalLocalEndPoint, OpalEndPoint);
56  public:
63  const char * prefix = OPAL_LOCAL_PREFIX
64  );
65 
70 
83  virtual OpalMediaFormatList GetMediaFormats() const;
84 
114  virtual PSafePtr<OpalConnection> MakeConnection(
115  OpalCall & call,
116  const PString & party,
117  void * userData = NULL,
118  unsigned int options = 0,
119  OpalConnection::StringOptions * stringOptions = NULL
120  );
122 
131  PSafePtr<OpalLocalConnection> GetLocalConnectionWithLock(
132  const PString & token,
133  PSafetyMode mode = PSafeReadWrite
134  ) { return GetConnectionWithLockAs<OpalLocalConnection>(token, mode); }
135 
140  OpalCall & call,
141  void * userData,
142  unsigned options,
143  OpalConnection::StringOptions * stringOptions
144  );
145 
151  virtual bool OnOutgoingSetUp(
152  const OpalLocalConnection & connection
153  );
154 
160  virtual bool OnOutgoingCall(
161  const OpalLocalConnection & connection
162  );
163 
172  virtual bool OnIncomingCall(
173  OpalLocalConnection & connection
174  );
175 
180  virtual bool AlertingIncomingCall(
181  const PString & token,
182  OpalConnection::StringOptions * options = NULL,
183  bool withMedia = false
184  );
185 
190  virtual bool AcceptIncomingCall(
191  const PString & token,
192  OpalConnection::StringOptions * options = NULL
193  );
194 
199  virtual bool RejectIncomingCall(
200  const PString & token,
201  const OpalConnection::CallEndReason & reason = OpalConnection::EndedByAnswerDenied
202  );
203 
209  virtual bool OnUserInput(
210  const OpalLocalConnection & connection,
211  const PString & indication
212  );
213 
222  virtual bool OnReadMediaFrame(
223  const OpalLocalConnection & connection,
224  const OpalMediaStream & mediaStream,
225  RTP_DataFrame & frame
226  );
227 
236  virtual bool OnWriteMediaFrame(
237  const OpalLocalConnection & connection,
238  const OpalMediaStream & mediaStream,
239  RTP_DataFrame & frame
240  );
241 
250  virtual bool OnReadMediaData(
251  const OpalLocalConnection & connection,
252  const OpalMediaStream & mediaStream,
253  void * data,
254  PINDEX size,
255  PINDEX & length
256  );
257 
277  virtual bool OnWriteMediaData(
278  const OpalLocalConnection & connection,
279  const OpalMediaStream & mediaStream,
280  const void * data,
281  PINDEX length,
282  PINDEX & written
283  );
284 
310  };
311 
321  const OpalMediaFormat & mediaFormat,
322  bool isSource
323  ) const;
324 
328 
332 
336 
340 
343  bool IsDeferredAlerting() const { return m_deferredAlerting; }
344 
347  void SetDeferredAlerting(bool defer) { m_deferredAlerting = defer; }
348 
351  bool IsDeferredAnswer() const { return m_deferredAnswer; }
352 
355  void SetDeferredAnswer(bool defer) { m_deferredAnswer = defer; }
357 
358  protected:
361 
364 
365  private:
366  P_REMOVE_VIRTUAL(OpalLocalConnection *, CreateConnection(OpalCall &, void *), 0);
367  P_REMOVE_VIRTUAL(bool, IsSynchronous() const, false);
368 };
369 
370 
376 {
377  PCLASSINFO(OpalLocalConnection, OpalConnection);
378  public:
384  OpalCall & call,
386  void * userData,
387  unsigned options,
388  OpalConnection::StringOptions * stringOptions,
389  char tokenPrefix = 'L'
390  );
391 
396 
424  virtual PBoolean OnIncomingConnection(unsigned int options, OpalConnection::StringOptions * stringOptions);
425 
434  virtual PBoolean IsNetworkConnection() const { return false; }
435 
437  virtual void OnApplyStringOptions();
438 
448  virtual PBoolean SetUpConnection();
449 
460  virtual PBoolean SetAlerting(
461  const PString & calleeName,
462  PBoolean withMedia
463  );
464 
475  virtual PBoolean SetConnected();
476 
492  const OpalMediaFormat & mediaFormat,
493  unsigned sessionID,
494  PBoolean isSource
495  );
496 
500  const OpalMediaFormat & mediaFormat,
501  unsigned sessionID,
502  bool isSource
503  );
504 
512  virtual PBoolean SendUserInputString(
513  const PString & value
514  );
516 
525  virtual bool OnOutgoingSetUp();
526 
533  virtual bool OnOutgoing();
534 
543  virtual bool OnIncoming();
544 
547  virtual void AlertingIncoming(
548  bool withMedia = false
549  );
550 
553  virtual void AcceptIncoming();
555 
558 
559  void * GetUserData() const { return m_userData; }
560 
562  void SetUserData(void * v) { m_userData = v; }
564 
565  protected:
566  friend class PSafeWorkNoArg<OpalLocalConnection>;
567  void InternalAcceptIncoming();
568 
570  void * m_userData;
571 };
572 
573 
579 {
581  public:
587  OpalLocalConnection & conn,
588  const OpalMediaFormat & mediaFormat,
589  unsigned sessionID,
590  bool isSource,
591  OpalLocalEndPoint::Synchronicity synchronicity
592  );
594 
602  virtual PBoolean ReadPacket(
603  RTP_DataFrame & packet
604  );
605 
611  virtual PBoolean WritePacket(
612  RTP_DataFrame & packet
613  );
614 
618  virtual PBoolean ReadData(
619  BYTE * data,
620  PINDEX size,
621  PINDEX & length
622  );
623 
627  virtual PBoolean WriteData(
628  const BYTE * data,
629  PINDEX length,
630  PINDEX & written
631  );
632 
636  virtual PBoolean IsSynchronous() const;
638 
639  protected:
640  virtual void InternalClose() { }
641 
643 };
644 
645 
646 #endif // OPAL_OPAL_LOCALEP_H
647 
648 
649 // End of File ///////////////////////////////////////////////////////////////