OPAL  Version 3.10.4
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: 26939 $
28  * $Author: rjongbloed $
29  * $Date: 2012-02-07 01:17:49 -0600 (Tue, 07 Feb 2012) $
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 OnOutgoingCall(
149  const OpalLocalConnection & connection
150  );
151 
160  virtual bool OnIncomingCall(
161  OpalLocalConnection & connection
162  );
163 
168  virtual bool AlertingIncomingCall(
169  const PString & token,
170  OpalConnection::StringOptions * options = NULL
171  );
172 
177  virtual bool AcceptIncomingCall(
178  const PString & token,
179  OpalConnection::StringOptions * options = NULL
180  );
181 
186  virtual bool RejectIncomingCall(
187  const PString & token,
189  );
190 
196  virtual bool OnUserInput(
197  const OpalLocalConnection & connection,
198  const PString & indication
199  );
200 
206  virtual bool OnReadMediaFrame(
207  const OpalLocalConnection & connection,
208  const OpalMediaStream & mediaStream,
209  RTP_DataFrame & frame
210  );
211 
218  virtual bool OnWriteMediaFrame(
219  const OpalLocalConnection & connection,
220  const OpalMediaStream & mediaStream,
221  RTP_DataFrame & frame
222  );
223 
229  virtual bool OnReadMediaData(
230  const OpalLocalConnection & connection,
231  const OpalMediaStream & mediaStream,
232  void * data,
233  PINDEX size,
234  PINDEX & length
235  );
236 
242  virtual bool OnWriteMediaData(
243  const OpalLocalConnection & connection,
244  const OpalMediaStream & mediaStream,
245  const void * data,
246  PINDEX length,
247  PINDEX & written
248  );
249 
262  virtual bool IsSynchronous() const;
263 
266  bool IsDeferredAlerting() const { return m_deferredAlerting; }
267 
270  void SetDeferredAlerting(bool defer) { m_deferredAlerting = defer; }
271 
274  bool IsDeferredAnswer() const { return m_deferredAnswer; }
275 
278  void SetDeferredAnswer(bool defer) { m_deferredAnswer = defer; }
280 
281  protected:
284 
285  private:
286  P_REMOVE_VIRTUAL(OpalLocalConnection *, CreateConnection(OpalCall &, void *), 0);
287 };
288 
289 
295 {
296  PCLASSINFO(OpalLocalConnection, OpalConnection);
297  public:
303  OpalCall & call,
305  void * userData,
306  unsigned options,
307  OpalConnection::StringOptions * stringOptions,
308  char tokenPrefix = 'L'
309  );
310 
315 
326  virtual PBoolean IsNetworkConnection() const { return false; }
327 
329  virtual void OnApplyStringOptions();
330 
337  virtual PBoolean SetUpConnection();
338 
349  virtual PBoolean SetAlerting(
350  const PString & calleeName,
351  PBoolean withMedia
352  );
353 
364  virtual PBoolean SetConnected();
365 
381  const OpalMediaFormat & mediaFormat,
382  unsigned sessionID,
383  PBoolean isSource
384  );
385 
389  const OpalMediaFormat & mediaFormat,
390  unsigned sessionID,
391  bool isSource
392  );
393 
401  virtual PBoolean SendUserInputString(
402  const PString & value
403  );
405 
410  virtual void AlertingIncoming();
411 
414  virtual void AcceptIncoming();
416 
419 
420  void * GetUserData() const { return userData; }
421 
423  void SetUserData(void * v) { userData = v; }
425 
426  protected:
428  void * userData;
429 };
430 
431 
437 {
439  public:
445  OpalLocalConnection & conn,
446  const OpalMediaFormat & mediaFormat,
447  unsigned sessionID,
448  bool isSource,
449  bool isSynchronous
450  );
452 
460  virtual PBoolean ReadPacket(
461  RTP_DataFrame & packet
462  );
463 
469  virtual PBoolean WritePacket(
470  RTP_DataFrame & packet
471  );
472 
476  virtual PBoolean ReadData(
477  BYTE * data,
478  PINDEX size,
479  PINDEX & length
480  );
481 
485  virtual PBoolean WriteData(
486  const BYTE * data,
487  PINDEX length,
488  PINDEX & written
489  );
490 
494  virtual PBoolean IsSynchronous() const;
496 
497  protected:
499 };
500 
501 
502 #endif // OPAL_OPAL_LOCALEP_H
503 
504 
505 // End of File ///////////////////////////////////////////////////////////////