class SIPEngine

The SIP engine and transaction list. More...

Contains pure virtuals
Full nameTelEngine::SIPEngine
Definition#include <libs/ysip/yatesip.h>
InheritsTelEngine::DebugEnabler [public ], TelEngine::Mutex [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Public Static Methods

Protected Members


Detailed Description

The SIP engine holds common methods and the list of current transactions

 SIPEngine (const char* userAgent = 0)

SIPEngine

Create the SIP Engine

 ~SIPEngine ()

~SIPEngine

[virtual]

Destroy the SIP Engine

bool  buildParty (SIPMessage* message)

buildParty

[pure virtual]

Build a new SIPParty for a message

Parameters:
messagePointer to the message to build the party

Returns: True on success, false if party could not be built

bool  checkUser (String& username, const String& realm, const String& nonce, const String& method, const String& uri, const String& response, const SIPMessage* message, const MimeHeaderLine* authLine, GenObject* userData)

checkUser

[virtual]

Check user credentials for validity

Parameters:
usernameUser account name
realmAuthentication realm
nonceAuthentication opaque nonce generated by the server
methodMethod of the SIP message that is being authenticated
uriURI of the SIP message that is being authenticated
responseResponse computed by the authenticated entity
messageMessage that is to be authenticated
authLineExtra credentials line to validate
userDataPointer to an optional object passed from authUser

Returns: True if valid user/password, false if verification failed

bool  checkAuth (bool noUser, String& username, const SIPMessage* message, const MimeHeaderLine* authLine, GenObject* userData)

checkAuth

[virtual]

Authenticate a message by other means than user credentials. By default it calls checkUser with empty user credential fields

Parameters:
noUserNo plausible user credentials were detected so far
usernameUser account name
messageMessage that is to be authenticated
authLineExtra credentials line to validate
userDataPointer to an optional object passed from authUser

Returns: True if message is authenticated, false if verification failed

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

authUser

Detect the proper credentials for any user in the engine

Parameters:
messagePointer to the message to check
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 checkUser

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

SIPTransaction*  addMessage (SIPParty* ep, const char* buf, int len = -1)

addMessage

Add a message into the transaction list

Parameters:
epParty of the received message
bufA buffer containing the SIP message text
lenThe length of the message or -1 to interpret as C string

Returns: Pointer to the transaction or NULL if message was invalid

SIPTransaction*  addMessage (SIPMessage* message)

addMessage

Add a message into the transaction list This method is thread safe

Parameters:
messageA parsed SIP message to add to the transactions

Returns: Pointer to the transaction or NULL if message was invalid

SIPEvent * getEvent ()

getEvent

Get a SIPEvent from the queue. This method mainly looks into the transaction list and get all kind of events, like an incoming request (INVITE, REGISTRATION), a timer, an outgoing message. This method is thread safe

bool  process ()

process

This method should be called very often to get the events from the list and to send them to processEvent method.

Returns: True if some events were processed this turn

void  processEvent (SIPEvent *event)

processEvent

[virtual]

Default handling for events. This method should be overriden for what you need and at the end you should call this default one This method is thread safe

SIPTransaction*  forkInvite (SIPMessage* answer, SIPTransaction* trans)

forkInvite

[virtual]

Handle answers that create new dialogs for an outgoing INVITE

Parameters:
answerThe message that creates the INVITE fork
transOne of the transactions part of the same INVITE

Returns: Pointer to new transaction or NULL if message is ignored

u_int64_t  getUserTimeout ()

getUserTimeout

[const virtual]

Get the timeout to be used for transactions involving human interaction. The default implementation returns the proxy INVITE timeout (timer C = 3 minutes) minus the INVITE response retransmit interval (timer T2 = 4 seconds)

Returns: Duration of the timeout in microseconds

u_int64_t  getTimer (char which, bool reliable = false)

getTimer

[const]

Get the length of a timer

Parameters:
whichA one-character constant that selects which timer to return
reliableWhether we request the timer value for a reliable protocol

Returns: Duration of the selected timer or 0 if invalid

inline unsigned int  getReqTransCount ()

getReqTransCount

[const]

Get the number of times to send a SIP request. This value applies only when retransmission is required

Returns: The number of times to send a SIP request

inline unsigned int  getRspTransCount ()

getRspTransCount

[const]

Get the number of times to send a response to a SIP request. This value applies only when retransmission is required

Returns: The number of times to send a response to a SIP request

inline unsigned int  getMaxForwards ()

getMaxForwards

[const]

Get the default value of the Max-Forwards header for this engine

Returns: The maximum number of hops the request is allowed to pass

inline const String&  getUserAgent ()

getUserAgent

[const]

Get the User agent for this SIP engine

inline int  getNextCSeq ()

getNextCSeq

Get a CSeq value suitable for use in a new request

inline bool  lazyTrying ()

lazyTrying

[const]

Check if the engine is set up for lazy "100 Trying" messages

Returns: True if the first 100 message is to be skipped for non-INVITE

inline void  lazyTrying (bool lazy100)

lazyTrying

Set the lazy "100 Trying" messages flag

Parameters:
lazy100True to not send the 1st 100 message for non-INVITE

inline int  flags ()

flags

[const]

Retrieve various flags for this engine

Returns: Value of flags ORed together

inline bool  autoChangeParty ()

autoChangeParty

[const]

Check if message party should be changed from latest dialog party

Returns: Value of auto change party option

void  nonceGet (String& nonce)

nonceGet

Get an authentication nonce

Parameters:
nonceString reference to fill with the current nonce

long  nonceAge (const String& nonce)

nonceAge

Get the age of an authentication nonce

Parameters:
nonceString nonce to check for validity and age

Returns: Age of the nonce in seconds, negative for invalid

void  ncGet (String& nc)

ncGet

Get a nonce count

Parameters:
ncString reference to fill with new nonce count

void  buildAuth (const String& username, const String& realm, const String& passwd, const String& nonce, const String& method, const String& uri, String& response, const NamedList& qop = NamedList::empty())

buildAuth

[static]

Build an authentication response

Parameters:
usernameUser account name
realmAuthentication realm
passwdAccount password
nonceAuthentication opaque nonce generated by the server
methodMethod of the SIP message that is being authenticated
uriURI of the SIP message that is being authenticated
responseString to store the computed response
qopOptional quality of protection type (set in list name) and parameters

void  buildAuth (const String& hash_a1, const String& nonce, const String& hash_a2, String& response)

buildAuth

[static]

Build an authentication response from already hashed components

Parameters:
hash_a1MD5 digest of username:realm:password
nonceAuthentication opaque nonce generated by the server
hash_a2MD5 digest of method:uri
responseString to store the computed response

bool  isAllowed (const char* method)

isAllowed

[const]

Check if a method is in the allowed methods list

Parameters:
methodUppercase name of the method to check

Returns: True if the method should be allowed processing

void  addAllowed (const char* method)

addAllowed

Add a method to the allowed methods list

Parameters:
methodUppercase name of the method to add

inline const String&  getAllowed ()

getAllowed

[const]

Get all the allowed methods

Returns: Comma separated list of allowed methods

inline void  remove (SIPTransaction* transaction)

remove

Remove a transaction from the list without dereferencing it

Parameters:
transactionPointer to transaction to remove

inline void  append (SIPTransaction* transaction)

append

Append a transaction to the end of the list

Parameters:
transactionPointer to transaction to append

inline void  insert (SIPTransaction* transaction)

insert

Insert a transaction at the start of the list

Parameters:
transactionPointer to transaction to insert

ObjList m_transList

m_transList

[protected]

u_int64_t m_t1

m_t1

[protected]

u_int64_t m_t4

m_t4

[protected]

int m_reqTransCount

m_reqTransCount

[protected]

int m_rspTransCount

m_rspTransCount

[protected]

unsigned int m_maxForwards

m_maxForwards

[protected]

int m_cseq

m_cseq

[protected]

int m_flags

m_flags

[protected]

bool m_lazyTrying

m_lazyTrying

[protected]

String m_userAgent

m_userAgent

[protected]

String m_allowed

m_allowed

[protected]

u_int32_t m_nc

m_nc

[protected]

String m_nonce

m_nonce

[protected]

String m_nonce_secret

m_nonce_secret

[protected]

u_int32_t m_nonce_time

m_nonce_time

[protected]

Mutex m_nonce_mutex

m_nonce_mutex

[protected]

bool m_autoChangeParty

m_autoChangeParty

[protected]


Generated by: paulc on bussard on Sun Oct 20 21:06:06 2013, using kdoc 2.0a54.