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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 8161 - (show annotations) (download)
Fri Jul 25 20:54:42 2008 UTC (11 years, 4 months ago) by jmatthewsr
File MIME type: text/plain
File size: 5010 byte(s)
Stream performance enhancements for encoding objects.  New encoding code should use 'EncodeStream','resipCerr' and 'resipCout' for encoding any resip objects.  Merge from b-jmatthewsr-streamperf2 -r 8137:8160.  
1 #include "DialogId.hxx"
2 #include "resip/stack/SipMessage.hxx"
3 #include "rutil/Logger.hxx"
4
5 #define RESIPROCATE_SUBSYSTEM Subsystem::DUM
6
7 using namespace resip;
8
9 DialogId::DialogId(const SipMessage& msg) :
10 mDialogSetId(msg),
11 mRemoteTag(Data::Empty)
12 {
13 //find remote tag, which may not exist
14 if (msg.isExternal())
15 {
16 if(msg.isResponse())
17 {
18 if (msg.header(h_To).exists(p_tag))
19 {
20 mRemoteTag = msg.header(h_To).param(p_tag);
21 }
22 }
23 else
24 {
25 if (msg.header(h_From).exists(p_tag))
26 {
27 mRemoteTag = msg.header(h_From).param(p_tag);
28 }
29 }
30 }
31 else
32 {
33 if(msg.isRequest())
34 {
35 //?dcm? -- is this just for 2543? At this point, we will have to have
36 //established a dialog(or else we would just have a dialogset)
37 if (msg.header(h_To).exists(p_tag))
38 {
39 mRemoteTag = msg.header(h_To).param(p_tag);
40 }
41 }
42 else
43 {
44 if (msg.header(h_From).exists(p_tag))
45 {
46 mRemoteTag = msg.header(h_From).param(p_tag);
47 }
48 }
49 }
50 DebugLog ( << "DialogId::DialogId: " << *this);
51 }
52
53 DialogId::DialogId(const Data& callId, const Data& localTag, const Data& remoteTag) :
54 mDialogSetId(callId, localTag),
55 mRemoteTag(remoteTag)
56 {
57 }
58
59 DialogId::DialogId(const DialogSetId& id, const Data& remoteTag) :
60 mDialogSetId(id),
61 mRemoteTag(remoteTag)
62 {
63 DebugLog ( << "DialogId::DialogId: " << *this);
64 }
65
66 bool
67 DialogId::operator==(const DialogId& rhs) const
68 {
69 return mDialogSetId == rhs.mDialogSetId && mRemoteTag == rhs.mRemoteTag;
70 }
71
72 bool
73 DialogId::operator!=(const DialogId& rhs) const
74 {
75 return mDialogSetId != rhs.mDialogSetId || mRemoteTag != rhs.mRemoteTag;
76 }
77
78 bool
79 DialogId::operator<(const DialogId& rhs) const
80 {
81 if (mDialogSetId < rhs.mDialogSetId)
82 {
83 return true;
84 }
85 if (mDialogSetId > rhs.mDialogSetId)
86 {
87 return false;
88 }
89 return mRemoteTag < rhs.mRemoteTag;
90 }
91
92 const DialogSetId&
93 DialogId::getDialogSetId() const
94 {
95 return mDialogSetId;
96 }
97
98 const Data&
99 DialogId::getCallId() const
100 {
101 return getDialogSetId().getCallId();
102 }
103
104 const Data&
105 DialogId::getLocalTag() const
106 {
107 return getDialogSetId().getLocalTag();
108 }
109
110 const Data&
111 DialogId::getRemoteTag() const
112 {
113 return mRemoteTag;
114 }
115
116
117 EncodeStream&
118 resip::operator<<(EncodeStream& os, const DialogId& id)
119 {
120 return os << id.mDialogSetId << "-" << id.mRemoteTag;
121 }
122
123
124 size_t DialogId::hash() const
125 {
126 return mDialogSetId.hash() ^ mRemoteTag.hash();
127 }
128
129 HashValueImp(resip::DialogId, data.hash());
130
131 /* ====================================================================
132 * The Vovida Software License, Version 1.0
133 *
134 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
135 *
136 * Redistribution and use in source and binary forms, with or without
137 * modification, are permitted provided that the following conditions
138 * are met:
139 *
140 * 1. Redistributions of source code must retain the above copyright
141 * notice, this list of conditions and the following disclaimer.
142 *
143 * 2. Redistributions in binary form must reproduce the above copyright
144 * notice, this list of conditions and the following disclaimer in
145 * the documentation and/or other materials provided with the
146 * distribution.
147 *
148 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
149 * and "Vovida Open Communication Application Library (VOCAL)" must
150 * not be used to endorse or promote products derived from this
151 * software without prior written permission. For written
152 * permission, please contact vocal@vovida.org.
153 *
154 * 4. Products derived from this software may not be called "VOCAL", nor
155 * may "VOCAL" appear in their name, without prior written
156 * permission of Vovida Networks, Inc.
157 *
158 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
159 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
160 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
161 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
162 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
163 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
164 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
165 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
166 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
167 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
168 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
169 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
170 * DAMAGE.
171 *
172 * ====================================================================
173 *
174 * This software consists of voluntary contributions made by Vovida
175 * Networks, Inc. and many individuals on behalf of Vovida Networks,
176 * Inc. For more information on Vovida Networks, Inc., please see
177 * <http://www.vovida.org/>.
178 *
179 */

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