Yate
MGCPEndpoint Class Reference

An MGCP endpoint. More...

#include <yatemgcp.h>

Inheritance diagram for MGCPEndpoint:
RefObject MGCPEndpointId Mutex GenObject Lockable

Public Member Functions

 MGCPEndpoint (MGCPEngine *engine, const char *user, const char *host, int port, bool addPort=true)
 
virtual ~MGCPEndpoint ()
 
virtual const StringtoString () const
 
MGCPEngineengine ()
 
MGCPEpInfoappend (const char *endpoint, const char *host, int port=0)
 
void clear ()
 
MGCPEpInfofind (const String &epId)
 
MGCPEpInfofindAlias (const String &alias)
 
MGCPEpInfopeer ()
 
- Public Member Functions inherited from RefObject
 RefObject ()
 
virtual ~RefObject ()
 
virtual void * getObject (const String &name) const
 
virtual bool alive () const
 
bool ref ()
 
bool deref ()
 
int refcount () const
 
virtual void destruct ()
 
- Public Member Functions inherited from GenObject
 GenObject ()
 
virtual ~GenObject ()
 
virtual const StringtraceId () const
 
NamedCountergetObjCounter () const
 
NamedCountersetObjCounter (NamedCounter *counter)
 
- Public Member Functions inherited from MGCPEndpointId
 MGCPEndpointId ()
 
 MGCPEndpointId (const String &src)
 
 MGCPEndpointId (const MGCPEndpointId &value)
 
 MGCPEndpointId (const char *endpoint, const char *host, int port, bool addPort=true)
 
const Stringid () const
 
const Stringuser () const
 
const Stringhost () const
 
int port () const
 
void port (int newPort, bool addPort=true)
 
void set (const char *endpoint, const char *host, int port, bool addPort=true)
 
void set (const String &src)
 
bool valid () const
 
- Public Member Functions inherited from Mutex
 Mutex (bool recursive=false, const char *name=0)
 
 Mutex (const Mutex &original)
 
 ~Mutex ()
 
Mutexoperator= (const Mutex &original)
 
virtual bool lock (long maxwait=-1)
 
virtual bool unlock ()
 
virtual bool locked () const
 
const char * owner () const
 
bool recursive () const
 
- Public Member Functions inherited from Lockable
virtual ~Lockable ()
 
virtual bool check (long maxwait=-1)
 
virtual bool unlockAll ()
 

Additional Inherited Members

- Static Public Member Functions inherited from RefObject
static bool alive (const RefObject *obj)
 
static bool efficientIncDec ()
 
- Static Public Member Functions inherited from GenObject
static void * getObject (const String &name, const GenObject *obj)
 
static bool getObjCounting ()
 
static void setObjCounting (bool enable)
 
static NamedCountergetObjCounter (const String &name, bool create=true)
 
static ObjListgetObjCounters ()
 
- Static Public Member Functions inherited from Mutex
static int count ()
 
static int locks ()
 
static bool efficientTimedLock ()
 
- Static Public Member Functions inherited from Lockable
static void wait (unsigned long maxwait)
 
static unsigned long wait ()
 
static void startUsingNow ()
 
static void enableSafety (bool safe=true)
 
static bool safety ()
 
- Protected Member Functions inherited from RefObject
virtual void zeroRefs ()
 
bool resurrect ()
 
virtual void destroyed ()
 

Detailed Description

An MGCP endpoint.

This class holds a local MGCP endpoint (either gateway or call agent) along with its remote peer(s). If the engine owning this endpoint is an MGCP gateway, only 1 remote peer (Call Agent) is allowed

Constructor & Destructor Documentation

◆ MGCPEndpoint()

MGCPEndpoint ( MGCPEngine * engine,
const char * user,
const char * host,
int port,
bool addPort = true )

Constructor. Construct this endpoint. Append itself to the engine's list. The endpoint's id will be created from the received user and engine's address

Parameters
engineThe engine owning this endpoint
userThe user part of the endpoint's id
hostThe host part of the endpoint's id
portThe port part of the endpoint's id
addPortAdd :port at end of id only if port is not zero

References engine(), MGCPEndpointId::host(), MGCPEndpointId::port(), and MGCPEndpointId::user().

◆ ~MGCPEndpoint()

virtual ~MGCPEndpoint ( )
virtual

Destructor. Remove itself from engine's list

Member Function Documentation

◆ append()

MGCPEpInfo * append ( const char * endpoint,
const char * host,
int port = 0 )

Append info about a remote endpoint controlled by or controlling this endpoint. If the engine owning this endpoint is an MGCP gateway, only 1 remote peer (Call Agent) is allowed

Parameters
endpointThe endpoint part of the remote endpoint's id
hostThe IP address of the remote endpoint
portThe port used to send data to this endpoint. Set to 0 to set it to the default port defined by the protocol and the opposite of the engine's mode A value of -1 uses the default but doesn't add :port at end of ID Other negative values use specified port but don't add :port at end
Returns
Valid MGCPEpInfo pointer or 0 if the data wasn't added

References MGCPEndpointId::host(), and MGCPEndpointId::port().

◆ clear()

void clear ( )
inline

Clear the list or remote endpoints

References Mutex::lock(), and Mutex::unlock().

◆ engine()

MGCPEngine * engine ( )
inline

Get the engine owning this endpoint

Returns
The engine owning this endpoint

Referenced by MGCPEndpoint().

◆ find()

MGCPEpInfo * find ( const String & epId)

Find the info object associated with a remote peer

Parameters
epIdThe remote endpoint's id to find
Returns
MGCPEpInfo pointer or 0 if not found

◆ findAlias()

MGCPEpInfo * findAlias ( const String & alias)

Find an info object by remote peer alias

Parameters
aliasAlias of the remote endpoint's id to find
Returns
MGCPEpInfo pointer or 0 if not found

◆ peer()

MGCPEpInfo * peer ( )

Find the info object associated with an unique remote peer

Returns
MGCPEpInfo pointer or 0 if not exactly one peer

◆ toString()

virtual const String & toString ( ) const
inlinevirtual

Get a string representation of this endpoint

Returns
A string representation of this endpoint

Reimplemented from GenObject.

References MGCPEndpointId::id().


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