# class MGCPTransaction | An MGCP transaction. More...
Full name | `TelEngine::MGCPTransaction`
Definition | `#include <libs/ymgcp/yatemgcp.h>`
Inherits | TelEngine::Mutex [public ], TelEngine::RefObject [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Types

- enum State { Invalid = 0, Initiated = 1, Trying = 2, Responded = 3, Ack = 4, Destroying = 5, }

#### Public Methods

- MGCPTransaction (MGCPEngine* engine, MGCPMessage* msg, bool outgoing, const SocketAddr& address, bool engineProcess = true)
- virtual ~MGCPTransaction ()
- inline State state () const
- inline unsigned int id () const
- inline bool outgoing () const
- inline const String& ep () const
- const SocketAddr& addr () const
- inline MGCPEngine* engine ()
- inline const MGCPMessage* initial () const
- inline const MGCPMessage* msgProvisional () const
- inline const MGCPMessage* msgResponse () const
- inline const MGCPMessage* msgAck () const
- inline bool timeout () const
- inline void ackRequest (bool request)
- inline void* userData () const
- inline void userData (void* data)
- inline void setEngineProcess ()
- MGCPEvent* getEvent (u_int64_t time = Time())
- bool sendProvisional (int code = 100, const char* comment = 0)
- inline 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)

#### Protected Methods

- 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)

## Detailed Description

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, bool engineProcess = true) | ### 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
engineProcess | Use engine processor thread for this transaction

~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

inline void setEngineProcess () | ### setEngineProcess

Set the engine process flag. Allow the engine to process this transaction (call getEvent() from engine process thread)

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 Mon Feb 10 13:15:47 2014, using kdoc 2.0a54.