29#ifdef LIBYMGCP_EXPORTS
30#define YMGCP_API __declspec(dllexport)
32#ifndef LIBYMGCP_STATIC
33#define YMGCP_API __declspec(dllimport)
62 friend class MGCPTransaction;
117 {
return m_version; }
124 {
return m_comment; }
131 {
return code() < 0; }
138 {
return 100 <=
code(); }
145 {
return 0 <=
code() &&
code() <= 99; }
152 {
return m_transaction; }
159 {
return m_endpoint; }
181 const unsigned char* buffer,
unsigned int len,
182 const char* sdpType =
"application/sdp");
206 unsigned int transId,
const char* epId,
const char* ver);
211 static MGCPMessage* decodeMessage(
const char* line,
unsigned int len,
unsigned int& trans,
214 static bool decodeParams(
const unsigned char* buffer,
unsigned int len,
220 unsigned int m_transaction;
232 friend class MGCPEngine;
233 friend class MGCPEvent;
256 const SocketAddr& address,
bool engineProcess =
true);
274 inline unsigned int id()
const
282 {
return m_outgoing; }
289 {
return m_endpoint; }
296 {
return m_address; }
317 {
return m_provisional; }
324 {
return m_response; }
338 {
return m_timeout; }
345 { m_ackRequest = request; }
352 {
return m_private; }
359 { m_private = data; }
366 { m_engineProcess =
true; }
404 MimeSdpBody* sdp2 = 0);
461 MGCPEvent* checkResponse(u_int64_t time);
463 void initTimeout(u_int64_t time,
bool extra);
478 u_int64_t m_nextRetrans;
479 unsigned int m_crtRetransInterval;
480 unsigned int m_retransCount;
485 bool m_engineProcess;
515 : m_id(value.
id()), m_endpoint(value.
user()),
516 m_host(value.
host()), m_port(value.
port())
542 {
return m_endpoint; }
563 inline void port(
int newPort,
bool addPort =
true)
564 {
set(m_endpoint,m_host,newPort,addPort); }
573 void set(
const char* endpoint,
const char*
host,
int port,
bool addPort =
true);
591 return m_endpoint && m_endpoint.length() < 256 &&
592 m_host && m_host.length() < 256;
618 m_address(AF_INET), m_resolve(true) {
619 m_address.port(
port);
634 {
return m_address; }
647 { m_resolve =
false; m_address = addr; }
750 friend class MGCPTransaction;
762 {
return m_transaction; }
769 {
return m_message; }
780 MGCPTransaction* m_transaction;
784class MGCPPrivateThread;
797 friend class MGCPPrivateThread;
798 friend class MGCPTransaction;
820 {
return m_gateway; }
827 {
return m_address; }
835 {
return m_maxRecvPacket; }
842 {
return m_allowUnkCmd; }
849 {
return m_retransInterval; }
856 {
return m_retransCount; }
863 {
return m_extraTime; }
870 {
return m_parseParamToLower; }
877 {
return m_provisional; }
884 {
return m_ackRequest; }
891 { m_ackRequest = request; }
905 {
Lock lock(
this);
return (m_knownCommands.find(cmd) != 0); }
948 MGCPTransaction*
findTrans(
unsigned int id,
bool outgoing);
966 bool engineProcess =
true);
1058 void cleanup(
bool gracefully =
true,
const char* text =
"Shutdown");
1067 {
return gateway ? 2427 : 2727; }
1134 void appendThread(MGCPPrivateThread* thread);
1136 void removeThread(MGCPPrivateThread* thread);
1139 unsigned int* decodeAck(
const String& param,
unsigned int &
count);
1143 unsigned int m_nextId;
1146 unsigned int m_maxRecvPacket;
1147 unsigned char* m_recvBuf;
1149 unsigned int m_retransInterval;
1150 unsigned int m_retransCount;
1151 u_int64_t m_extraTime;
1152 bool m_parseParamToLower;
DebugEnabler(int level=TelEngine::debugLevel(), bool enabled=true)
Definition yateclass.h:319
Class used to iterate the items of a list.
Definition yateclass.h:3828
Ephemeral mutex or semaphore locking object.
Definition yateclass.h:5833
int port() const
Definition yatemgcp.h:555
MGCPEndpointId()
Definition yatemgcp.h:498
bool valid() const
Definition yatemgcp.h:590
const String & id() const
Definition yatemgcp.h:534
void set(const char *endpoint, const char *host, int port, bool addPort=true)
const String & host() const
Definition yatemgcp.h:548
void set(const String &src)
Definition yatemgcp.h:579
void port(int newPort, bool addPort=true)
Definition yatemgcp.h:563
MGCPEndpointId(const String &src)
Definition yatemgcp.h:506
const String & user() const
Definition yatemgcp.h:541
MGCPEndpointId(const MGCPEndpointId &value)
Definition yatemgcp.h:514
MGCPEndpointId(const char *endpoint, const char *host, int port, bool addPort=true)
Definition yatemgcp.h:526
An MGCP endpoint.
Definition yatemgcp.h:666
MGCPEndpoint(MGCPEngine *engine, const char *user, const char *host, int port, bool addPort=true)
MGCPEpInfo * findAlias(const String &alias)
MGCPEpInfo * find(const String &epId)
virtual const String & toString() const
Definition yatemgcp.h:688
MGCPEpInfo * append(const char *endpoint, const char *host, int port=0)
void clear()
Definition yatemgcp.h:715
MGCPEngine * engine()
Definition yatemgcp.h:695
An MGCP engine.
Definition yatemgcp.h:796
void addCommand(const char *cmd)
MGCPEndpoint * findEp(const String &epId)
MGCPEvent * getEvent(u_int64_t time=Time())
bool ackRequest() const
Definition yatemgcp.h:883
bool sendData(const String &msg, const SocketAddr &address)
bool allowUnkCmd() const
Definition yatemgcp.h:841
MGCPEndpoint * findEp(MGCPEndpoint *ep)
void attach(MGCPEndpoint *ep)
static TokenDict mgcp_commands[]
Definition yatemgcp.h:1079
void ackRequest(bool request)
Definition yatemgcp.h:890
static TokenDict mgcp_reasons[]
Definition yatemgcp.h:1093
ObjList m_transactions
Definition yatemgcp.h:1125
void appendTrans(MGCPTransaction *trans)
unsigned int retransCount() const
Definition yatemgcp.h:855
ObjList m_endpoints
Definition yatemgcp.h:1120
virtual bool processEvent(MGCPEvent *event)
bool provisional() const
Definition yatemgcp.h:876
bool receive(unsigned char *buffer, SocketAddr &addr)
virtual bool processEvent(MGCPTransaction *trans, MGCPMessage *msg)
unsigned int retransInterval() const
Definition yatemgcp.h:848
bool knownCommand(const String &cmd)
Definition yatemgcp.h:904
const SocketAddr & address() const
Definition yatemgcp.h:826
ListIterator m_iterator
Definition yatemgcp.h:1130
u_int64_t extraTime() const
Definition yatemgcp.h:862
void detach(MGCPEndpoint *ep, bool del=false, bool delTrans=false)
static TokenDict mgcp_responses[]
Definition yatemgcp.h:1084
bool gateway() const
Definition yatemgcp.h:819
MGCPTransaction * sendCommand(MGCPMessage *cmd, const SocketAddr &address, bool engineProcess=true)
void removeTrans(MGCPTransaction *trans, bool del)
MGCPEngine(bool gateway, const char *name=0, const NamedList *params=0)
void cleanup(bool gracefully=true, const char *text="Shutdown")
virtual void timeout(MGCPTransaction *tr)
Definition yatemgcp.h:1073
bool parseParamToLower() const
Definition yatemgcp.h:869
static int defaultPort(bool gateway)
Definition yatemgcp.h:1066
virtual void initialize(const NamedList ¶ms)
bool process(u_int64_t time=Time())
unsigned int maxRecvPacket() const
Definition yatemgcp.h:834
MGCPTransaction * findTrans(unsigned int id, bool outgoing)
bool processTransaction(MGCPTransaction *tr, u_int64_t time=Time())
void returnEvent(MGCPEvent *event)
void runReceive(SocketAddr &addr)
Remote endpoint info class.
Definition yatemgcp.h:607
const SocketAddr & address()
MGCPEpInfo(const char *endpoint, const char *host, int port, bool addPort=true)
Definition yatemgcp.h:616
const SocketAddr & address() const
Definition yatemgcp.h:633
virtual const String & toString() const
Definition yatemgcp.h:626
void address(const SocketAddr &addr)
Definition yatemgcp.h:646
String alias
Definition yatemgcp.h:652
An MGCP event.
Definition yatemgcp.h:749
MGCPTransaction * transaction()
Definition yatemgcp.h:761
MGCPEvent(MGCPTransaction *trans, MGCPMessage *msg=0)
MGCPMessage * message() const
Definition yatemgcp.h:768
An MGCP command or response.
Definition yatemgcp.h:61
MGCPMessage(MGCPTransaction *trans, unsigned int code, const char *comment=0)
bool isAck() const
Definition yatemgcp.h:144
MGCPMessage(MGCPEngine *engine, const char *name, const char *ep, const char *ver="MGCP 1.0")
void toString(String &dest) const
const String & comment() const
Definition yatemgcp.h:123
bool valid() const
Definition yatemgcp.h:95
int code() const
Definition yatemgcp.h:109
unsigned int transactionId() const
Definition yatemgcp.h:151
ObjList sdp
Definition yatemgcp.h:192
NamedList params
Definition yatemgcp.h:187
static bool parse(MGCPEngine *engine, ObjList &dest, const unsigned char *buffer, unsigned int len, const char *sdpType="application/sdp")
bool isCommand() const
Definition yatemgcp.h:130
MGCPMessage(MGCPEngine *engine, const char *name, int code, unsigned int transId, const char *epId, const char *ver)
const String & name() const
Definition yatemgcp.h:102
bool isResponse() const
Definition yatemgcp.h:137
const String & version() const
Definition yatemgcp.h:116
const String & endpointId() const
Definition yatemgcp.h:158
void eventTerminated(MGCPEvent *event)
MGCPEvent * getEvent(u_int64_t time=Time())
void changeState(State newState)
bool setResponse(int code, const char *comment=0)
Definition yatemgcp.h:390
void ackRequest(bool request)
Definition yatemgcp.h:344
void processMessage(MGCPMessage *msg)
bool setResponse(int code, const NamedList *params, MimeSdpBody *sdp1=0, MimeSdpBody *sdp2=0)
State
Definition yatemgcp.h:238
const MGCPMessage * msgAck() const
Definition yatemgcp.h:330
const MGCPMessage * msgResponse() const
Definition yatemgcp.h:323
const SocketAddr & addr() const
Definition yatemgcp.h:295
void * userData() const
Definition yatemgcp.h:351
void userData(void *data)
Definition yatemgcp.h:358
MGCPTransaction(MGCPEngine *engine, MGCPMessage *msg, bool outgoing, const SocketAddr &address, bool engineProcess=true)
const MGCPMessage * msgProvisional() const
Definition yatemgcp.h:316
const MGCPMessage * initial() const
Definition yatemgcp.h:309
void send(MGCPMessage *msg)
void setEngineProcess()
Definition yatemgcp.h:365
const String & ep() const
Definition yatemgcp.h:288
virtual ~MGCPTransaction()
bool timeout() const
Definition yatemgcp.h:337
bool sendProvisional(int code=100, const char *comment=0)
MGCPEngine * engine()
Definition yatemgcp.h:302
State state() const
Definition yatemgcp.h:267
void setProvisional(int code=100)
bool setResponse(MGCPMessage *msg)
MGCPEvent * checkTimeout(u_int64_t time)
unsigned int id() const
Definition yatemgcp.h:274
bool outgoing() const
Definition yatemgcp.h:281
Mutex(bool recursive=false, const char *name=0)
virtual bool lock(long maxwait=-1)
A named string container class.
Definition yateclass.h:5016
An object list class.
Definition yateclass.h:1454
A socket address holder.
Definition yateclass.h:6400
A generic socket class.
Definition yateclass.h:7361
A C-style string handling class.
Definition yateclass.h:2131
A time holding class.
Definition yateclass.h:3927
Encapsulation for an URI.
Definition yateclass.h:5396
const String & getUser() const
Definition yateclass.h:5475
int getPort() const
Definition yateclass.h:5489
const String & getHost() const
Definition yateclass.h:5482
Definition yateclass.h:848