reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
TransactionUser.hxx
Go to the documentation of this file.
1#if !defined(RESIP_TU_HXX)
2#define RESIP_TU_HXX
3
4#include <iosfwd>
5#include <set>
7#include "rutil/Data.hxx"
12
13#include <memory>
14
15namespace resip
16{
17class SipMessage;
18
51{
52 public:
58 void post(Message* msg);
59
68 bool isMyDomain(const Data& domain) const;
69
85 void addDomain(const Data& domain);
86
100 void removeDomain(const Data& domain);
101
105 void setDomainMatcher(std::shared_ptr<DomainMatcher> domainMatcher) noexcept;
106
111 virtual const Data& name() const=0;
112
119 virtual EncodeStream& encode(EncodeStream& strm) const;
120
132
139
147
156
158 {
160 {
162 }
163 mCongestionManager=manager;
165 {
167 }
168 }
169
170 const TimeLimitFifo<Message>* getFifo() { return(&mFifo); } const
171
172 virtual uint16_t getExpectedWait() const
173 {
174 return (uint16_t)mFifo.expectedWaitTimeMilliSec();
175 }
176
177 // .bwc. This specifies whether the TU can cope with dropped responses
178 // (due to congestion). Some TUs may need responses to clean up state,
179 // while others may rely on TransactionTerminated messages. Those that
180 // rely on TransactionTerminated messages will be able to return false
181 // here, meaning that in dire congestion situations, the stack will drop
182 // responses bound for the TU.
183 virtual bool responsesMandatory() const {return true;}
184
185 protected:
191
197
203
220
237
238 virtual ~TransactionUser()=0;
239
247 virtual bool isForMe(const SipMessage& msg) const;
248
255
256 private:
257 void postToTransactionUser(Message* msg, TimeLimitFifo<Message>::DepthUsage usage);
258 unsigned int size() const;
259 bool wouldAccept(TimeLimitFifo<Message>::DepthUsage usage) const;
260
261 private:
262 MessageFilterRuleList mRuleList;
263 std::shared_ptr<DomainMatcher> mDomainMatcher;
264 bool mRegisteredForTransactionTermination;
265 bool mRegisteredForConnectionTermination;
266 bool mRegisteredForKeepAlivePongs;
267 friend class TuSelector;
268};
269
272
273}
274
275#endif
276
277/* ====================================================================
278 * The Vovida Software License, Version 1.0
279 *
280 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
281 *
282 * Redistribution and use in source and binary forms, with or without
283 * modification, are permitted provided that the following conditions
284 * are met:
285 *
286 * 1. Redistributions of source code must retain the above copyright
287 * notice, this list of conditions and the following disclaimer.
288 *
289 * 2. Redistributions in binary form must reproduce the above copyright
290 * notice, this list of conditions and the following disclaimer in
291 * the documentation and/or other materials provided with the
292 * distribution.
293 *
294 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
295 * and "Vovida Open Communication Application Library (VOCAL)" must
296 * not be used to endorse or promote products derived from this
297 * software without prior written permission. For written
298 * permission, please contact vocal@vovida.org.
299 *
300 * 4. Products derived from this software may not be called "VOCAL", nor
301 * may "VOCAL" appear in their name, without prior written
302 * permission of Vovida Networks, Inc.
303 *
304 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
305 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
306 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
307 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
308 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
309 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
310 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
311 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
312 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
313 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
314 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
315 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
316 * DAMAGE.
317 *
318 * ====================================================================
319 *
320 * This software consists of voluntary contributions made by Vovida
321 * Networks, Inc. and many individuals on behalf of Vovida Networks,
322 * Inc. For more information on Vovida Networks, Inc., please see
323 * <http://www.vovida.org/>.
324 *
325 */
static void usage(void)
Definition adig.c:755
Abstract base class that provides a basic congestion management interface.
virtual void unregisterFifo(resip::FifoStatsInterface *fifo)=0
Unregisters a fifo with the congestion manager.
virtual RejectionBehavior getRejectionBehavior(const FifoStatsInterface *fifo) const =0
Return the current rejection behavior for this fifo.
virtual void registerFifo(resip::FifoStatsInterface *fifo)=0
Registers a fifo with the congestion manager.
@ NORMAL
Not rejecting any work.
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
The base-class used for message-passing.
Definition Message.hxx:21
Represents a SIP message.
The base-class for an RFC 3261 Transaction User.
TimeLimitFifo< Message > mFifo
This TransactionUser's fifo.
void setMessageFilterRuleList(MessageFilterRuleList &rules)
Sets this TransactionUser's MessageFilterRuleList.
bool isRegisteredForConnectionTermination() const
virtual const uint16_t getExpectedWait() const
virtual bool isForMe(const SipMessage &msg) const
Returns true iff this TransactionUser should process msg.
CongestionManager * mCongestionManager
void addDomain(const Data &domain)
Adds a domain to the set of domains that this TransactionUser is responsible for.
bool isMyDomain(const Data &domain) const
Returns true iff domain matches one of the domains that this TransactionUser is responsible for.
const TimeLimitFifo< Message > * getFifo()
virtual const Data & name() const =0
Return the name of this TransactionUser.
void post(Message *msg)
Posts a Message to this TransactionUser's fifo.
virtual EncodeStream & encode(EncodeStream &strm) const
Encodes the name of this TransactionUser (as specified by name()), and the current depth of its fifo.
void removeDomain(const Data &domain)
Removes a domain from the set of domains that this TransactionUser is responsible for.
void setDomainMatcher(std::shared_ptr< DomainMatcher > domainMatcher) noexcept
Replaces the default DomainMatcher.
virtual void setCongestionManager(CongestionManager *manager)
CongestionManager::RejectionBehavior getRejectionBehavior() const
bool isRegisteredForTransactionTermination() const
bool isRegisteredForKeepAlivePongs() const
virtual bool responsesMandatory() const
dcm! – add UnusedChecking(_enum) below;
std::vector< MessageFilterRule > MessageFilterRuleList
unsigned short uint16_t
Definition Stun.hxx:30
EncodeStream & operator<<(EncodeStream &strm, const BaseException &e)
#define EncodeStream
void list()
Definition userAdmin.cxx:66