OPAL  Version 3.12.5
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: 29937 $
28  * $Author: rjongbloed $
29  * $Date: 2013-06-12 21:03:10 -0500 (Wed, 12 Jun 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 
51 {
52  PCLASSINFO(OpalLocalEndPoint, OpalEndPoint);
53  public:
60  const char * prefix = "local"
61  );
62 
67 
80  virtual OpalMediaFormatList GetMediaFormats() const;
81 
111  virtual PSafePtr<OpalConnection> MakeConnection(
112  OpalCall & call,
113  const PString & party,
114  void * userData = NULL,
115  unsigned int options = 0,
116  OpalConnection::StringOptions * stringOptions = NULL
117  );
119 
128  PSafePtr<OpalLocalConnection> GetLocalConnectionWithLock(
129  const PString & token,
130  PSafetyMode mode = PSafeReadWrite
131  ) { return GetConnectionWithLockAs<OpalLocalConnection>(token, mode); }
132 
137  OpalCall & call,
138  void * userData,
139  unsigned options,
140  OpalConnection::StringOptions * stringOptions
141  );
142 
148  virtual bool OnOutgoingSetUp(
149  const OpalLocalConnection & connection
150  );
151 
157  virtual bool OnOutgoingCall(
158  const OpalLocalConnection & connection
159  );
160 
169  virtual bool OnIncomingCall(
170  OpalLocalConnection & connection
171  );
172 
177  virtual bool AlertingIncomingCall(
178  const PString & token,
179  OpalConnection::StringOptions * options = NULL,
180  bool withMedia = false
181  );
182 
187  virtual bool AcceptIncomingCall(
188  const PString & token,
189  OpalConnection::StringOptions * options = NULL
190  );
191 
196  virtual bool RejectIncomingCall(
197  const PString & token,
198  const OpalConnection::CallEndReason & reason = OpalConnection::EndedByAnswerDenied
199  );
200 
206  virtual bool OnUserInput(
207  const OpalLocalConnection & connection,
208  const PString & indication
209  );
210 
219  virtual bool OnReadMediaFrame(
220  const OpalLocalConnection & connection,
221  const OpalMediaStream & mediaStream,
222  RTP_DataFrame & frame
223  );
224 
233  virtual bool OnWriteMediaFrame(
234  const OpalLocalConnection & connection,
235  const OpalMediaStream & mediaStream,
236  RTP_DataFrame & frame
237  );
238 
247  virtual bool OnReadMediaData(
248  const OpalLocalConnection & connection,
249  const OpalMediaStream & mediaStream,
250  void * data,
251  PINDEX size,
252  PINDEX & length
253  );
254 
274  virtual bool OnWriteMediaData(
275  const OpalLocalConnection & connection,
276  const OpalMediaStream & mediaStream,
277  const void * data,
278  PINDEX length,
279  PINDEX & written
280  );
281 
307  };
308 
318  const OpalMediaFormat & mediaFormat,
319  bool isSource
320  ) const;
321 
325 
329 
333 
337 
340  bool IsDeferredAlerting() const { return m_deferredAlerting; }
341 
344  void SetDeferredAlerting(bool defer) { m_deferredAlerting = defer; }
345 
348  bool IsDeferredAnswer() const { return m_deferredAnswer; }
349 
352  void SetDeferredAnswer(bool defer) { m_deferredAnswer = defer; }
354 
355  protected:
358 
361 
362  private:
363  P_REMOVE_VIRTUAL(OpalLocalConnection *, CreateConnection(OpalCall &, void *), 0);
364  P_REMOVE_VIRTUAL(bool, IsSynchronous() const, false);
365 };
366 
367 
373 {
374  PCLASSINFO(OpalLocalConnection, OpalConnection);
375  public:
381  OpalCall & call,
383  void * userData,
384  unsigned options,
385  OpalConnection::StringOptions * stringOptions,
386  char tokenPrefix = 'L'
387  );
388 
393 
421  virtual PBoolean OnIncomingConnection(unsigned int options, OpalConnection::StringOptions * stringOptions);
422 
431  virtual PBoolean IsNetworkConnection() const { return false; }
432 
434  virtual void OnApplyStringOptions();
435 
445  virtual PBoolean SetUpConnection();
446 
457  virtual PBoolean SetAlerting(
458  const PString & calleeName,
459  PBoolean withMedia
460  );
461 
472  virtual PBoolean SetConnected();
473 
489  const OpalMediaFormat & mediaFormat,
490  unsigned sessionID,
491  PBoolean isSource
492  );
493 
497  const OpalMediaFormat & mediaFormat,
498  unsigned sessionID,
499  bool isSource
500  );
501 
509  virtual PBoolean SendUserInputString(
510  const PString & value
511  );
513 
522  virtual bool OnOutgoingSetUp();
523 
530  virtual bool OnOutgoing();
531 
540  virtual bool OnIncoming();
541 
544  virtual void AlertingIncoming(
545  bool withMedia = false
546  );
547 
550  virtual void AcceptIncoming();
552 
555  void * GetUserData() const { return m_userData; }
557 
559  void SetUserData(void * v) { m_userData = v; }
561 
562  protected:
563  friend class PSafeWorkNoArg<OpalLocalConnection>;
564  void InternalAcceptIncoming();
565 
567  void * m_userData;
568 };
569 
570 
576 {
578  public:
584  OpalLocalConnection & conn,
585  const OpalMediaFormat & mediaFormat,
586  unsigned sessionID,
587  bool isSource,
588  OpalLocalEndPoint::Synchronicity synchronicity
589  );
591 
599  virtual PBoolean ReadPacket(
600  RTP_DataFrame & packet
601  );
602 
608  virtual PBoolean WritePacket(
609  RTP_DataFrame & packet
610  );
611 
615  virtual PBoolean ReadData(
616  BYTE * data,
617  PINDEX size,
618  PINDEX & length
619  );
620 
624  virtual PBoolean WriteData(
625  const BYTE * data,
626  PINDEX length,
627  PINDEX & written
628  );
629 
633  virtual PBoolean IsSynchronous() const;
635 
636  protected:
637  virtual void InternalClose() { }
638 
640 };
641 
642 
643 #endif // OPAL_OPAL_LOCALEP_H
644 
645 
646 // End of File ///////////////////////////////////////////////////////////////