|
|
This class implements an MGCP transaction
enum State { Invalid = 0, Initiated = 1, Trying = 2, Responded = 3, Ack = 4, Destroying = 5, } | State |
Transaction state enumeration
MGCPTransaction (MGCPEngine* engine, MGCPMessage* msg, bool outgoing,
const SocketAddr& address)
| MGCPTransaction |
Constructor. Construct a transaction from its first message
Parameters:
engine | The engine owning this transaction |
msg | The command creating this transaction |
outgoing | The direction of this transaction |
address | Remote enpoint's address |
~MGCPTransaction ()
| ~MGCPTransaction |
[virtual]
Destructor
inline State state ()
| state |
[const]
Get the current transaction's state
Returns: The transaction state as enumeration
inline unsigned int id ()
| id |
[const]
Get the id of this transaction
Returns: The id of this transaction
inline bool outgoing ()
| outgoing |
[const]
Get the direction of this transaction
Returns: True if this is an outgoing transaction
inline const String& ep ()
| ep |
[const]
Get the id of the endpoint owning this transaction
Returns: The id of the endpoint owning this transaction
const SocketAddr& addr ()
| addr |
[const]
Get the remote endpoint's IP address
Returns: The remote endpoint's IP address
inline MGCPEngine* engine ()
| engine |
Get the engine owning this transaction
Returns: The engine owning this transaction
inline const MGCPMessage* initial ()
| initial |
[const]
Get the initial command message sent or received by this transaction
Returns: The transaction's initial message
inline const MGCPMessage* msgProvisional ()
| msgProvisional |
[const]
Get the provisional response message sent or received by this transaction
Returns: The transaction's provisional response message
inline const MGCPMessage* msgResponse ()
| msgResponse |
[const]
Get the final response message sent or received by this transaction
Returns: The transaction's final response message
inline const MGCPMessage* msgAck ()
| msgAck |
[const]
Get the response aknowledgement message sent or received by this transaction
Returns: The transaction's response aknowledgement message
inline bool timeout ()
| timeout |
[const]
Check if this transaction timed out
Returns: True if this transaction timed out
inline void ackRequest (bool request)
| ackRequest |
Set the remote ACK request flag
Parameters:
request | False if remote is not required to send an ACK |
inline void* userData ()
| userData |
[const]
Get the private user data of this transaction
Returns: The private user data of this transaction
inline void userData (void* data)
| userData |
Set the private user data of this transaction
Parameters:
data | The new private user data of this transaction |
MGCPEvent* getEvent (u_int64_t time = Time())
| getEvent |
Get an event from this transaction. Check timeouts
Parameters:
time | Current time in microseconds |
Returns: MGCPEvent pointer or 0 if none
bool sendProvisional (int code = 100, const char* comment = 0)
| sendProvisional |
Explicitely transmits a provisional code
Parameters:
code | Provisional response code to send, must be in range 100-199 |
comment | Optional response comment text |
Returns: True if the provisional response was sent
inline bool setResponse (int code, const char* comment = 0)
| setResponse |
Creates and transmits a final response (code must at least 200) message if this is an incoming transaction
Parameters:
code | Response code to send |
comment | Optional response comment text |
Returns: True if the message was queued for transmission
bool setResponse (int code, const NamedList* params, MimeSdpBody* sdp1 = 0,
MimeSdpBody* sdp2 = 0)
| setResponse |
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)
Parameters:
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 |
Returns: True if the message was queued for transmission
bool setResponse (MGCPMessage* msg)
| setResponse |
Transmits a final response (code must at least 200) message if this is an incoming transaction
Parameters:
msg | The message to transmit |
Returns: True if the message was queued for transmission
void destroyed ()
| destroyed |
[protected virtual]
Gracefully terminate this transaction. Release memory
Reimplemented from RefObject.
void processMessage (MGCPMessage* msg)
| processMessage |
[protected]
Consume (process) a received message, other then the initiating one
Parameters:
msg | The received message |
MGCPEvent* checkTimeout (u_int64_t time)
| checkTimeout |
[protected]
Check timeouts. Manage retransmissions
Parameters:
time | Current time in milliseconds |
Returns: MGCPEvent pointer if timeout
void eventTerminated (MGCPEvent* event)
| eventTerminated |
[protected]
Event termination notification
Parameters:
event | The notifier |
void changeState (State newState)
| changeState |
[protected]
Change transaction's state if the new state is a valid one
Parameters:
newState | The new state of this transaction |
void setProvisional (int code = 100)
| setProvisional |
[protected]
Set and send the provisional response (codes between 100 and 199)
Parameters:
code | The response code |
void send (MGCPMessage* msg)
| send |
[protected]
(Re)send one the initial, provisional or final response. Change transaction's state
Parameters:
msg | The message to send |
Generated by: paulc on bussard on Wed Oct 21 01:57:30 2009, using kdoc 2.0a54. |