/[resiprocate]/main/resip/dum/MergedRequestKey.cxx
ViewVC logotype

Contents of /main/resip/dum/MergedRequestKey.cxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 7207 - (show annotations) (download)
Thu Jul 12 19:16:09 2007 UTC (12 years, 4 months ago) by lowekamp
File MIME type: text/plain
File size: 4091 byte(s)
default constructor left mCheckRequestUri uninitialized, causing valgrind to complain when operator== was called.  

Thanks to Tiffany Broadbent for tracking this down.

1 #include "resip/dum/MergedRequestKey.hxx"
2 #include "resip/stack/SipMessage.hxx"
3 #include "resip/stack/CSeqCategory.hxx"
4
5 using namespace resip;
6
7 const MergedRequestKey MergedRequestKey::Empty;
8
9 MergedRequestKey::MergedRequestKey():
10 mCheckRequestUri(true)
11 {
12 }
13
14 MergedRequestKey::MergedRequestKey(const SipMessage& req, bool checkRequestUri) :
15 mRequestUri(Data::from(req.header(h_RequestLine).uri())),
16 mCSeq(Data::from(req.header(h_CSeq))),
17 mTag(req.header(h_From).exists(p_tag) ? req.header(h_From).param(p_tag) : Data::Empty),
18 mCallId(req.header(h_CallID).value()),
19 mCheckRequestUri(checkRequestUri)
20 {
21 }
22
23 bool
24 MergedRequestKey::operator==(const MergedRequestKey& other) const
25 {
26 return (mCallId == other.mCallId &&
27 mTag == other.mTag &&
28 mCSeq == other.mCSeq &&
29 (!mCheckRequestUri || (mRequestUri == other.mRequestUri)));
30 }
31
32 bool
33 MergedRequestKey::operator!=(const MergedRequestKey& other) const
34 {
35 return !(*this == other);
36 }
37
38 bool
39 MergedRequestKey::operator<(const MergedRequestKey& other) const
40 {
41 if ( mCallId < other.mCallId)
42 {
43 return true;
44 }
45 else if (mCallId > other.mCallId)
46 {
47 return false;
48 }
49
50 if (mTag < other.mTag)
51 {
52 return true;
53 }
54 else if (mTag > other.mTag)
55 {
56 return false;
57 }
58
59 if(!mCheckRequestUri)
60 {
61 return (mCSeq < other.mCSeq);
62 }
63 else
64 {
65 if (mCSeq < other.mCSeq)
66 {
67 return true;
68 }
69 else if (mCSeq > other.mCSeq)
70 {
71 return false;
72 }
73
74 return (mRequestUri < other.mRequestUri);
75 }
76 }
77
78 Data& MergedRequestKey::cseq()
79 {
80 return mCSeq;
81 }
82
83 const Data& MergedRequestKey::cseq() const
84 {
85 return mCSeq;
86 }
87
88
89 /* ====================================================================
90 * The Vovida Software License, Version 1.0
91 *
92 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
93 *
94 * Redistribution and use in source and binary forms, with or without
95 * modification, are permitted provided that the following conditions
96 * are met:
97 *
98 * 1. Redistributions of source code must retain the above copyright
99 * notice, this list of conditions and the following disclaimer.
100 *
101 * 2. Redistributions in binary form must reproduce the above copyright
102 * notice, this list of conditions and the following disclaimer in
103 * the documentation and/or other materials provided with the
104 * distribution.
105 *
106 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
107 * and "Vovida Open Communication Application Library (VOCAL)" must
108 * not be used to endorse or promote products derived from this
109 * software without prior written permission. For written
110 * permission, please contact vocal@vovida.org.
111 *
112 * 4. Products derived from this software may not be called "VOCAL", nor
113 * may "VOCAL" appear in their name, without prior written
114 * permission of Vovida Networks, Inc.
115 *
116 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
117 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
118 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
119 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
120 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
121 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
122 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
123 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
124 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
125 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
126 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
127 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
128 * DAMAGE.
129 *
130 * ====================================================================
131 *
132 * This software consists of voluntary contributions made by Vovida
133 * Networks, Inc. and many individuals on behalf of Vovida Networks,
134 * Inc. For more information on Vovida Networks, Inc., please see
135 * <http://www.vovida.org/>.
136 *
137 */

Properties

Name Value
svn:eol-style native
svn:mime-type text/plain

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27