/[resiprocate]/main/sip/resiprocate/TransactionUser.cxx
ViewVC logotype

Annotation of /main/sip/resiprocate/TransactionUser.cxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4376 - (hide annotations) (download)
Sat Apr 16 02:30:10 2005 UTC (14 years, 9 months ago) by jason
File size: 4556 byte(s)
fix shutdown logic for dum as TransactionUser

1 jason 4335 #include "resiprocate/TransactionUser.hxx"
2     #include "resiprocate/MessageFilterRule.hxx"
3     #include "resiprocate/os/Logger.hxx"
4 jason 4145
5 jason 4335 #define RESIPROCATE_SUBSYSTEM resip::Subsystem::TRANSACTION
6    
7 jason 4147 using namespace resip;
8    
9 jason 4376 TransactionUser::TransactionUser()
10     : mFifo(0, 0)
11 jason 4145 {
12 jason 4335 // This creates a default message filter rule, which
13     // handles all sip: and sips: requests.
14     mRuleList.push_back(MessageFilterRule());
15 jason 4145 }
16    
17 jason 4335 TransactionUser::TransactionUser(MessageFilterRuleList &mfrl)
18 jason 4376 : mFifo(0, 0),
19     mRuleList(mfrl)
20 jason 4335 {
21     }
22    
23 jason 4145 TransactionUser::~TransactionUser()
24     {
25     }
26    
27     void
28 derek 4171 TransactionUser::post(Message* msg)
29     {
30     mFifo.add(msg, TimeLimitFifo<Message>::InternalElement);
31     }
32    
33     void
34 jason 4145 TransactionUser::postToTransactionUser(Message* msg, TimeLimitFifo<Message>::DepthUsage usage)
35     {
36     mFifo.add(msg, usage);
37 jason 4335 //DebugLog (<< "TransactionUser::postToTransactionUser " << msg->brief() << " &=" << &mFifo << " size=" << mFifo.size());
38 jason 4145 }
39    
40 jason 4147 unsigned int
41     TransactionUser::size() const
42 jason 4145 {
43     return mFifo.size();
44     }
45    
46     bool
47     TransactionUser::wouldAccept(TimeLimitFifo<Message>::DepthUsage usage) const
48     {
49     return mFifo.wouldAccept(usage);
50     }
51    
52 jason 4335 bool
53     TransactionUser::isForMe(const SipMessage& msg) const
54     {
55     DebugLog (<< "Checking if " << msg.brief() << " is for me");
56     // do this for each MessageFilterRule
57     for (MessageFilterRuleList::const_iterator i = mRuleList.begin() ;
58     i != mRuleList.end() ; ++i)
59     {
60     DebugLog (<< "Checking rule...");
61     if (i->matches(msg))
62     {
63     DebugLog (<< "Match!");
64     return true;
65     }
66     }
67     DebugLog (<< "No matching rule found");
68     return false;
69     }
70    
71     bool
72     TransactionUser::isMyDomain(const Data& domain) const
73     {
74 jason 4376 return mDomainList.count(domain);
75 jason 4335 }
76    
77     void TransactionUser::addDomain(const Data& domain)
78     {
79 jason 4376 mDomainList.insert(domain);
80 jason 4335 }
81    
82     std::ostream&
83     TransactionUser::encode(std::ostream& strm) const
84     {
85     strm << "TU: " << name() << " size=" << mFifo.size();
86     return strm;
87     }
88    
89     void
90     TransactionUser::setMessageFilterRuleList(MessageFilterRuleList &rules)
91     {
92     mRuleList = rules;
93     }
94    
95     std::ostream&
96     resip::operator<<(std::ostream& strm, const resip::TransactionUser& tu)
97     {
98     tu.encode(strm);
99     return strm;
100     }
101    
102     /* ====================================================================
103     * The Vovida Software License, Version 1.0
104     *
105     * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
106     *
107     * Redistribution and use in source and binary forms, with or without
108     * modification, are permitted provided that the following conditions
109     * are met:
110     *
111     * 1. Redistributions of source code must retain the above copyright
112     * notice, this list of conditions and the following disclaimer.
113     *
114     * 2. Redistributions in binary form must reproduce the above copyright
115     * notice, this list of conditions and the following disclaimer in
116     * the documentation and/or other materials provided with the
117     * distribution.
118     *
119     * 3. The names "VOCAL", "Vovida Open Communication Application Library",
120     * and "Vovida Open Communication Application Library (VOCAL)" must
121     * not be used to endorse or promote products derived from this
122     * software without prior written permission. For written
123     * permission, please contact vocal@vovida.org.
124     *
125     * 4. Products derived from this software may not be called "VOCAL", nor
126     * may "VOCAL" appear in their name, without prior written
127     * permission of Vovida Networks, Inc.
128     *
129     * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
130     * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
131     * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
132     * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
133     * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
134     * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
135     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
136     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
137     * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
138     * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
139     * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
140     * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
141     * DAMAGE.
142     *
143     * ====================================================================
144     *
145     * This software consists of voluntary contributions made by Vovida
146     * Networks, Inc. and many individuals on behalf of Vovida Networks,
147     * Inc. For more information on Vovida Networks, Inc., please see
148     * <http://www.vovida.org/>.
149     *
150     */

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27