|
reSIProcate/stack
9694
|
#include <TransactionController.hxx>

Definition at line 23 of file TransactionController.hxx.
| TransactionController::TransactionController | ( | SipStack & | stack, |
| AsyncProcessHandler * | handler | ||
| ) |
Definition at line 37 of file TransactionController.cxx.
References mStateMacFifo, and resip::FifoStatsInterface::setDescription().
: mStack(stack), mDiscardStrayResponses(true), mFixBadDialogIdentifiers(true), mFixBadCSeqNumbers(true), mStateMacFifo(handler), mStateMacFifoOutBuffer(mStateMacFifo), mCongestionManager(0), mTuSelector(stack.mTuSelector), mTransportSelector(mStateMacFifo, stack.getSecurity(), stack.getDnsStub(), stack.getCompression()), mTimers(mTimerFifo), mShuttingDown(false), mStatsManager(stack.mStatsManager), mHostname(DnsUtil::getLocalHostName()) { mStateMacFifo.setDescription("TransactionController::mStateMacFifo"); }

| TransactionController::~TransactionController | ( | ) |
Definition at line 63 of file TransactionController.cxx.
References mClientTransactionMap, mServerTransactionMap, resip::TransactionMap::size(), and WarningLog.
{
if(mClientTransactionMap.size())
{
WarningLog(<< "On shutdown, there are Client TransactionStates remaining!");
}
if(mServerTransactionMap.size())
{
WarningLog(<< "On shutdown, there are Server TransactionStates remaining!");
}
}

| resip::TransactionController::TransactionController | ( | const TransactionController & | rhs | ) | [private] |
| void TransactionController::abandonServerTransaction | ( | const Data & | tid | ) |
Definition at line 245 of file TransactionController.cxx.
References resip::Fifo< Msg >::add(), and mStateMacFifo.
Referenced by resip::SipStack::abandonServerTransaction().
{
mStateMacFifo.add(new AbandonServerTransaction(tid));
}

| void TransactionController::cancelClientInviteTransaction | ( | const Data & | tid | ) |
Definition at line 251 of file TransactionController.cxx.
References resip::Fifo< Msg >::add(), and mStateMacFifo.
Referenced by resip::SipStack::cancelClientInviteTransaction().
{
mStateMacFifo.add(new CancelClientInviteTransaction(tid));
}

| void TransactionController::enableFlowTimer | ( | const resip::Tuple & | flow | ) |
Definition at line 263 of file TransactionController.cxx.
References resip::Fifo< Msg >::add(), and mStateMacFifo.
Referenced by resip::SipStack::enableFlowTimer().
{
mStateMacFifo.add(new EnableFlowTimer(flow));
}

| bool resip::TransactionController::getFixBadCSeqNumbers | ( | ) | const [inline] |
Definition at line 92 of file TransactionController.hxx.
References mFixBadCSeqNumbers.
Referenced by resip::SipStack::getFixBadCSeqNumbers(), and resip::TransactionState::process().
{ return mFixBadCSeqNumbers;}
| bool resip::TransactionController::getFixBadDialogIdentifiers | ( | ) | const [inline] |
Definition at line 82 of file TransactionController.hxx.
References mFixBadDialogIdentifiers.
Referenced by resip::TransactionState::process().
{
return mFixBadDialogIdentifiers;
}
| unsigned int TransactionController::getNumClientTransactions | ( | ) | const |
Definition at line 204 of file TransactionController.cxx.
References mClientTransactionMap, and resip::TransactionMap::size().
Referenced by resip::StatisticsManager::poll().
{
return mClientTransactionMap.size();
}

| unsigned int TransactionController::getNumServerTransactions | ( | ) | const |
Definition at line 210 of file TransactionController.cxx.
References mServerTransactionMap, and resip::TransactionMap::size().
Referenced by resip::StatisticsManager::poll().
{
return mServerTransactionMap.size();
}

| CongestionManager::RejectionBehavior resip::TransactionController::getRejectionBehavior | ( | ) | const [inline] |
Definition at line 70 of file TransactionController.hxx.
References resip::CongestionManager::getRejectionBehavior(), mCongestionManager, mStateMacFifo, and resip::CongestionManager::NORMAL.
Referenced by resip::TransactionState::processTimer(), and send().
{
if(mCongestionManager)
{
return mCongestionManager->getRejectionBehavior(&mStateMacFifo);
}
return CongestionManager::NORMAL;
}

| unsigned int TransactionController::getTimerQueueSize | ( | ) | const |
Definition at line 216 of file TransactionController.cxx.
References mTimers, and resip::TimerQueue< T >::size().
Referenced by resip::StatisticsManager::poll().

| unsigned int TransactionController::getTimeTillNextProcessMS | ( | ) |
Definition at line 155 of file TransactionController.cxx.
References resip::ConsumerFifoBuffer< class >::messageAvailable(), mStateMacFifoOutBuffer, resip::TimerQueue< T >::msTillNextTimer(), and mTimers.
Referenced by resip::SipStack::getTimeTillNextProcessMS().
{
if ( mStateMacFifoOutBuffer.messageAvailable() )
{
return 0;
}
return mTimers.msTillNextTimer();
}

| unsigned int TransactionController::getTransactionFifoSize | ( | ) | const |
Definition at line 196 of file TransactionController.cxx.
References mStateMacFifo, and resip::AbstractFifo< T >::size().
Referenced by resip::StatisticsManager::poll().
{
// Should we include the stuff in mStateMacFifoOutBuffer here too? This is
// likely to be called from other threads...
return mStateMacFifo.size();
}

| unsigned int TransactionController::getTuFifoSize | ( | ) | const |
Definition at line 184 of file TransactionController.cxx.
References mTuSelector, and resip::TuSelector::size().
Referenced by resip::StatisticsManager::poll().
{
return mTuSelector.size();
}

| bool TransactionController::isTUOverloaded | ( | ) | const |
Definition at line 78 of file TransactionController.cxx.
References mTuSelector, and resip::TuSelector::wouldAccept().
{
return !mTuSelector.wouldAccept(TimeLimitFifo<Message>::EnforceTimeDepth);
}

| TransactionController& resip::TransactionController::operator= | ( | const TransactionController & | rhs | ) | [private] |
| void TransactionController::pollStatistics | ( | ) |
Definition at line 228 of file TransactionController.cxx.
References resip::Fifo< Msg >::add(), and mStateMacFifo.
Referenced by resip::SipStack::pollStatistics().
{
mStateMacFifo.add(new PollStatistics());
}

| void TransactionController::process | ( | int | timeout = 0 | ) |
dcm! -- send to all?
Definition at line 91 of file TransactionController.cxx.
References resip::TuSelector::add(), resip::Fifo< Msg >::getNext(), resip::ConsumerFifoBuffer< class >::getNext(), resip::TransportSelector::isFinished(), resip::ConsumerFifoBuffer< class >::messageAvailable(), resip::AbstractFifo< T >::messageAvailable(), mShuttingDown, mStack, mStateMacFifoOutBuffer, resip::TimerQueue< T >::msTillNextTimer(), mTimerFifo, mTimers, mTransportSelector, resip::SipStack::mTUFifo, mTuSelector, resip::TransportSelector::poke(), resip::TimerQueue< T >::process(), resip::TransactionState::processTimer(), and resip::resipMin().
Referenced by resip::SipStack::processTimers(), and resip::TransactionControllerThread::thread().
{
if (mShuttingDown &&
//mTimers.empty() &&
!mStateMacFifoOutBuffer.messageAvailable() && // !dcm! -- see below
!mStack.mTUFifo.messageAvailable() &&
mTransportSelector.isFinished())
// !dcm! -- why would one wait for the Tu's fifo to be empty before delivering a
// shutdown message?
{
mTuSelector.add(new ShutdownMessage, TimeLimitFifo<Message>::InternalElement);
}
else
{
unsigned int nextTimer(mTimers.msTillNextTimer());
timeout=resipMin((int)nextTimer, timeout);
if(timeout==0)
{
// *sigh*
timeout=-1;
}
// If non-zero is passed for timeout, we understand that the caller is ok
// with us waiting up to that long on this call. A non-zero timeout is
// passed by TransactionControllerThread, for example. This gets us
// something approximating a blocking wait on both the state machine fifo
// and the timer queue.
TransactionMessage* message=mStateMacFifoOutBuffer.getNext(timeout);
// If we either had timers ready to go at the beginning of this call, or
// the getNext() call above timed out, our timer queue is likely ready to
// be serviced.
if(!message || nextTimer==0)
{
mTimers.process();
TimerMessage* timer;
while ((timer=mTimerFifo.getNext(-1)))
{
TransactionState::processTimer(*this,timer);
}
}
if(message)
{
// Only do 16 at a time; don't let the timer queue (or other
// processing) starve.
int runs=16;
while(message)
{
TransactionState::process(*this, message);
if(--runs==0)
{
break;
}
message = mStateMacFifoOutBuffer.getNext(-1);
}
mTransportSelector.poke();
}
}
}

| void TransactionController::registerMarkListener | ( | MarkListener * | listener | ) |
Definition at line 234 of file TransactionController.cxx.
References mTransportSelector, and resip::TransportSelector::registerMarkListener().
Referenced by resip::SipStack::registerMarkListener().
{
mTransportSelector.registerMarkListener(listener);
}

| void TransactionController::send | ( | SipMessage * | msg | ) |
Definition at line 165 of file TransactionController.cxx.
References resip::Fifo< Msg >::add(), resip::TuSelector::add(), resip::AbstractFifo< T >::expectedWaitTimeMilliSec(), getRejectionBehavior(), resip::Message::getTransactionUser(), resip::SipMessage::header(), resip::SipMessage::isRequest(), resip::Helper::makeResponse(), resip::SipMessage::method(), mStateMacFifo, mTuSelector, resip::CongestionManager::NORMAL, and resip::Message::setTransactionUser().
Referenced by resip::SipStack::send(), and resip::SipStack::sendTo().
{
if(msg->isRequest() &&
msg->method() != ACK &&
getRejectionBehavior()!=CongestionManager::NORMAL)
{
// Need to 503 this.
SipMessage* resp(Helper::makeResponse(*msg, 503));
resp->header(h_RetryAfter).value()=(UInt32)mStateMacFifo.expectedWaitTimeMilliSec()/1000;
resp->setTransactionUser(msg->getTransactionUser());
mTuSelector.add(resp, TimeLimitFifo<Message>::InternalElement);
delete msg;
return;
}
mStateMacFifo.add(msg);
}

| void resip::TransactionController::setCongestionManager | ( | CongestionManager * | manager | ) | [inline] |
Definition at line 56 of file TransactionController.hxx.
References mCongestionManager, mStateMacFifo, mTransportSelector, resip::CongestionManager::registerFifo(), resip::TransportSelector::setCongestionManager(), and resip::CongestionManager::unregisterFifo().
Referenced by resip::SipStack::setCongestionManager().
{
mTransportSelector.setCongestionManager(manager);
if(mCongestionManager)
{
mCongestionManager->unregisterFifo(&mStateMacFifo);
}
mCongestionManager=manager;
if(mCongestionManager)
{
mCongestionManager->registerFifo(&mStateMacFifo);
}
}

| void resip::TransactionController::setFixBadCSeqNumbers | ( | bool | pFixBadCSeqNumbers | ) | [inline] |
Definition at line 93 of file TransactionController.hxx.
References mFixBadCSeqNumbers.
Referenced by resip::SipStack::setFixBadCSeqNumbers().
{
mFixBadCSeqNumbers = pFixBadCSeqNumbers;
}
| void resip::TransactionController::setFixBadDialogIdentifiers | ( | bool | pFixBadDialogIdentifiers | ) | [inline] |
Definition at line 87 of file TransactionController.hxx.
References mFixBadDialogIdentifiers.
{
mFixBadDialogIdentifiers = pFixBadDialogIdentifiers;
}
| void TransactionController::setInterruptor | ( | AsyncProcessHandler * | handler | ) |
Definition at line 269 of file TransactionController.cxx.
References mStateMacFifo, and resip::Fifo< Msg >::setInterruptor().
Referenced by resip::TransactionControllerThread::TransactionControllerThread().
{
mStateMacFifo.setInterruptor(handler);
}

| void TransactionController::shutdown | ( | ) |
Definition at line 84 of file TransactionController.cxx.
References mShuttingDown, mTransportSelector, and resip::TransportSelector::shutdown().
Referenced by resip::SipStack::shutdown().
{
mShuttingDown = true;
mTransportSelector.shutdown();
}

| unsigned int TransactionController::sumTransportFifoSizes | ( | ) | const |
Definition at line 190 of file TransactionController.cxx.
References mTransportSelector, and resip::TransportSelector::sumTransportFifoSizes().
Referenced by resip::StatisticsManager::poll().
{
return mTransportSelector.sumTransportFifoSizes();
}

| void TransactionController::terminateFlow | ( | const resip::Tuple & | flow | ) |
Definition at line 257 of file TransactionController.cxx.
References resip::Fifo< Msg >::add(), and mStateMacFifo.
Referenced by resip::SipStack::terminateFlow().
{
mStateMacFifo.add(new TerminateFlow(flow));
}

| TransportSelector& resip::TransactionController::transportSelector | ( | ) | [inline] |
Definition at line 40 of file TransactionController.hxx.
References mTransportSelector.
Referenced by resip::SipStack::addTransport(), resip::SipStack::getTimeTillNextProcessMS(), resip::SipStack::init(), resip::SipStack::processTimers(), resip::SipStack::run(), resip::SipStack::SipStack(), and resip::SipStack::stateMacFifo().
{ return mTransportSelector; }
| const TransportSelector& resip::TransactionController::transportSelector | ( | ) | const [inline] |
Definition at line 41 of file TransactionController.hxx.
References mTransportSelector.
{ return mTransportSelector; }
| void TransactionController::unregisterMarkListener | ( | MarkListener * | listener | ) |
Definition at line 239 of file TransactionController.cxx.
References mTransportSelector, and resip::TransportSelector::unregisterMarkListener().
Referenced by resip::SipStack::unregisterMarkListener().
{
mTransportSelector.unregisterMarkListener(listener);
}

| void TransactionController::zeroOutStatistics | ( | ) |
Definition at line 222 of file TransactionController.cxx.
References resip::Fifo< Msg >::add(), and mStateMacFifo.
Referenced by resip::SipStack::zeroOutStatistics().
{
mStateMacFifo.add(new ZeroOutStatistics());
}

friend class SipStack [friend] |
Definition at line 155 of file TransactionController.hxx.
friend class StatelessHandler [friend] |
Definition at line 156 of file TransactionController.hxx.
friend class TestDnsResolver [friend] |
Definition at line 160 of file TransactionController.hxx.
friend class TestFSM [friend] |
Definition at line 161 of file TransactionController.hxx.
friend class TransactionState [friend] |
Definition at line 157 of file TransactionController.hxx.
friend class TransportSelector [friend] |
Definition at line 158 of file TransactionController.hxx.
unsigned int TransactionController::MaxTUFifoSize = 0 [static] |
Definition at line 27 of file TransactionController.hxx.
Referenced by resip::SipStack::SipStack().
unsigned int TransactionController::MaxTUFifoTimeDepthSecs = 0 [static] |
Definition at line 28 of file TransactionController.hxx.
Referenced by resip::SipStack::SipStack().
Definition at line 142 of file TransactionController.hxx.
Referenced by resip::TransactionState::add(), resip::SipStack::dump(), resip::TransactionState::erase(), getNumClientTransactions(), resip::TransactionState::process(), resip::TransactionState::processSipMessageAsNew(), resip::TransactionState::processTimer(), and ~TransactionController().
Definition at line 124 of file TransactionController.hxx.
Referenced by getRejectionBehavior(), and setCongestionManager().
bool resip::TransactionController::mDiscardStrayResponses [private] |
Definition at line 112 of file TransactionController.hxx.
Referenced by resip::TransactionState::processSipMessageAsNew().
bool resip::TransactionController::mFixBadCSeqNumbers [private] |
Definition at line 116 of file TransactionController.hxx.
Referenced by getFixBadCSeqNumbers(), and setFixBadCSeqNumbers().
bool resip::TransactionController::mFixBadDialogIdentifiers [private] |
Definition at line 114 of file TransactionController.hxx.
Referenced by getFixBadDialogIdentifiers(), resip::SipStack::getFixBadDialogIdentifiers(), setFixBadDialogIdentifiers(), and resip::SipStack::setFixBadDialogIdentifiers().
Data resip::TransactionController::mHostname [private] |
Definition at line 153 of file TransactionController.hxx.
Referenced by resip::TransactionState::processNoDnsResults(), and resip::TransactionState::processTransportFailure().
Definition at line 143 of file TransactionController.hxx.
Referenced by resip::TransactionState::add(), resip::SipStack::dump(), resip::TransactionState::erase(), getNumServerTransactions(), resip::TransactionState::process(), resip::TransactionState::processSipMessageAsNew(), resip::TransactionState::processTimer(), and ~TransactionController().
bool resip::TransactionController::mShuttingDown [private] |
Definition at line 149 of file TransactionController.hxx.
Referenced by process(), and shutdown().
SipStack& resip::TransactionController::mStack [private] |
Definition at line 107 of file TransactionController.hxx.
Referenced by process(), resip::TransactionState::process(), and resip::TransactionState::sendCurrentToWire().
Definition at line 122 of file TransactionController.hxx.
Referenced by abandonServerTransaction(), resip::TestFSM::addMessage(), cancelClientInviteTransaction(), enableFlowTimer(), getRejectionBehavior(), getTransactionFifoSize(), resip::TransactionState::handle(), pollStatistics(), resip::StatelessHandler::process(), send(), setCongestionManager(), setInterruptor(), terminateFlow(), TransactionController(), and zeroOutStatistics().
ConsumerFifoBuffer<TransactionMessage> resip::TransactionController::mStateMacFifoOutBuffer [private] |
Definition at line 123 of file TransactionController.hxx.
Referenced by getTimeTillNextProcessMS(), and process().
Definition at line 151 of file TransactionController.hxx.
Referenced by resip::TransactionState::process(), and resip::TransactionState::sendCurrentToWire().
Definition at line 133 of file TransactionController.hxx.
Referenced by process().
Definition at line 147 of file TransactionController.hxx.
Referenced by resip::SipStack::dump(), getTimerQueueSize(), getTimeTillNextProcessMS(), resip::TransactionState::handleInternalCancel(), process(), resip::TransactionState::processClientInvite(), resip::TransactionState::processClientNonInvite(), resip::TransactionState::processReliability(), resip::TransactionState::processServerInvite(), resip::TransactionState::processServerNonInvite(), resip::TransactionState::processSipMessageAsNew(), resip::TransactionState::processTimer(), and resip::TransactionState::startServerNonInviteTimerTrying().
Definition at line 139 of file TransactionController.hxx.
Referenced by resip::SipStack::dump(), resip::TransactionState::handleBadRequest(), resip::StatelessHandler::process(), process(), resip::TransactionState::process(), resip::TransactionState::processSipMessageAsNew(), registerMarkListener(), resip::TransactionState::sendCurrentToWire(), setCongestionManager(), shutdown(), sumTransportFifoSizes(), transportSelector(), and unregisterMarkListener().
Definition at line 136 of file TransactionController.hxx.
Referenced by getTuFifoSize(), isTUOverloaded(), resip::StatelessHandler::process(), process(), resip::TransactionState::process(), resip::TransactionState::processSipMessageAsNew(), send(), resip::TransactionState::sendToTU(), resip::TransactionState::terminateClientTransaction(), and resip::TransactionState::terminateServerTransaction().
1.7.5.1