# OpalLocalEndPoint Class Reference

`#include <localep.h>`

Inheritance diagram for OpalLocalEndPoint:

List of all members.

## Public Member Functions

Overrides from OpalEndPoint
virtual PBoolean | MakeConnection (OpalCall &call, const PString &party, void *userData=NULL, unsigned int options=0, OpalConnection::StringOptions *stringOptions=NULL)
Customisation call backs
PSafePtr< OpalLocalConnection > | GetLocalConnectionWithLock (const PString &token, PSafetyMode mode=PSafeReadWrite)
virtual OpalLocalConnection * | CreateConnection (OpalCall &call, void *userData)
virtual bool | OnOutgoingCall (const OpalLocalConnection &connection)
virtual bool | OnIncomingCall (OpalLocalConnection &connection)
virtual bool | AcceptIncomingCall (const PString &token)
virtual bool | RejectIncomingCall (const PString &token)
virtual bool | OnUserInput (const OpalLocalConnection &connection, const PString &indication)
virtual bool | OnReadMediaFrame (const OpalLocalConnection &connection, const OpalMediaStream &mediaStream, RTP_DataFrame &frame)
virtual bool | OnWriteMediaFrame (const OpalLocalConnection &connection, const OpalMediaStream &mediaStream, RTP_DataFrame &frame)
virtual bool | OnReadMediaData (const OpalLocalConnection &connection, const OpalMediaStream &mediaStream, void *data, PINDEX size, PINDEX &length)
virtual bool | OnWriteMediaData (const OpalLocalConnection &connection, const OpalMediaStream &mediaStream, const void *data, PINDEX length, PINDEX &written)
virtual bool | IsSynchronous () const

## Detailed Description

Local EndPoint. This class represents an endpoint on the local machine that can receive media via virtual functions.

## Constructor & Destructor Documentation

OpalLocalEndPoint::OpalLocalEndPoint | ( | OpalManager & | manager,
|  | const char * | prefix = `"local"` |
| ) |  |  |

Create a new endpoint.

Parameters:

  manager | Manager of all endpoints.
  prefix | Prefix for URL style address strings

OpalLocalEndPoint::~OpalLocalEndPoint | ( |  | ) |

Destroy endpoint.

OpalLocalEndPoint::OpalLocalEndPoint | ( | OpalManager & | manager,
|  | const char * | prefix = `"local"` |
| ) |  |  |

Create a new endpoint.

Parameters:

  manager | Manager of all endpoints.
  prefix | Prefix for URL style address strings

OpalLocalEndPoint::~OpalLocalEndPoint | ( |  | ) |

Destroy endpoint.

## Member Function Documentation

virtual PBoolean OpalLocalEndPoint::MakeConnection | ( | OpalCall & | call,
|  | const PString & | party,
|  | void * | userData = `NULL`,
|  | unsigned int | options = `0`,
|  | OpalConnection::StringOptions * | stringOptions = `NULL` |
| ) |  |  | `[virtual]`

Set up a connection to a remote party. This is called from the OpalManager::MakeConnection() function once it has determined that this is the endpoint for the protocol.

The general form for this party parameter is:

[proto:][alias@][transport$]address[:port]

where the various fields will have meanings specific to the endpoint type. For example, with H.323 it could be "h323:Fred@site.com" which indicates a user Fred at gatekeeper size.com. Whereas for the PSTN endpoint it could be "pstn:5551234" which is to call 5551234 on the first available PSTN line.

The proto field is optional when passed to a specific endpoint. If it is present, however, it must agree with the endpoints protocol name or false is returned.

This function usually returns almost immediately with the connection continuing to occur in a new background thread.

If false is returned then the connection could not be established. For example if a PSTN endpoint is used and the assiciated line is engaged then it may return immediately. Returning a non-NULL value does not mean that the connection will succeed, only that an attempt is being made.

The default behaviour is pure.

Parameters:

  call | Owner of connection
  party | Remote party to call
  userData | Arbitrary data to pass to connection
  options | options to pass to conneciton

Implements OpalEndPoint.

PSafePtr<OpalLocalConnection> OpalLocalEndPoint::GetLocalConnectionWithLock | ( | const PString & | token,
|  | PSafetyMode | mode = `PSafeReadWrite` |
| ) |  |  | `[inline]`

Find a connection that uses the specified token. This searches the endpoint for the connection that contains the token as provided by functions such as MakeConnection(). If not then it attempts to use the token as a OpalCall token and find a connection of the same class.

Parameters:

  token | Token to identify connection

virtual OpalLocalConnection* OpalLocalEndPoint::CreateConnection | ( | OpalCall & | call,
|  | void * | userData |
| ) |  |  | `[virtual]`

Create a connection for the PCSS endpoint. The default implementation is to create a OpalLocalConnection.

Parameters:

  call | Owner of connection
  userData | Arbitrary data to pass to connection

virtual bool OpalLocalEndPoint::OnOutgoingCall | ( | const OpalLocalConnection & | connection | ) | `[virtual]`

Call back to indicate that remote is ringing. If false is returned the call is aborted.

The default implementation does nothing.

Parameters:

  connection | Connection having event

virtual bool OpalLocalEndPoint::OnIncomingCall | ( | OpalLocalConnection & | connection | ) | `[virtual]`

Call back to indicate that remote is ringing. If false is returned the call is aborted.

The default implementation answers the call immediately.

Parameters:

  connection | Connection having event

virtual bool OpalLocalEndPoint::AcceptIncomingCall | ( | const PString & | token | ) | `[virtual]`

Accept the incoming connection. Returns false if the connection token does not correspond to a valid connection.

Parameters:

  token | Token of connection to accept call

virtual bool OpalLocalEndPoint::RejectIncomingCall | ( | const PString & | token | ) | `[virtual]`

Reject the incoming connection. Returns false if the connection token does not correspond to a valid connection.

Parameters:

  token | Token of connection to accept call

virtual bool OpalLocalEndPoint::OnUserInput | ( | const OpalLocalConnection & | connection,
|  | const PString & | indication |
| ) |  |  | `[virtual]`

Call back to indicate that the remote user has indicated something. If false is returned the call is aborted.

The default implementation does nothing.

Parameters:

  connection | Connection having event

virtual bool OpalLocalEndPoint::OnReadMediaFrame | ( | const OpalLocalConnection & | connection,
|  | const OpalMediaStream & | mediaStream,
|  | RTP_DataFrame & | frame |
| ) |  |  | `[virtual]`

Call back to get media data for transmission. If false is returned then OnReadMediaData() is called.

The default implementation returns false.

Parameters:

  connection | Connection for media
  mediaStream | Media stream data is required for
  frame | RTP frame for data

virtual bool OpalLocalEndPoint::OnWriteMediaFrame | ( | const OpalLocalConnection & | connection,
|  | const OpalMediaStream & | mediaStream,
|  | RTP_DataFrame & | frame |
| ) |  |  | `[virtual]`

Call back to handle received media data. If false is returned then OnWriteMediaData() is called.

The default implementation . The default implementation returns false.

Parameters:

  connection | Connection for media
  mediaStream | Media stream data is required for
  frame | RTP frame for data

virtual bool OpalLocalEndPoint::OnReadMediaData | ( | const OpalLocalConnection & | connection,
|  | const OpalMediaStream & | mediaStream,
|  | void * | data,
|  | PINDEX | size,
|  | PINDEX & | length |
| ) |  |  | `[virtual]`

Call back to get media data for transmission. If false is returned the media stream will be closed.

The default implementation returns false.

Parameters:

  connection | Connection for media
  mediaStream | Media stream data is required for
  data | Data to send
  size | Maximum size of data buffer
  length | Number of bytes placed in buffer

virtual bool OpalLocalEndPoint::OnWriteMediaData | ( | const OpalLocalConnection & | connection,
|  | const OpalMediaStream & | mediaStream,
|  | const void * | data,
|  | PINDEX | length,
|  | PINDEX & | written |
| ) |  |  | `[virtual]`

Call back to handle received media data. If false is returned the media stream will be closed.

The default implementation returns false.

Parameters:

  connection | Connection for media
  mediaStream | Media stream data is required for
  data | Data received
  length | Amount of data available to write
  written | Amount of data written

virtual bool OpalLocalEndPoint::IsSynchronous | ( |  | ) | const`[virtual]`

Indicate that I/O is synchronous. This indicates that the OnReadMediaXXX and OnWriteMediaXXX functions will execute blocking to the correct real time synchonisation. So if for example OnWriteMediaData() is sent 320 bytes of PCM data then it will, on average, block for 20 milliseconds per call.

If the function returns false, then the system will try and simulate the correct timing using the operating system sleep function. However this is not desirable as this function is notoriously inaccurate.

Default returns true.

The documentation for this class was generated from the following file:

- localep.h