12#define RESIPROCATE_SUBSYSTEM Subsystem::TRANSACTION
17 mFallBackFifo(fallBackFifo),
18 mCongestionManager(0),
19 mFallbackPostNotify(0),
20 mTuSelectorMode(false),
23 mShutdownFifo.setDescription(
"TuSelector::mShutdownFifo");
35 mFallbackPostNotify = handler;
41 if (mShutdownFifo.messageAvailable())
75 WarningLog (<<
"Send to TU that no longer exists: " << std::endl << std::endl << *msg);
91 DebugLog(<<
"Send to default TU: " << std::endl << std::endl << *msg);
92 mFallBackFifo.add(msg,
usage);
93 if ( mFallbackPostNotify )
104 for(TuList::const_iterator it = mTuList.begin(); it != mTuList.end(); it++)
106 if (!it->shuttingDown && it->tu->isRegisteredForConnectionTermination())
108 it->tu->post(term->
clone());
118 for(TuList::const_iterator it = mTuList.begin(); it != mTuList.end(); it++)
120 if (!it->shuttingDown && it->tu->isRegisteredForKeepAlivePongs())
122 it->tu->post(pong->
clone());
132 for(TuList::const_iterator it = mTuList.begin(); it != mTuList.end(); it++)
134 if (!it->shuttingDown && !it->tu->wouldAccept(
usage))
143 return mFallBackFifo.wouldAccept(
usage);
152 unsigned int total=0;
153 for(TuList::const_iterator it = mTuList.begin(); it != mTuList.end(); it++)
155 total += it->tu->size();
161 return mFallBackFifo.size();
168 mTuSelectorMode =
true;
171 mTuList.insert(mTuList.begin(), Item(&tu));
175 mTuList.push_back(Item(&tu));
183 mShutdownFifo.add(msg);
190 mShutdownFifo.add(msg);
196 DebugLog(<<
"TuSelector::selectTransactionUser: Checking which TU message belongs to:" << std::endl << std::endl << msg);
197 for(TuList::iterator it = mTuList.begin(); it != mTuList.end(); it++)
199 if (it->tu->isForMe(msg))
210 for(TuList::iterator it = mTuList.begin(); it != mTuList.end(); it++)
214 it->shuttingDown =
true;
224 for(TuList::iterator it = mTuList.begin(); it != mTuList.end(); it++)
240 for(TuList::iterator it = mTuList.begin(); it != mTuList.end(); it++)
253 if(mShutdownFifo.messageAvailable())
268 for(TuList::const_iterator it = mTuList.begin(); it != mTuList.end(); it++)
270 if (!it->shuttingDown && it->tu == tu)
282 for(TuList::iterator i=mTuList.begin(); i!=mTuList.end();++i)
284 i->tu->setCongestionManager(manager);
297 if(!mCongestionManager)
318 return (
uint32_t)mFallBackFifo.expectedWaitTimeMilliSec();
#define RESIPROCATE_SUBSYSTEM
#define WarningLog(args_)
#define resip_assert(x)
This file needs to work for both C and C++ code.
virtual void handleProcessNotification()=0
Abstract base class that provides a basic congestion management interface.
virtual RejectionBehavior getRejectionBehavior(const FifoStatsInterface *fifo) const =0
Return the current rejection behavior for this fifo.
@ NORMAL
Not rejecting any work.
virtual Message * clone() const
virtual Message * clone() const
The base-class used for message-passing.
virtual Brief brief() const
return a facet for brief encoding of message
bool hasTransactionUser() const
TransactionUser * getTransactionUser()
Represents a SIP message.
void loadOut(Payload &payload) const
static void logStats(const Subsystem &subsystem, const Payload &stats)
The base-class for an RFC 3261 Transaction User.
virtual const uint16_t getExpectedWait() const
void post(Message *msg)
Posts a Message to this TransactionUser's fifo.
CongestionManager::RejectionBehavior getRejectionBehavior() const
TransactionUser * selectTransactionUser(const SipMessage &msg)
CongestionManager::RejectionBehavior getRejectionBehavior(TransactionUser *tu) const
void requestTransactionUserShutdown(TransactionUser &)
bool wouldAccept(TimeLimitFifo< Message >::DepthUsage usage) const
void add(Message *msg, TimeLimitFifo< Message >::DepthUsage usage)
uint32_t getExpectedWait(TransactionUser *tu) const
void setFallbackPostNotify(AsyncProcessHandler *handler)
unsigned int size() const
unsigned int getTimeTillNextProcessMS()
void setCongestionManager(CongestionManager *manager)
bool isTransactionUserStillRegistered(const TransactionUser *) const
TuSelector(TimeLimitFifo< Message > &fallBackFifo)
void unregisterTransactionUser(TransactionUser &)
void registerTransactionUser(TransactionUser &, const bool front=false)
dcm! – add UnusedChecking(_enum) below;