|
Yate
|
An MGCP transaction. More...
#include <yatemgcp.h>
Public Types | |
| enum | State { Invalid = 0 , Initiated = 1 , Trying = 2 , Responded = 3 , Ack = 4 , Destroying = 5 } |
Public Member Functions | |
| MGCPTransaction (MGCPEngine *engine, MGCPMessage *msg, bool outgoing, const SocketAddr &address, bool engineProcess=true) | |
| virtual | ~MGCPTransaction () |
| State | state () const |
| unsigned int | id () const |
| bool | outgoing () const |
| const String & | ep () const |
| const SocketAddr & | addr () const |
| MGCPEngine * | engine () |
| const MGCPMessage * | initial () const |
| const MGCPMessage * | msgProvisional () const |
| const MGCPMessage * | msgResponse () const |
| const MGCPMessage * | msgAck () const |
| bool | timeout () const |
| void | ackRequest (bool request) |
| void * | userData () const |
| void | userData (void *data) |
| void | setEngineProcess () |
| MGCPEvent * | getEvent (u_int64_t time=Time()) |
| bool | sendProvisional (int code=100, const char *comment=0) |
| bool | setResponse (int code, const char *comment=0) |
| bool | setResponse (int code, const NamedList *params, MimeSdpBody *sdp1=0, MimeSdpBody *sdp2=0) |
| bool | setResponse (MGCPMessage *msg) |
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 String & | toString () const |
| virtual const String & | traceId () const |
| NamedCounter * | getObjCounter () const |
| NamedCounter * | setObjCounter (NamedCounter *counter) |
Public Member Functions inherited from Mutex | |
| Mutex (bool recursive=false, const char *name=0) | |
| Mutex (const Mutex &original) | |
| ~Mutex () | |
| Mutex & | operator= (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 () |
Protected Member Functions | |
| virtual void | destroyed () |
| void | processMessage (MGCPMessage *msg) |
| MGCPEvent * | checkTimeout (u_int64_t time) |
| void | eventTerminated (MGCPEvent *event) |
| void | changeState (State newState) |
| void | setProvisional (int code=100) |
| void | send (MGCPMessage *msg) |
Protected Member Functions inherited from RefObject | |
| virtual void | zeroRefs () |
| bool | resurrect () |
Friends | |
| class | MGCPEngine |
| class | MGCPEvent |
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 NamedCounter * | getObjCounter (const String &name, bool create=true) |
| static ObjList & | getObjCounters () |
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 () |
An MGCP transaction.
This class implements an MGCP transaction
| enum State |
Transaction state enumeration
| MGCPTransaction | ( | MGCPEngine * | engine, |
| MGCPMessage * | msg, | ||
| bool | outgoing, | ||
| const SocketAddr & | address, | ||
| bool | engineProcess = true ) |
Constructor. Construct a transaction from its first message
| engine | The engine owning this transaction |
| msg | The command creating this transaction |
| outgoing | The direction of this transaction |
| address | Remote enpoint's address |
| engineProcess | Use engine processor thread for this transaction |
References engine(), and outgoing().
Referenced by send().
|
virtual |
Destructor
|
inline |
Set the remote ACK request flag
| request | False if remote is not required to send an ACK |
|
inline |
Get the remote endpoint's IP address
|
protected |
Change transaction's state if the new state is a valid one
| newState | The new state of this transaction |
|
protected |
Check timeouts. Manage retransmissions
| time | Current time in milliseconds |
|
protectedvirtual |
Gracefully terminate this transaction. Release memory
Reimplemented from RefObject.
|
inline |
Get the engine owning this transaction
Referenced by MGCPTransaction().
|
inline |
Get the id of the endpoint owning this transaction
|
protected |
Event termination notification
| event | The notifier |
Get an event from this transaction. Check timeouts
| time | Current time in microseconds |
|
inline |
Get the id of this transaction
|
inline |
Get the initial command message sent or received by this transaction
|
inline |
Get the response aknowledgement message sent or received by this transaction
|
inline |
Get the provisional response message sent or received by this transaction
|
inline |
Get the final response message sent or received by this transaction
|
inline |
Get the direction of this transaction
Referenced by MGCPTransaction().
|
protected |
Consume (process) a received message, other then the initiating one
| msg | The received message |
|
protected |
(Re)send one the initial, provisional or final response. Change transaction's state
| msg | The message to send |
References MGCPTransaction().
| bool sendProvisional | ( | int | code = 100, |
| const char * | comment = 0 ) |
Explicitely transmits a provisional code
| code | Provisional response code to send, must be in range 100-199 |
| comment | Optional response comment text |
|
inline |
Set the engine process flag. Allow the engine to process this transaction (call getEvent() from engine process thread)
|
protected |
Set and send the provisional response (codes between 100 and 199)
| code | The response code |
|
inline |
Creates and transmits a final response (code must at least 200) message if this is an incoming transaction
| code | Response code to send |
| comment | Optional response comment text |
References setResponse().
Referenced by setResponse().
| bool setResponse | ( | int | code, |
| const NamedList * | params, | ||
| MimeSdpBody * | sdp1 = 0, | ||
| MimeSdpBody * | sdp2 = 0 ) |
Creates and transmits a final response (code must at least 200) message if this is an incoming transaction. The SDP(s) will be consumed (appended to the message or destroyed)
| code | Response code to send |
| params | Parameters to set in response, name will be set as comment |
| sdp1 | Optional SDP to be added to the response |
| sdp2 | Optional second SDP to be added to the response if the first one is not 0 |
| bool setResponse | ( | MGCPMessage * | msg | ) |
Transmits a final response (code must at least 200) message if this is an incoming transaction
| msg | The message to transmit |
|
inline |
Get the current transaction's state
|
inline |
Check if this transaction timed out
|
inline |
Get the private user data of this transaction
|
inline |
Set the private user data of this transaction
| data | The new private user data of this transaction |