localep.h
Go to the documentation of this file.
/*
* localep.h
*
* Local EndPoint/Connection.
*
* Open Phone Abstraction Library (OPAL)
* Formally known as the Open H323 project.
*
* Copyright (c) 2008 Vox Lucida Pty. Ltd.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Open Phone Abstraction Library.
*
* The Initial Developer of the Original Code is Equivalence Pty. Ltd.
*
* Contributor(s): ______________________________________.
*
* $Revision: 28040 $
* $Author: rjongbloed $
* $Date: 2012-07-16 01:23:59 -0500 (Mon, 16 Jul 2012) $
*/
#ifndef OPAL_OPAL_LOCALEP_H
#define OPAL_OPAL_LOCALEP_H
#ifdef P_USE_PRAGMA
#pragma interface
#endif
#include <opal/buildopts.h>
#include <opal/endpoint.h>
class OpalLocalConnection;
class OpalLocalEndPoint : public OpalEndPoint
{
PCLASSINFO(OpalLocalEndPoint, OpalEndPoint);
public:
OpalLocalEndPoint(
OpalManager & manager,
const char * prefix = "local"
);
~OpalLocalEndPoint();
virtual OpalMediaFormatList GetMediaFormats() const;
virtual PSafePtr<OpalConnection> MakeConnection(
OpalCall & call,
const PString & party,
void * userData = NULL,
unsigned int options = 0,
OpalConnection::StringOptions * stringOptions = NULL
);
PSafePtr<OpalLocalConnection> GetLocalConnectionWithLock(
const PString & token,
PSafetyMode mode = PSafeReadWrite
) { return GetConnectionWithLockAs<OpalLocalConnection>(token, mode); }
virtual OpalLocalConnection * CreateConnection(
OpalCall & call,
void * userData,
unsigned options,
OpalConnection::StringOptions * stringOptions
);
virtual bool OnOutgoingSetUp(
const OpalLocalConnection & connection
);
virtual bool OnOutgoingCall(
const OpalLocalConnection & connection
);
virtual bool OnIncomingCall(
OpalLocalConnection & connection
);
virtual bool AlertingIncomingCall(
const PString & token,
OpalConnection::StringOptions * options = NULL
);
virtual bool AcceptIncomingCall(
const PString & token,
OpalConnection::StringOptions * options = NULL
);
virtual bool RejectIncomingCall(
const PString & token,
const OpalConnection::CallEndReason & reason = OpalConnection::EndedByAnswerDenied
);
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
);
enum Synchronicity {
e_Synchronous,
e_Asynchronous,
e_SimulateSyncronous
};
virtual Synchronicity GetSynchronicity(
const OpalMediaFormat & mediaFormat,
bool isSource
) const;
Synchronicity GetDefaultAudioSynchronicity() const { return m_defaultAudioSynchronicity; }
void SetDefaultAudioSynchronicity(Synchronicity sync) { m_defaultAudioSynchronicity = sync; }
Synchronicity GetDefaultVideoSourceSynchronicity() const { return m_defaultVideoSourceSynchronicity; }
void SetDefaultVideoSourceSynchronicity(Synchronicity sync) { m_defaultVideoSourceSynchronicity = sync; }
bool IsDeferredAlerting() const { return m_deferredAlerting; }
void SetDeferredAlerting(bool defer) { m_deferredAlerting = defer; }
bool IsDeferredAnswer() const { return m_deferredAnswer; }
void SetDeferredAnswer(bool defer) { m_deferredAnswer = defer; }
protected:
bool m_deferredAlerting;
bool m_deferredAnswer;
Synchronicity m_defaultAudioSynchronicity;
Synchronicity m_defaultVideoSourceSynchronicity;
private:
P_REMOVE_VIRTUAL(OpalLocalConnection *, CreateConnection(OpalCall &, void *), 0);
P_REMOVE_VIRTUAL(bool, IsSynchronous() const, false);
};
class OpalLocalConnection : public OpalConnection
{
PCLASSINFO(OpalLocalConnection, OpalConnection);
public:
OpalLocalConnection(
OpalCall & call,
OpalLocalEndPoint & endpoint,
void * userData,
unsigned options,
OpalConnection::StringOptions * stringOptions,
char tokenPrefix = 'L'
);
~OpalLocalConnection();
virtual PBoolean IsNetworkConnection() const { return false; }
virtual void OnApplyStringOptions();
virtual PBoolean SetUpConnection();
virtual PBoolean SetAlerting(
const PString & calleeName,
PBoolean withMedia
);
virtual PBoolean SetConnected();
virtual OpalMediaStream * CreateMediaStream(
const OpalMediaFormat & mediaFormat,
unsigned sessionID,
PBoolean isSource
);
virtual OpalMediaStreamPtr OpenMediaStream(
const OpalMediaFormat & mediaFormat,
unsigned sessionID,
bool isSource
);
virtual PBoolean SendUserInputString(
const PString & value
);
virtual bool OnOutgoingSetUp();
virtual bool OnOutgoing();
virtual bool OnIncoming();
virtual void AlertingIncoming();
virtual void AcceptIncoming();
void * GetUserData() const { return m_userData; }
void SetUserData(void * v) { m_userData = v; }
protected:
OpalLocalEndPoint & endpoint;
void * m_userData;
};
class OpalLocalMediaStream : public OpalMediaStream, public OpalMediaStreamPacing
{
PCLASSINFO(OpalLocalMediaStream, OpalMediaStream);
public:
OpalLocalMediaStream(
OpalLocalConnection & conn,
const OpalMediaFormat & mediaFormat,
unsigned sessionID,
bool isSource,
OpalLocalEndPoint::Synchronicity synchronicity
);
virtual PBoolean ReadPacket(
RTP_DataFrame & packet
);
virtual PBoolean WritePacket(
RTP_DataFrame & packet
);
virtual PBoolean ReadData(
BYTE * data,
PINDEX size,
PINDEX & length
);
virtual PBoolean WriteData(
const BYTE * data,
PINDEX length,
PINDEX & written
);
virtual PBoolean IsSynchronous() const;
protected:
virtual void InternalClose() { }
OpalLocalEndPoint::Synchronicity m_synchronicity;
};
#endif // OPAL_OPAL_LOCALEP_H
// End of File ///////////////////////////////////////////////////////////////
OpalLocalConnection::SetAlerting
virtual PBoolean SetAlerting(const PString &calleeName, PBoolean withMedia)
OpalLocalEndPoint::e_Synchronous
Functions will block for correct real time.
Definition: localep.h:292
OpalLocalEndPoint::SetDefaultVideoSourceSynchronicity
void SetDefaultVideoSourceSynchronicity(Synchronicity sync)
Definition: localep.h:324
OpalManager
Definition: manager.h:74
OpalEndPoint
Definition: endpoint.h:67
OpalLocalMediaStream::OpalLocalMediaStream
OpalLocalMediaStream(OpalLocalConnection &conn, const OpalMediaFormat &mediaFormat, unsigned sessionID, bool isSource, OpalLocalEndPoint::Synchronicity synchronicity)
OpalLocalEndPoint::IsDeferredAlerting
bool IsDeferredAlerting() const
Definition: localep.h:328
OpalLocalConnection::CreateMediaStream
virtual OpalMediaStream * CreateMediaStream(const OpalMediaFormat &mediaFormat, unsigned sessionID, PBoolean isSource)
OpalMediaStream::isSource
bool isSource
Definition: mediastrm.h:421
OpalLocalEndPoint::Synchronicity
Synchronicity
Definition: localep.h:291
OpalLocalMediaStream::m_synchronicity
OpalLocalEndPoint::Synchronicity m_synchronicity
Definition: localep.h:595
OpalLocalEndPoint::OnWriteMediaData
virtual bool OnWriteMediaData(const OpalLocalConnection &connection, const OpalMediaStream &mediaStream, const void *data, PINDEX length, PINDEX &written)
OpalLocalConnection::OnApplyStringOptions
virtual void OnApplyStringOptions()
Call back for connection to act on changed string options.
OpalLocalConnection::OpalLocalConnection
OpalLocalConnection(OpalCall &call, OpalLocalEndPoint &endpoint, void *userData, unsigned options, OpalConnection::StringOptions *stringOptions, char tokenPrefix= 'L')
OpalLocalEndPoint::GetLocalConnectionWithLock
PSafePtr< OpalLocalConnection > GetLocalConnectionWithLock(const PString &token, PSafetyMode mode=PSafeReadWrite)
Definition: localep.h:128
buildopts.h
OpalLocalConnection
Definition: localep.h:360
OpalLocalEndPoint::IsDeferredAnswer
bool IsDeferredAnswer() const
Definition: localep.h:336
OpalLocalEndPoint::SetDeferredAlerting
void SetDeferredAlerting(bool defer)
Definition: localep.h:332
OpalLocalEndPoint::OnReadMediaFrame
virtual bool OnReadMediaFrame(const OpalLocalConnection &connection, const OpalMediaStream &mediaStream, RTP_DataFrame &frame)
OpalMediaStreamPtr
PSafePtr< OpalMediaStream > OpalMediaStreamPtr
Definition: mediastrm.h:442
OpalLocalEndPoint::MakeConnection
virtual PSafePtr< OpalConnection > MakeConnection(OpalCall &call, const PString &party, void *userData=NULL, unsigned int options=0, OpalConnection::StringOptions *stringOptions=NULL)
OpalLocalMediaStream
Definition: localep.h:531
OpalLocalConnection::~OpalLocalConnection
~OpalLocalConnection()
OpalLocalEndPoint::RejectIncomingCall
virtual bool RejectIncomingCall(const PString &token, const OpalConnection::CallEndReason &reason=OpalConnection::EndedByAnswerDenied)
OpalConnection::EndedByAnswerDenied
Local endpoint did not accept call OnIncomingCall()=false.
Definition: connection.h:364
OpalLocalConnection::SetUserData
void SetUserData(void *v)
Set user data pointer.
Definition: localep.h:518
OpalLocalConnection::IsNetworkConnection
virtual PBoolean IsNetworkConnection() const
Definition: localep.h:392
OpalLocalEndPoint::OnIncomingCall
virtual bool OnIncomingCall(OpalLocalConnection &connection)
OpalMediaFormatList
Definition: mediafmt.h:72
OpalLocalEndPoint::OpalLocalEndPoint
OpalLocalEndPoint(OpalManager &manager, const char *prefix="local")
OpalLocalEndPoint::m_defaultAudioSynchronicity
Synchronicity m_defaultAudioSynchronicity
Definition: localep.h:347
OpalLocalConnection::endpoint
OpalLocalEndPoint & endpoint
Definition: localep.h:522
OpalConnection::StringOptions
Definition: connection.h:462
OpalLocalEndPoint::e_Asynchronous
Functions will not block, and do not require any real time handling.
Definition: localep.h:293
OpalLocalConnection::AlertingIncoming
virtual void AlertingIncoming()
OpalMediaStream::sessionID
unsigned sessionID
Definition: mediastrm.h:417
RTP_DataFrame
Definition: rtp.h:71
OpalLocalEndPoint::~OpalLocalEndPoint
~OpalLocalEndPoint()
OpalLocalEndPoint
Definition: localep.h:50
OpalLocalConnection::SetUpConnection
virtual PBoolean SetUpConnection()
OpalMediaFormat
Definition: mediafmt.h:724
OpalLocalEndPoint::SetDeferredAnswer
void SetDeferredAnswer(bool defer)
Definition: localep.h:340
OpalLocalMediaStream::WritePacket
virtual PBoolean WritePacket(RTP_DataFrame &packet)
OpalLocalConnection::m_userData
void * m_userData
Definition: localep.h:523
OpalCall
Definition: call.h:65
OpalLocalEndPoint::AlertingIncomingCall
virtual bool AlertingIncomingCall(const PString &token, OpalConnection::StringOptions *options=NULL)
OpalLocalEndPoint::GetMediaFormats
virtual OpalMediaFormatList GetMediaFormats() const
OpalLocalEndPoint::OnWriteMediaFrame
virtual bool OnWriteMediaFrame(const OpalLocalConnection &connection, const OpalMediaStream &mediaStream, RTP_DataFrame &frame)
OpalLocalConnection::OpenMediaStream
virtual OpalMediaStreamPtr OpenMediaStream(const OpalMediaFormat &mediaFormat, unsigned sessionID, bool isSource)
OpalEndPoint::manager
OpalManager & manager
Definition: endpoint.h:807
OpalLocalEndPoint::OnReadMediaData
virtual bool OnReadMediaData(const OpalLocalConnection &connection, const OpalMediaStream &mediaStream, void *data, PINDEX size, PINDEX &length)
OpalMediaStreamPacing
Definition: mediastrm.h:447
OpalLocalConnection::OnIncoming
virtual bool OnIncoming()
OpalLocalConnection::SetConnected
virtual PBoolean SetConnected()
OpalLocalConnection::SendUserInputString
virtual PBoolean SendUserInputString(const PString &value)
OpalConnection::CallEndReason
Definition: connection.h:396
OpalLocalEndPoint::e_SimulateSyncronous
Functions wlll not block, but do require real time handling.
Definition: localep.h:294
OpalLocalConnection::OnOutgoingSetUp
virtual bool OnOutgoingSetUp()
OpalLocalMediaStream::InternalClose
virtual void InternalClose()
Definition: localep.h:593
OpalLocalConnection::OnOutgoing
virtual bool OnOutgoing()
OpalLocalMediaStream::IsSynchronous
virtual PBoolean IsSynchronous() const
OpalLocalEndPoint::m_deferredAnswer
bool m_deferredAnswer
Definition: localep.h:345
OpalMediaStream
Definition: mediastrm.h:111
OpalMediaStream::mediaFormat
OpalMediaFormat mediaFormat
Definition: mediastrm.h:419
OpalLocalEndPoint::OnOutgoingSetUp
virtual bool OnOutgoingSetUp(const OpalLocalConnection &connection)
OpalLocalEndPoint::SetDefaultAudioSynchronicity
void SetDefaultAudioSynchronicity(Synchronicity sync)
Definition: localep.h:316
OpalLocalEndPoint::OnOutgoingCall
virtual bool OnOutgoingCall(const OpalLocalConnection &connection)
OpalLocalEndPoint::GetDefaultAudioSynchronicity
Synchronicity GetDefaultAudioSynchronicity() const
Definition: localep.h:312
OpalConnection
Definition: connection.h:353
OpalLocalEndPoint::CreateConnection
virtual OpalLocalConnection * CreateConnection(OpalCall &call, void *userData, unsigned options, OpalConnection::StringOptions *stringOptions)
OpalLocalMediaStream::WriteData
virtual PBoolean WriteData(const BYTE *data, PINDEX length, PINDEX &written)
OpalLocalEndPoint::OnUserInput
virtual bool OnUserInput(const OpalLocalConnection &connection, const PString &indication)
OpalLocalMediaStream::ReadPacket
virtual PBoolean ReadPacket(RTP_DataFrame &packet)
OpalLocalEndPoint::m_deferredAlerting
bool m_deferredAlerting
Definition: localep.h:344
endpoint.h
OpalLocalEndPoint::GetDefaultVideoSourceSynchronicity
Synchronicity GetDefaultVideoSourceSynchronicity() const
Definition: localep.h:320
OpalLocalEndPoint::m_defaultVideoSourceSynchronicity
Synchronicity m_defaultVideoSourceSynchronicity
Definition: localep.h:348
OpalLocalEndPoint::GetSynchronicity
virtual Synchronicity GetSynchronicity(const OpalMediaFormat &mediaFormat, bool isSource) const
OpalLocalMediaStream::ReadData
virtual PBoolean ReadData(BYTE *data, PINDEX size, PINDEX &length)
OpalLocalEndPoint::AcceptIncomingCall
virtual bool AcceptIncomingCall(const PString &token, OpalConnection::StringOptions *options=NULL)
OpalLocalConnection::GetUserData
void * GetUserData() const
Get user data pointer.
Definition: localep.h:515
OpalLocalConnection::AcceptIncoming
virtual void AcceptIncoming()