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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

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