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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 8925 - (show annotations) (download)
Thu Dec 23 20:51:34 2010 UTC (8 years, 10 months ago) by kwhite
File MIME type: text/plain
File size: 4209 byte(s)
dum static code analysis fixes

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

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