class SIPTransaction

A class holding one SIP transaction. More...

Full nameTelEngine::SIPTransaction
Definition#include <libs/ysip/yatesip.h>
InheritsTelEngine::RefObject [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Types

Public Methods

Public Static Methods

Protected Methods

Protected Members


Detailed Description

All informaton related to a SIP transaction, starting with 1st message

enum State { Invalid, Initial, Trying, Process, Retrans, Finish, Cleared }

State

Current state of the transaction

enum Processed { NoMatch, NoDialog, Matched }

Processed

Possible return values from processMessage()

 SIPTransaction (SIPMessage* message, SIPEngine* engine, bool outgoing = true)

SIPTransaction

Constructor from first message

Parameters:
messageA pointer to the initial message, should not be used afterwards as the transaction takes ownership
engineA pointer to the SIP engine this transaction belongs
outgoingTrue if this transaction is for an outgoing request

 SIPTransaction (const SIPTransaction& original, const String& tag)

SIPTransaction

Copy constructor to be used with forked INVITEs

Parameters:
originalOriginal transaction that is to be copied
tagDialog tag for the new transaction

 ~SIPTransaction ()

~SIPTransaction

[virtual]

Destructor - clears all held objects

const char*  stateName (int state)

stateName

[static]

Get the name of a transaction state

inline int  getState ()

getState

[const]

The current state of the transaction

Returns: The current state as one of the State enums

inline bool  isActive ()

isActive

[const]

Check if the transaction is active for the upper layer

Returns: True if the transaction is active, false if it finished

inline const SIPMessage*  initialMessage ()

initialMessage

[const]

The first message that created this transaction

inline const SIPMessage*  latestMessage ()

latestMessage

[const]

The last message (re)sent by this transaction

inline const SIPMessage*  recentMessage ()

recentMessage

[const]

The most recent message handled by this transaction

inline SIPEngine*  getEngine ()

getEngine

[const]

The SIPEngine this transaction belongs to

inline bool  isOutgoing ()

isOutgoing

[const]

Check if this transaction was initiated by the remote peer or locally

Returns: True if the transaction was created by an outgoing message

inline bool  isIncoming ()

isIncoming

[const]

Check if this transaction was initiated locally or by the remote peer

Returns: True if the transaction was created by an incoming message

inline bool  isInvite ()

isInvite

[const]

Check if this transaction is an INVITE transaction or not

Returns: True if the transaction is an INVITE

inline bool  isReliable ()

isReliable

[const]

Check if this transaction is handled by a reliable protocol

Returns: True if a reliable protocol (TCP, SCTP) is used

inline const String&  getMethod ()

getMethod

[const]

The SIP method this transaction handles

inline const String&  getURI ()

getURI

[const]

The SIP URI this transaction handles

inline const String&  getBranch ()

getBranch

[const]

The Via branch that may uniquely identify this transaction

Returns: The branch parameter taken from the Via header

inline const String&  getCallID ()

getCallID

[const]

The call ID may identify this transaction

Returns: The Call-ID parameter taken from the message

inline const String&  getDialogTag ()

getDialogTag

[const]

The dialog tag that may identify this transaction

Returns: The dialog tag parameter

void  setDialogTag (const char* tag = 0)

setDialogTag

Set a new dialog tag, optionally build a random one

Parameters:
tagNew dialog tag, a null string will build a random tag

inline void  setTransmit ()

setTransmit

Set the (re)transmission flag that allows the latest outgoing message to be send over the wire

void  requestAuth (const String& realm, const String& domain, bool stale, bool proxy = false)

requestAuth

Send back an authentication required response

Parameters:
realmAuthentication realm to send in the answer
domainDomain for which it will authenticate
staleTrue if the previous password is valid but nonce is too old
proxyTrue to authenticate as proxy, false as user agent

int  authUser (String& user, bool proxy = false, GenObject* userData = 0)

authUser

Detect the proper credentials for any user in the engine

Parameters:
userString to store the authenticated user name or user to look for (if not null on entry)
proxyTrue to authenticate as proxy, false as user agent
userDataPointer to an optional object that is passed back to SIPEngine::checkUser

Returns: Age of the nonce if user matches, negative for a failure

Processed  processMessage (SIPMessage* message, const String& branch)

processMessage

[virtual]

Check if a message belongs to this transaction and process it if so

Parameters:
messageA pointer to the message to check, should not be used afterwards if this method returned Matched
branchThe branch parameter extracted from first Via header

Returns: Matched if the message was handled by this transaction, in which case it takes ownership over the message

void  processMessage (SIPMessage* message)

processMessage

[virtual]

Process a message belonging to this transaction

Parameters:
messageA pointer to the message to process, the caller must make sure it belongs to this transaction

SIPEvent*  getEvent (bool pendingOnly = false)

getEvent

[virtual]

Get an event for this transaction if any is available. It provides default handling for invalid states, otherwise calls the more specific protected version. You may override this method if you need processing of invalid states.

Parameters:
pendingOnlyTrue to only return outgoing and pending events

Returns: A newly allocated event or NULL if none is needed

bool  setResponse ()

setResponse

[const]

Checks if a response message can be sent

Returns: True if the transaction can send a response message

bool  setResponse (int code, const char* reason = 0)

setResponse

Creates and transmits a final response message

Parameters:
codeResponse code to send
reasonHuman readable reason text (optional)

Returns: True if the message was queued for transmission

void  setResponse (SIPMessage* message)

setResponse

Transmits a final response message

inline int  getResponseCode ()

getResponseCode

[const]

Retrieve the latest response code

Returns: Code of most recent response, zero if none is known

inline void  setUserData (void* data)

setUserData

Set an arbitrary pointer as user specific data

inline void*  getUserData ()

getUserData

[const]

Return the opaque user data

 SIPTransaction (SIPTransaction& original, SIPMessage* answer)

SIPTransaction

[protected]

Constructor from previous auto authenticated transaction. This is used only internally

Parameters:
originalOriginal transaction that failed authentication
answerSIP answer that creates the new transaction

void  destroyed ()

destroyed

[protected virtual]

Pre-destruction notification used to clean up the transaction

Reimplemented from RefObject.

bool  tryAutoAuth (SIPMessage* answer)

tryAutoAuth

[protected]

Attempt to perform automatic client transaction authentication

Parameters:
answerSIP answer that creates the new transaction

Returns: True if current client processing must be abandoned

SIPEvent*  getClientEvent (int state, int timeout)

getClientEvent

[protected virtual]

Get an event only for client transactions

Parameters:
stateThe current state of the transaction
timeoutIf timeout occured, number of remaining timeouts, otherwise -1

Returns: A newly allocated event or NULL if none is needed

SIPEvent*  getServerEvent (int state, int timeout)

getServerEvent

[protected virtual]

Get an event only for server transactions.

Parameters:
stateThe current state of the transaction
timeoutIf timeout occured, number of remaining timeouts, otherwise -1

Returns: A newly allocated event or NULL if none is needed

void  processClientMessage (SIPMessage* message, int state)

processClientMessage

[protected virtual]

Process only the messages for client transactions

Parameters:
messageA pointer to the message to process, should not be used afterwards if this method returned True
stateThe current state of the transaction

void  processServerMessage (SIPMessage* message, int state)

processServerMessage

[protected virtual]

Process only the messages for server transactions

Parameters:
messageA pointer to the message to process, should not be used afterwards if this method returned True
stateThe current state of the transaction

bool  changeState (int newstate)

changeState

[protected]

Change the transaction state

Parameters:
newstateThe desired new state

Returns: True if state change occured

void  setLatestMessage (SIPMessage* message = 0)

setLatestMessage

[protected]

Set the latest message sent by this transaction

Parameters:
messagePointer to the latest message

void  setPendingEvent (SIPEvent* event = 0, bool replace = false)

setPendingEvent

[protected]

Store a pending event to be picked up at the next getEvent() call

Parameters:
eventEvent to store
replaceTrue to replace any existing pending event

inline bool  isPendingEvent ()

isPendingEvent

[protected const]

Check if there is a pending event waiting

Returns: True is there is a pending event

void  setTimeout (u_int64_t delay = 0, unsigned int count = 1)

setTimeout

[protected]

Set a repetitive timeout

Parameters:
delayHow often (in microseconds) to fire the timeout
countHow many times to keep firing the timeout

bool m_outgoing

m_outgoing

[protected]

bool m_invite

m_invite

[protected]

bool m_transmit

m_transmit

[protected]

int m_state

m_state

[protected]

int m_response

m_response

[protected]

unsigned int m_timeouts

m_timeouts

[protected]

u_int64_t m_delay

m_delay

[protected]

u_int64_t m_timeout

m_timeout

[protected]

SIPMessage* m_firstMessage

m_firstMessage

[protected]

SIPMessage* m_lastMessage

m_lastMessage

[protected]

SIPEvent* m_pending

m_pending

[protected]

SIPEngine* m_engine

m_engine

[protected]

String m_branch

m_branch

[protected]

String m_callid

m_callid

[protected]

String m_tag

m_tag

[protected]

void * m_private

m_private

[protected]


Generated by: paulc on bussard on Fri Apr 1 18:17:10 2011, using kdoc 2.0a54.