|
reSIProcate/stack
9694
|
The base-class for an RFC 3261 Transaction User. More...
#include <TransactionUser.hxx>

Public Member Functions | |
| void | post (Message *msg) |
| Posts a Message to this TransactionUser's fifo. | |
| bool | isMyDomain (const Data &domain) const |
| Returns true iff domain matches one of the domains that this TransactionUser is responsible for. | |
| void | addDomain (const Data &domain) |
| Adds a domain to the set of domains that this TransactionUser is responsible for. | |
| virtual const Data & | name () const =0 |
| Return the name of this TransactionUser. | |
| virtual EncodeStream & | encode (EncodeStream &strm) const |
| Encodes the name of this TransactionUser (as specified by name()), and the current depth of its fifo. | |
| void | setMessageFilterRuleList (MessageFilterRuleList &rules) |
| Sets this TransactionUser's MessageFilterRuleList. | |
| bool | isRegisteredForTransactionTermination () const |
| Returns true iff this TransactionUser should be notified when transactions end. | |
| bool | isRegisteredForConnectionTermination () const |
| Returns true iff this TransactionUser should be notified when connections close. | |
| bool | isRegisteredForKeepAlivePongs () const |
| CongestionManager::RejectionBehavior | getRejectionBehavior () const |
| virtual void | setCongestionManager (CongestionManager *manager) |
| virtual UInt16 | getExpectedWait () const |
| virtual bool | responsesMandatory () const |
Protected Types | |
| enum | TransactionTermination { RegisterForTransactionTermination, DoNotRegisterForTransactionTermination } |
| enum | ConnectionTermination { RegisterForConnectionTermination, DoNotRegisterForConnectionTermination } |
| enum | KeepAlivePongs { RegisterForKeepAlivePongs, DoNotRegisterForKeepAlivePongs } |
Protected Member Functions | |
| TransactionUser (TransactionTermination t=DoNotRegisterForTransactionTermination, ConnectionTermination c=DoNotRegisterForConnectionTermination, KeepAlivePongs k=DoNotRegisterForKeepAlivePongs) | |
| Constructor that specifies whether this TransactionUser needs to hear about the completion of transactions, and the closing of connections. | |
| TransactionUser (MessageFilterRuleList &rules, TransactionTermination t=DoNotRegisterForTransactionTermination, ConnectionTermination c=DoNotRegisterForConnectionTermination, KeepAlivePongs k=DoNotRegisterForKeepAlivePongs) | |
| Constructor that specifies the MessageFilterRuleList, whether this TransactionUser needs to hear about the completion of transactions, and the closing of connections. | |
| virtual | ~TransactionUser ()=0 |
| virtual bool | isForMe (const SipMessage &msg) const |
| Returns true iff this TransactionUser should process msg. | |
Protected Attributes | |
| TimeLimitFifo< Message > | mFifo |
| This TransactionUser's fifo. | |
| CongestionManager * | mCongestionManager |
Private Types | |
| typedef std::set< Data > | DomainList |
Private Member Functions | |
| void | postToTransactionUser (Message *msg, TimeLimitFifo< Message >::DepthUsage usage) |
| unsigned int | size () const |
| bool | wouldAccept (TimeLimitFifo< Message >::DepthUsage usage) const |
Private Attributes | |
| MessageFilterRuleList | mRuleList |
| DomainList | mDomainList |
| bool | mRegisteredForTransactionTermination |
| bool | mRegisteredForConnectionTermination |
| bool | mRegisteredForKeepAlivePongs |
Friends | |
| class | TuSelector |
The base-class for an RFC 3261 Transaction User.
This is the "app-layer".
Subclasses of TransactionUser are expected to do the following things:
There is also a collection of things you can do to customize how the stack interacts with your TransactionUser:
Definition at line 48 of file TransactionUser.hxx.
typedef std::set<Data> resip::TransactionUser::DomainList [private] |
Definition at line 231 of file TransactionUser.hxx.
enum resip::TransactionUser::ConnectionTermination [protected] |
Definition at line 160 of file TransactionUser.hxx.
enum resip::TransactionUser::KeepAlivePongs [protected] |
Definition at line 166 of file TransactionUser.hxx.
enum resip::TransactionUser::TransactionTermination [protected] |
Definition at line 154 of file TransactionUser.hxx.
| TransactionUser::TransactionUser | ( | TransactionTermination | t = DoNotRegisterForTransactionTermination, |
| ConnectionTermination | c = DoNotRegisterForConnectionTermination, |
||
| KeepAlivePongs | k = DoNotRegisterForKeepAlivePongs |
||
| ) | [protected] |
Constructor that specifies whether this TransactionUser needs to hear about the completion of transactions, and the closing of connections.
| t | Whether or not the TransactionUser should be informed when transactions end (disabled by default). |
| c | Whether or not the TransactionUser should be informed when connections close (disabled by default). |
Definition at line 10 of file TransactionUser.cxx.
References mFifo, mRuleList, and resip::FifoStatsInterface::setDescription().
: mFifo(0, 0), mCongestionManager(0), mRuleList(), mDomainList(), mRegisteredForTransactionTermination(t == RegisterForTransactionTermination), mRegisteredForConnectionTermination(c == RegisterForConnectionTermination), mRegisteredForKeepAlivePongs(k == RegisterForKeepAlivePongs) { // This creates a default message filter rule, which // handles all sip:, sips:, and tel: requests. mRuleList.push_back(MessageFilterRule()); // Set a default Fifo description - should be modified by override class to be // more desriptive mFifo.setDescription("TransactionUser::mFifo"); }

| TransactionUser::TransactionUser | ( | MessageFilterRuleList & | rules, |
| TransactionTermination | t = DoNotRegisterForTransactionTermination, |
||
| ConnectionTermination | c = DoNotRegisterForConnectionTermination, |
||
| KeepAlivePongs | k = DoNotRegisterForKeepAlivePongs |
||
| ) | [protected] |
Constructor that specifies the MessageFilterRuleList, whether this TransactionUser needs to hear about the completion of transactions, and the closing of connections.
| rules | The MessageFilterRuleList to use. (A copy is made) |
| t | Whether or not the TransactionUser should be informed when transactions end (disabled by default). |
| c | Whether or not the TransactionUser should be informed when connections close (disabled by default). |
Definition at line 30 of file TransactionUser.cxx.
References mFifo, and resip::FifoStatsInterface::setDescription().
: mFifo(0, 0), mCongestionManager(0), mRuleList(mfrl), mDomainList(), mRegisteredForTransactionTermination(t == RegisterForTransactionTermination), mRegisteredForConnectionTermination(c == RegisterForConnectionTermination), mRegisteredForKeepAlivePongs(k == RegisterForKeepAlivePongs) { // Set a default Fifo description - should be modified by override class to be // more desriptive mFifo.setDescription("TransactionUser::mFifo"); }

| TransactionUser::~TransactionUser | ( | ) | [protected, pure virtual] |
Definition at line 47 of file TransactionUser.cxx.
{
}
| void TransactionUser::addDomain | ( | const Data & | domain | ) |
Adds a domain to the set of domains that this TransactionUser is responsible for.
Definition at line 102 of file TransactionUser.cxx.
References mDomainList.
{
// Domain search should be case insensitive - store in lowercase only
mDomainList.insert(Data(domain).lowercase());
}
| EncodeStream & TransactionUser::encode | ( | EncodeStream & | strm | ) | const [virtual] |
Encodes the name of this TransactionUser (as specified by name()), and the current depth of its fifo.
| strm | The ostream to encode to. |
Definition at line 109 of file TransactionUser.cxx.
References mFifo, name(), and resip::AbstractFifo< T >::size().

| virtual UInt16 resip::TransactionUser::getExpectedWait | ( | ) | const [inline, virtual] |
Definition at line 140 of file TransactionUser.hxx.
References resip::AbstractFifo< T >::expectedWaitTimeMilliSec(), and mFifo.
Referenced by resip::TuSelector::getExpectedWait().

| CongestionManager::RejectionBehavior resip::TransactionUser::getRejectionBehavior | ( | ) | const [inline] |
Definition at line 118 of file TransactionUser.hxx.
References resip::CongestionManager::getRejectionBehavior(), mCongestionManager, mFifo, and resip::CongestionManager::NORMAL.
Referenced by resip::TuSelector::getRejectionBehavior().
{
if(mCongestionManager)
{
return mCongestionManager->getRejectionBehavior(&mFifo);
}
return CongestionManager::NORMAL;
}

| bool TransactionUser::isForMe | ( | const SipMessage & | msg | ) | const [protected, virtual] |
Returns true iff this TransactionUser should process msg.
| msg | The SipMessage we received. |
Definition at line 77 of file TransactionUser.cxx.
References resip::Message::brief(), DebugLog, and mRuleList.
{
DebugLog (<< "Checking if " << msg.brief() << " is for me");
// do this for each MessageFilterRule
for (MessageFilterRuleList::const_iterator i = mRuleList.begin() ;
i != mRuleList.end() ; ++i)
{
DebugLog (<< "Checking rule...");
if (i->matches(msg))
{
DebugLog (<< "Match!");
return true;
}
}
DebugLog (<< "No matching rule found");
return false;
}

| bool TransactionUser::isMyDomain | ( | const Data & | domain | ) | const |
Returns true iff domain matches one of the domains that this TransactionUser is responsible for.
(added with addDomain).
| domain | The domain name to check. |
Definition at line 96 of file TransactionUser.cxx.
References mDomainList.
Referenced by resip::MessageFilterRule::hostIsInList().
{
// Domain search should be case insensitive - search in lowercase only
return mDomainList.count(Data(domain).lowercase()) > 0;
}
| bool TransactionUser::isRegisteredForConnectionTermination | ( | ) | const |
Returns true iff this TransactionUser should be notified when connections close.
Definition at line 133 of file TransactionUser.cxx.
References mRegisteredForConnectionTermination.
{
return mRegisteredForConnectionTermination;
}
| bool TransactionUser::isRegisteredForKeepAlivePongs | ( | ) | const |
Definition at line 139 of file TransactionUser.cxx.
References mRegisteredForKeepAlivePongs.
{
return mRegisteredForKeepAlivePongs;
}
| bool TransactionUser::isRegisteredForTransactionTermination | ( | ) | const |
Returns true iff this TransactionUser should be notified when transactions end.
Definition at line 127 of file TransactionUser.cxx.
References mRegisteredForTransactionTermination.
Referenced by resip::TransactionState::terminateClientTransaction(), and resip::TransactionState::terminateServerTransaction().
{
return mRegisteredForTransactionTermination;
}
| virtual const Data& resip::TransactionUser::name | ( | ) | const [pure virtual] |
Return the name of this TransactionUser.
Used in encode().
Referenced by encode().
| void TransactionUser::post | ( | Message * | msg | ) |
Posts a Message to this TransactionUser's fifo.
Ownership of msg is taken.
| msg | The Message to add to mFifo. (This takes ownership of msg) |
Definition at line 52 of file TransactionUser.cxx.
References resip::TimeLimitFifo< Msg >::add(), and mFifo.
Referenced by resip::TuSelector::remove().
{
mFifo.add(msg, TimeLimitFifo<Message>::InternalElement);
}

| void TransactionUser::postToTransactionUser | ( | Message * | msg, |
| TimeLimitFifo< Message >::DepthUsage | usage | ||
| ) | [private] |
Definition at line 58 of file TransactionUser.cxx.
References resip::TimeLimitFifo< Msg >::add(), and mFifo.
Referenced by resip::TuSelector::add().
{
mFifo.add(msg, usage);
//DebugLog (<< "TransactionUser::postToTransactionUser " << msg->brief() << " &=" << &mFifo << " size=" << mFifo.size());
}

| virtual bool resip::TransactionUser::responsesMandatory | ( | ) | const [inline, virtual] |
Definition at line 151 of file TransactionUser.hxx.
Referenced by resip::TransactionState::sendToTU().
{return true;}
| virtual void resip::TransactionUser::setCongestionManager | ( | CongestionManager * | manager | ) | [inline, virtual] |
Definition at line 127 of file TransactionUser.hxx.
References mCongestionManager, mFifo, resip::CongestionManager::registerFifo(), and resip::CongestionManager::unregisterFifo().
{
if(mCongestionManager)
{
mCongestionManager->unregisterFifo(&mFifo);
}
mCongestionManager=manager;
if(mCongestionManager)
{
mCongestionManager->registerFifo(&mFifo);
}
}

| void TransactionUser::setMessageFilterRuleList | ( | MessageFilterRuleList & | rules | ) |
Sets this TransactionUser's MessageFilterRuleList.
This tells the stack which SIP messages this TransactionUser is interested in, and which ones it is not. This allows multiple TransactionUsers to run on top of the same SipStack.
| rules | The MessageFilterRuleList to use. |
Definition at line 116 of file TransactionUser.cxx.
References mRuleList.
| unsigned int TransactionUser::size | ( | ) | const [private] |
Definition at line 65 of file TransactionUser.cxx.
References mFifo, and resip::AbstractFifo< T >::size().

| bool TransactionUser::wouldAccept | ( | TimeLimitFifo< Message >::DepthUsage | usage | ) | const [private] |
Definition at line 71 of file TransactionUser.cxx.
References mFifo, and resip::TimeLimitFifo< Msg >::wouldAccept().
{
return mFifo.wouldAccept(usage);
}

friend class TuSelector [friend] |
Definition at line 236 of file TransactionUser.hxx.
Definition at line 222 of file TransactionUser.hxx.
Referenced by getRejectionBehavior(), and setCongestionManager().
Definition at line 232 of file TransactionUser.hxx.
Referenced by addDomain(), and isMyDomain().
TimeLimitFifo<Message> resip::TransactionUser::mFifo [protected] |
This TransactionUser's fifo.
All communication with the TransactionUser goes through here.
Definition at line 221 of file TransactionUser.hxx.
Referenced by encode(), getExpectedWait(), getRejectionBehavior(), post(), postToTransactionUser(), setCongestionManager(), size(), TransactionUser(), and wouldAccept().
bool resip::TransactionUser::mRegisteredForConnectionTermination [private] |
Definition at line 234 of file TransactionUser.hxx.
Referenced by isRegisteredForConnectionTermination().
bool resip::TransactionUser::mRegisteredForKeepAlivePongs [private] |
Definition at line 235 of file TransactionUser.hxx.
Referenced by isRegisteredForKeepAlivePongs().
bool resip::TransactionUser::mRegisteredForTransactionTermination [private] |
Definition at line 233 of file TransactionUser.hxx.
Referenced by isRegisteredForTransactionTermination().
MessageFilterRuleList resip::TransactionUser::mRuleList [private] |
Definition at line 230 of file TransactionUser.hxx.
Referenced by isForMe(), setMessageFilterRuleList(), and TransactionUser().
1.7.5.1