|
Yate
|
A class holding one SIP transaction. More...
#include <yatesip.h>
Public Types | |
| enum | State { Invalid , Initial , Trying , Process , Retrans , Finish , Cleared } |
| enum | Processed { NoMatch , NoDialog , Matched } |
Public Member Functions | |
| SIPTransaction (SIPMessage *message, SIPEngine *engine, bool outgoing=true, bool *autoChangeParty=0) | |
| SIPTransaction (const SIPTransaction &original, const String &tag) | |
| virtual | ~SIPTransaction () |
| int | getState () const |
| bool | isActive () const |
| const SIPMessage * | initialMessage () const |
| const SIPMessage * | latestMessage () const |
| const SIPMessage * | recentMessage () const |
| SIPEngine * | getEngine () const |
| bool | isOutgoing () const |
| bool | isIncoming () const |
| bool | isInvite () const |
| bool | isReliable () const |
| const String & | getMethod () const |
| const String & | getURI () const |
| const String & | getBranch () const |
| const String & | getCallID () const |
| const String & | getDialogTag () const |
| void | setDialogTag (const char *tag=0) |
| void | setTransmit () |
| void | setCleared () |
| unsigned int | getTransCount () const |
| void | setTransCount (int count) |
| bool | autoAck () const |
| void | autoAck (bool setAuto) |
| void | requestAuth (const String &realm, const String &domain, bool stale, bool proxy=false) |
| int | authUser (String &user, bool proxy=false, GenObject *userData=0) |
| virtual Processed | processMessage (SIPMessage *message, const String &branch) |
| virtual void | processMessage (SIPMessage *message) |
| virtual SIPEvent * | getEvent (bool pendingOnly=false, u_int64_t time=0) |
| bool | setResponse () const |
| bool | setResponse (int code, const char *reason=0) |
| void | setResponse (SIPMessage *message) |
| int | getResponseCode () const |
| bool | setAcknowledge (MimeBody *ackBody=0) |
| void | msgTransmitFailed (SIPMessage *msg) |
| void | setUserData (void *data) |
| void * | getUserData () const |
| void | setSilent () |
| const String & | traceId () const |
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 |
| NamedCounter * | getObjCounter () const |
| NamedCounter * | setObjCounter (NamedCounter *counter) |
Static Public Member Functions | |
| static const char * | stateName (int state) |
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 () |
Protected Member Functions | |
| SIPTransaction (SIPTransaction &original, SIPMessage *answer) | |
| virtual void | destroyed () |
| bool | tryAutoAuth (SIPMessage *answer) |
| virtual SIPEvent * | getClientEvent (int state, int timeout) |
| virtual SIPEvent * | getServerEvent (int state, int timeout) |
| virtual void | processClientMessage (SIPMessage *message, int state) |
| virtual void | processServerMessage (SIPMessage *message, int state) |
| bool | changeState (int newstate) |
| void | setLatestMessage (SIPMessage *message=0) |
| void | setPendingEvent (SIPEvent *event=0, bool replace=false) |
| bool | isPendingEvent () const |
| void | setTimeout (u_int64_t delay=0, unsigned int count=1) |
Protected Member Functions inherited from RefObject | |
| virtual void | zeroRefs () |
| bool | resurrect () |
Protected Attributes | |
| bool | m_outgoing |
| bool | m_invite |
| bool | m_transmit |
| int | m_state |
| int | m_response |
| unsigned int | m_transCount |
| unsigned int | m_timeouts |
| u_int64_t | m_delay |
| u_int64_t | m_timeout |
| SIPMessage * | m_firstMessage |
| SIPMessage * | m_lastMessage |
| SIPEvent * | m_pending |
| SIPEngine * | m_engine |
| String | m_branch |
| String | m_callid |
| String | m_tag |
| void * | m_private |
| bool | m_autoChangeParty |
| bool | m_autoAck |
| bool | m_silent |
| String | m_traceId |
A class holding one SIP transaction.
All informaton related to a SIP transaction, starting with 1st message
| enum Processed |
Possible return values from processMessage()
| enum State |
Current state of the transaction
| SIPTransaction | ( | SIPMessage * | message, |
| SIPEngine * | engine, | ||
| bool | outgoing = true, | ||
| bool * | autoChangeParty = 0 ) |
Constructor from first message
| message | A pointer to the initial message, should not be used afterwards as the transaction takes ownership |
| engine | A pointer to the SIP engine this transaction belongs |
| outgoing | True if this transaction is for an outgoing request |
| autoChangeParty | Optional pointer to auto change party flag (use engine's flag if missing) |
Referenced by SIPTransaction(), and SIPTransaction().
| SIPTransaction | ( | const SIPTransaction & | original, |
| const String & | tag ) |
Copy constructor to be used with forked INVITEs
| original | Original transaction that is to be copied |
| tag | Dialog tag for the new transaction |
References SIPTransaction().
|
virtual |
Destructor - clears all held objects
|
protected |
Constructor from previous auto authenticated transaction. This is used only internally
| original | Original transaction that failed authentication |
| answer | SIP answer that creates the new transaction |
References SIPTransaction().
Detect the proper credentials for any user in the engine
| user | String to store the authenticated user name or user to look for (if not null on entry) |
| proxy | True to authenticate as proxy, false as user agent |
| userData | Pointer to an optional object that is passed back to checkUser |
References GenObject::GenObject().
|
inline |
Get the automatic UAC 2xx ACK generation flag
|
inline |
Set the automatic UAC 2xx ACK generation flag
| setAuto | True to automatically generate the ACK when receiving a 2xx answer |
|
protected |
Change the transaction state
| newstate | The desired new state |
Referenced by setCleared().
|
protectedvirtual |
Pre-destruction notification used to clean up the transaction
Reimplemented from RefObject.
|
inline |
The Via branch that may uniquely identify this transaction
|
inline |
The call ID may identify this transaction
|
protectedvirtual |
Get an event only for client transactions
| state | The current state of the transaction |
| timeout | If timeout occured, number of remaining timeouts, otherwise -1 |
|
inline |
The dialog tag that may identify this transaction
|
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.
| pendingOnly | True to only return outgoing and pending events |
| time | Time to use in timeouts, zero to use system time |
|
inline |
The SIP method this transaction handles
References String::empty().
|
inline |
Retrieve the latest response code
|
protectedvirtual |
Get an event only for server transactions.
| state | The current state of the transaction |
| timeout | If timeout occured, number of remaining timeouts, otherwise -1 |
|
inline |
The current state of the transaction
|
inline |
Get the transmission attempts count for non-reliable transports
|
inline |
The SIP URI this transaction handles
References String::empty().
|
inline |
Return the opaque user data
|
inline |
The first message that created this transaction
|
inline |
Check if the transaction is active for the upper layer
|
inline |
Check if this transaction was initiated locally or by the remote peer
|
inline |
Check if this transaction is an INVITE transaction or not
|
inline |
Check if this transaction was initiated by the remote peer or locally
|
inlineprotected |
Check if there is a pending event waiting
|
inline |
Check if this transaction is handled by a reliable protocol
|
inline |
The last message (re)sent by this transaction
| void msgTransmitFailed | ( | SIPMessage * | msg | ) |
Message send failure notification
| msg | Failed message |
|
protectedvirtual |
Process only the messages for client transactions
| message | A pointer to the message to process, should not be used afterwards if this method returned True |
| state | The current state of the transaction |
|
virtual |
Process a message belonging to this transaction
| message | A pointer to the message to process, the caller must make sure it belongs to this transaction |
|
virtual |
Check if a message belongs to this transaction and process it if so
| message | A pointer to the message to check, should not be used afterwards if this method returned Matched |
| branch | The branch parameter extracted from first Via header |
|
protectedvirtual |
Process only the messages for server transactions
| message | A pointer to the message to process, should not be used afterwards if this method returned True |
| state | The current state of the transaction |
|
inline |
The most recent message handled by this transaction
Send back an authentication required response
| realm | Authentication realm to send in the answer |
| domain | Domain for which it will authenticate |
| stale | True if the previous password is valid but nonce is too old |
| proxy | True to authenticate as proxy, false as user agent |
| bool setAcknowledge | ( | MimeBody * | ackBody = 0 | ) |
Transmit an ACK message in UAC mode
| ackBody | Optional ACK message body, consumed by the method |
|
inline |
Change transaction status to Cleared This method is not thread safe
References changeState().
| void setDialogTag | ( | const char * | tag = 0 | ) |
Set a new dialog tag, optionally build a random one
| tag | New dialog tag, a null string will build a random tag |
|
protected |
Set the latest message sent by this transaction
| message | Pointer to the latest message |
|
protected |
Store a pending event to be picked up at the next getEvent() call
| event | Event to store |
| replace | True to replace any existing pending event |
| bool setResponse | ( | ) | const |
Checks if a response message can be sent
| bool setResponse | ( | int | code, |
| const char * | reason = 0 ) |
Creates and transmits a final response message
| code | Response code to send |
| reason | Human readable reason text (optional) |
| void setResponse | ( | SIPMessage * | message | ) |
Transmits a final response message
| void setSilent | ( | ) |
Silent this transaction
|
protected |
Set a repetitive timeout
| delay | How often (in microseconds) to fire the timeout |
| count | How many times to keep firing the timeout |
| void setTransCount | ( | int | count | ) |
Set the number of transmission attempts for non-reliable transports
| count | Transmission attempts, clamped between 2 and 10, negative values ignored |
|
inline |
Set the (re)transmission flag that allows the latest outgoing message to be send over the wire
|
inline |
Set an arbitrary pointer as user specific data
|
static |
Get the name of a transaction state
|
inlinevirtual |
Trace ID of the transaction
Reimplemented from GenObject.
|
protected |
Attempt to perform automatic client transaction authentication
| answer | SIP answer that creates the new transaction |