class MGCPTransaction

An MGCP transaction. More...

Full nameTelEngine::MGCPTransaction
Definition#include <libs/ymgcp/yatemgcp.h>
InheritsTelEngine::Mutex [public ], TelEngine::RefObject [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Types

Public Methods

Protected Methods


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:
engineThe engine owning this transaction
msgThe command creating this transaction
outgoingThe direction of this transaction
addressRemote enpoint's address
engineProcessUse 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:
requestFalse 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:
dataThe 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:
timeCurrent 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:
codeProvisional response code to send, must be in range 100-199
commentOptional 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:
codeResponse code to send
commentOptional 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:
codeResponse code to send
paramsParameters to set in response, name will be set as comment
sdp1Optional SDP to be added to the response
sdp2Optional 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:
msgThe 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:
msgThe received message

MGCPEvent*  checkTimeout (u_int64_t time)

checkTimeout

[protected]

Check timeouts. Manage retransmissions

Parameters:
timeCurrent time in milliseconds

Returns: MGCPEvent pointer if timeout

void  eventTerminated (MGCPEvent* event)

eventTerminated

[protected]

Event termination notification

Parameters:
eventThe notifier

void  changeState (State newState)

changeState

[protected]

Change transaction's state if the new state is a valid one

Parameters:
newStateThe new state of this transaction

void  setProvisional (int code = 100)

setProvisional

[protected]

Set and send the provisional response (codes between 100 and 199)

Parameters:
codeThe response code

void  send (MGCPMessage* msg)

send

[protected]

(Re)send one the initial, provisional or final response. Change transaction's state

Parameters:
msgThe message to send


Generated by: paulc on bussard on Mon Feb 10 13:15:47 2014, using kdoc 2.0a54.