reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
repro::ResponseContext Class Reference

#include <ResponseContext.hxx>

Classes

class  CompareStatus
 

Public Types

typedef std::map< resip::Data, repro::Target * > TransactionMap
 

Public Member Functions

virtual ~ResponseContext ()
 
resip::Data addTarget (const resip::NameAddr &target, bool beginImmediately=false)
 Adds this Target as a SimpleTarget to the collection of Targets.
 
bool addTarget (std::unique_ptr< repro::Target > target, bool beginImmediately=false, bool checkDuplicates=true)
 Adds this Target to the collection of Targets.
 
bool addTargetBatch (TargetPtrList &targets, bool highPriority=false)
 Adds a batch of Targets.
 
bool beginClientTransactions ()
 Begins all Candidate client transactions.
 
bool beginClientTransaction (const resip::Data &serial)
 Begins a client transaction.
 
bool cancelActiveClientTransactions (const resip::Tokens *reasons=0)
 Cancels all active client transactions.
 
bool cancelAllClientTransactions (const resip::Tokens *reasons=0)
 Cancels all active client transactions.
 
bool clearCandidateTransactions (const resip::Tokens *reasons=0)
 Removes all Candidate transactions.
 
bool cancelClientTransaction (const resip::Data &serial, const resip::Tokens *reasons=0)
 Cancels this client transaction if active, or Terminates it if Candidate.
 
Target * getTarget (const resip::Data &serial) const
 Self-explanatory.
 
const TransactionMap & getCandidateTransactionMap () const
 Self-explanatory.
 
bool hasCandidateTransactions () const
 
bool hasActiveTransactions () const
 
bool hasTerminatedTransactions () const
 
bool hasTargets () const
 
bool isCandidate (const resip::Data &tid) const
 
bool isActive (const resip::Data &tid) const
 
bool isTerminated (const resip::Data &tid) const
 
bool areAllTransactionsTerminated () const
 
int getPriority (const resip::SipMessage &msg)
 

Public Attributes

RequestContext & mRequestContext
 bwc! This should probably not be private, since these two classes are
 
std::list< std::list< resip::Data > > mTransactionQueueCollection
 
resip::Data mCurrentResponseTid
 

Protected Member Functions

 ResponseContext (RequestContext &parent)
 
void processCancel (const resip::SipMessage &request)
 
void processResponse (resip::SipMessage &response)
 
void updateTimerC (const resip::Data &tid)
 
void processTimerC (const resip::Data &tid, int serial)
 
void beginClientTransaction (repro::Target *target)
 
void cancelClientTransaction (repro::Target *target, const resip::Tokens *reasons=0)
 
void terminateClientTransaction (const resip::Data &tid)
 
void removeClientTransaction (const resip::Data &transactionId)
 
void insertRecordRoute (resip::SipMessage &outgoing, const resip::Tuple &receivedTransportTuple, const resip::NameAddr &receivedTransportRecordRoute, bool transportSpecificRecordRoute, Target *target, bool doPathInstead=false)
 
resip::Data getInboundFlowToken (bool doPathInstead)
 
bool outboundFlowTokenNeeded (Target *target)
 
bool needsFlowTokenToWork (const resip::NameAddr &contact) const
 
bool sendingToSelf (Target *target)
 
std::unique_ptr< resip::SipMessage > buildTargetRequest (Target *target)
 
void sendRequest (resip::SipMessage &request)
 
bool isDuplicate (const repro::Target *target) const
 
virtual void forwardBestResponse ()
 

Protected Attributes

TransactionMap mCandidateTransactionMap
 
TransactionMap mActiveTransactionMap
 
TransactionMap mTerminatedTransactionMap
 
resip::ContactList mTargetList
 
resip::SipMessage mBestResponse
 
int mBestPriority
 
bool mSecure
 
bool mIsClientBehindNAT
 
std::unordered_map< resip::Data, int > mTimerCSerial
 

Static Protected Attributes

static const int TimerCSerialInit = 0
 

Friends

class RequestContext
 
EncodeStream & operator<< (EncodeStream &strm, const repro::ResponseContext &rc)
 

Detailed Description

Definition at line 29 of file ResponseContext.hxx.

Member Typedef Documentation

◆ TransactionMap

Constructor & Destructor Documentation

◆ ~ResponseContext()

ResponseContext::~ResponseContext ( )
virtual

Definition at line 39 of file ResponseContext.cxx.

◆ ResponseContext()

ResponseContext::ResponseContext ( RequestContext &  parent)
protected

Definition at line 30 of file ResponseContext.cxx.

Member Function Documentation

◆ addTarget() [1/2]

resip::Data ResponseContext::addTarget ( const resip::NameAddr &  target,
bool  beginImmediately = false 
)

Adds this Target as a SimpleTarget to the collection of Targets.

Parameters
targetThe NameAdder used to form the Target to add.
beginImmediatelyWhether to immediately start a transaction for this target.
Returns
tid of the newly added target
Note
Targets are not checked for duplicate uris until an attempt is made to begin them.

Definition at line 63 of file ResponseContext.cxx.

◆ addTarget() [2/2]

bool ResponseContext::addTarget ( std::unique_ptr< repro::Target >  target,
bool  beginImmediately = false,
bool  checkDuplicates = true 
)

Adds this Target to the collection of Targets.

Parameters
targetThe Target to add.
beginImmediatelyWhether to immediately start a transaction for this target.
checkDuplicatesWhether to see if target exists already or not
Returns
If beginImmediately=false, true iff the Target was successfully added (could happen if a final response has already been forwarded). If beginImmediately=true, true iff a transaction was successfully started for the Target (could fail due to the presence of a duplicate contact, or when a final response has already been forwarded.)
Note
Targets are not checked for duplicate uris until an attempt is made to start them.

Definition at line 73 of file ResponseContext.cxx.

◆ addTargetBatch()

bool ResponseContext::addTargetBatch ( TargetPtrList &  targets,
bool  highPriority = false 
)

Adds a batch of Targets.

Note
RESPONSECONTEXT ASSUMES OWNERSHIP OF THE TARGETS POINTED TO IN THIS LIST!
Parameters
targetsA list of (sorted) Target*. This list is consumed.
highPriorityWhether or not the Target ProccessorChain should prioritize this batch above other batches of the same type. (This is primarily intended to let multiple recursive redirection work properly, but can be used for other purposes.)
Returns
true iff any Targets were added.
Note
It is assumed that all of these Targets are the same subclass of Target, and that they are already sorted in the order of their priority. If these assumptions do not hold, things will not break per se, but oddball target processing behavior might result.

Definition at line 123 of file ResponseContext.cxx.

◆ areAllTransactionsTerminated()

bool ResponseContext::areAllTransactionsTerminated ( ) const
Returns
true iff all targets are in state Terminated

Definition at line 402 of file ResponseContext.cxx.

◆ beginClientTransaction() [1/2]

bool ResponseContext::beginClientTransaction ( const resip::Data &  serial)

Begins a client transaction.

Parameters
serialThe transaction id to start.
Returns
true iff the transaction was started (could fail if there was a duplicate contact)

Definition at line 215 of file ResponseContext.cxx.

◆ beginClientTransaction() [2/2]

void ResponseContext::beginClientTransaction ( repro::Target *  target)
protected

Definition at line 583 of file ResponseContext.cxx.

◆ beginClientTransactions()

bool ResponseContext::beginClientTransactions ( )

Begins all Candidate client transactions.

Returns
true iff any transactions were started

Definition at line 177 of file ResponseContext.cxx.

◆ buildTargetRequest()

std::unique_ptr< resip::SipMessage > ResponseContext::buildTargetRequest ( Target *  target)
protected

Definition at line 488 of file ResponseContext.cxx.

◆ cancelActiveClientTransactions()

bool ResponseContext::cancelActiveClientTransactions ( const resip::Tokens *  reasons = 0)

Cancels all active client transactions.

Does not clear Candidate transactions.

Parameters
reasonsOptional reasons header to be added to any resulting CANCEL requests.
Returns
true iff any transaction was placed in either the WaitingToCancel or Cancelled state.

Definition at line 242 of file ResponseContext.cxx.

◆ cancelAllClientTransactions()

bool ResponseContext::cancelAllClientTransactions ( const resip::Tokens *  reasons = 0)

Cancels all active client transactions.

Also clears Candidate transactions (they are transitioned directly to Terminated).

Parameters
reasonsOptional reasons header to be added to any resulting CANCEL requests.
Returns
true iff any transaction was placed in either the WaitingToCancel, Cancelled, or Terminated state.

Definition at line 269 of file ResponseContext.cxx.

◆ cancelClientTransaction() [1/2]

bool ResponseContext::cancelClientTransaction ( const resip::Data &  serial,
const resip::Tokens *  reasons = 0 
)

Cancels this client transaction if active, or Terminates it if Candidate.


Parameters
reasonsOptional reasons header to be added to any resulting CANCEL requests.
Returns
true iff this transaction was placed in either the WaitingToCancel, Cancelled, or Terminated state.

Definition at line 315 of file ResponseContext.cxx.

◆ cancelClientTransaction() [2/2]

void ResponseContext::cancelClientTransaction ( repro::Target *  target,
const resip::Tokens *  reasons = 0 
)
protected

Definition at line 1330 of file ResponseContext.cxx.

◆ clearCandidateTransactions()

bool ResponseContext::clearCandidateTransactions ( const resip::Tokens *  reasons = 0)

Removes all Candidate transactions.

Parameters
reasonsOptional reasons header to be added to any resulting CANCEL requests.
Returns
true iff at least one Candidate transaction was removed.

Definition at line 297 of file ResponseContext.cxx.

◆ forwardBestResponse()

void ResponseContext::forwardBestResponse ( )
protectedvirtual

Definition at line 1521 of file ResponseContext.cxx.

◆ getCandidateTransactionMap()

const ResponseContext::TransactionMap & ResponseContext::getCandidateTransactionMap ( ) const

Self-explanatory.

Note
Can be used to decide which targets should be processed next, although this assumes a great deal of interdependency btw the various processor chains and homogeneity in how the Targets are prioritized, and can be inefficient if there are large numbers of Candidate Targets. A more structured approach exists in the functions dealing with TransactionBatch.

Definition at line 370 of file ResponseContext.cxx.

◆ getInboundFlowToken()

resip::Data ResponseContext::getInboundFlowToken ( bool  doPathInstead)
protected

Definition at line 711 of file ResponseContext.cxx.

◆ getPriority()

int ResponseContext::getPriority ( const resip::SipMessage &  msg)

Definition at line 1376 of file ResponseContext.cxx.

◆ getTarget()

Target * ResponseContext::getTarget ( const resip::Data &  serial) const

Self-explanatory.

Definition at line 341 of file ResponseContext.cxx.

◆ hasActiveTransactions()

bool ResponseContext::hasActiveTransactions ( ) const
Returns
true iff there are active targets (in state Trying, Proceeding, WaitingForCancel or Cancelled)

Definition at line 382 of file ResponseContext.cxx.

◆ hasCandidateTransactions()

bool ResponseContext::hasCandidateTransactions ( ) const
Returns
true iff there are Candidate targets

Definition at line 376 of file ResponseContext.cxx.

◆ hasTargets()

bool ResponseContext::hasTargets ( ) const

Definition at line 394 of file ResponseContext.cxx.

◆ hasTerminatedTransactions()

bool ResponseContext::hasTerminatedTransactions ( ) const
Returns
true iff there are Terminated targets.

Definition at line 388 of file ResponseContext.cxx.

◆ insertRecordRoute()

void ResponseContext::insertRecordRoute ( resip::SipMessage &  outgoing,
const resip::Tuple &  receivedTransportTuple,
const resip::NameAddr &  receivedTransportRecordRoute,
bool  transportSpecificRecordRoute,
Target *  target,
bool  doPathInstead = false 
)
protected

Definition at line 607 of file ResponseContext.cxx.

◆ isActive()

bool ResponseContext::isActive ( const resip::Data &  tid) const
Returns
true iff this target is active (Trying, Proceeding, WaitingForCancel, or Cancelled)

Definition at line 415 of file ResponseContext.cxx.

◆ isCandidate()

bool ResponseContext::isCandidate ( const resip::Data &  tid) const
Returns
true iff this target is in state Candidate

Definition at line 408 of file ResponseContext.cxx.

◆ isDuplicate()

bool ResponseContext::isDuplicate ( const repro::Target *  target) const
protected

Definition at line 466 of file ResponseContext.cxx.

◆ isTerminated()

bool ResponseContext::isTerminated ( const resip::Data &  tid) const
Returns
true iff this target is in state Terminated

Definition at line 422 of file ResponseContext.cxx.

◆ needsFlowTokenToWork()

bool ResponseContext::needsFlowTokenToWork ( const resip::NameAddr &  contact) const
protected

Definition at line 806 of file ResponseContext.cxx.

◆ outboundFlowTokenNeeded()

bool ResponseContext::outboundFlowTokenNeeded ( Target *  target)
protected

Definition at line 785 of file ResponseContext.cxx.

◆ processCancel()

void ResponseContext::processCancel ( const resip::SipMessage &  request)
protected

Definition at line 956 of file ResponseContext.cxx.

◆ processResponse()

void ResponseContext::processResponse ( resip::SipMessage &  response)
protected

Definition at line 1037 of file ResponseContext.cxx.

◆ processTimerC()

void ResponseContext::processTimerC ( const resip::Data &  tid,
int  serial 
)
protected

Definition at line 1002 of file ResponseContext.cxx.

◆ removeClientTransaction()

void ResponseContext::removeClientTransaction ( const resip::Data &  transactionId)
protected

Definition at line 429 of file ResponseContext.cxx.

◆ sendingToSelf()

bool ResponseContext::sendingToSelf ( Target *  target)
protected

Definition at line 848 of file ResponseContext.cxx.

◆ sendRequest()

void ResponseContext::sendRequest ( resip::SipMessage &  request)
protected

Definition at line 858 of file ResponseContext.cxx.

◆ terminateClientTransaction()

void ResponseContext::terminateClientTransaction ( const resip::Data &  tid)
protected

Definition at line 1349 of file ResponseContext.cxx.

◆ updateTimerC()

void ResponseContext::updateTimerC ( const resip::Data &  tid)
protected

Definition at line 984 of file ResponseContext.cxx.

Friends And Related Symbol Documentation

◆ operator<<

EncodeStream & operator<< ( EncodeStream &  strm,
const repro::ResponseContext &  rc 
)
friend

◆ RequestContext

Definition at line 290 of file ResponseContext.hxx.

Member Data Documentation

◆ mActiveTransactionMap

TransactionMap repro::ResponseContext::mActiveTransactionMap
protected

Definition at line 271 of file ResponseContext.hxx.

◆ mBestPriority

int repro::ResponseContext::mBestPriority
protected

Definition at line 281 of file ResponseContext.hxx.

◆ mBestResponse

resip::SipMessage repro::ResponseContext::mBestResponse
protected

Definition at line 280 of file ResponseContext.hxx.

◆ mCandidateTransactionMap

TransactionMap repro::ResponseContext::mCandidateTransactionMap
protected

Definition at line 270 of file ResponseContext.hxx.

◆ mCurrentResponseTid

resip::Data repro::ResponseContext::mCurrentResponseTid

Definition at line 229 of file ResponseContext.hxx.

◆ mIsClientBehindNAT

bool repro::ResponseContext::mIsClientBehindNAT
protected

Definition at line 283 of file ResponseContext.hxx.

◆ mRequestContext

RequestContext& repro::ResponseContext::mRequestContext

bwc! This should probably not be private, since these two classes are

Definition at line 226 of file ResponseContext.hxx.

◆ mSecure

bool repro::ResponseContext::mSecure
protected

Definition at line 282 of file ResponseContext.hxx.

◆ mTargetList

resip::ContactList repro::ResponseContext::mTargetList
protected

Definition at line 276 of file ResponseContext.hxx.

◆ mTerminatedTransactionMap

TransactionMap repro::ResponseContext::mTerminatedTransactionMap
protected

Definition at line 272 of file ResponseContext.hxx.

◆ mTimerCSerial

std::unordered_map<resip::Data, int> repro::ResponseContext::mTimerCSerial
protected

Definition at line 286 of file ResponseContext.hxx.

◆ mTransactionQueueCollection

std::list<std::list<resip::Data> > repro::ResponseContext::mTransactionQueueCollection

Definition at line 228 of file ResponseContext.hxx.

◆ TimerCSerialInit

const int repro::ResponseContext::TimerCSerialInit = 0
staticprotected

Definition at line 285 of file ResponseContext.hxx.


The documentation for this class was generated from the following files: