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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 10126 - (show annotations) (download)
Thu Apr 11 13:49:29 2013 UTC (6 years, 7 months ago) by fjoanis
File MIME type: text/plain
File size: 5905 byte(s)
Added ServerSubscriptionHandler::onNotifyAccepted callback.

1 #include "resip/dum/SubscriptionHandler.hxx"
2 #include "resip/dum/ServerSubscription.hxx"
3 #include "resip/dum/ClientSubscription.hxx"
4 #include "resip/stack/SecurityAttributes.hxx"
5 #include "rutil/Logger.hxx"
6
7 #define RESIPROCATE_SUBSYSTEM Subsystem::DUM
8
9 using namespace resip;
10
11 static Mimes empty;
12
13 void
14 ClientSubscriptionHandler::onReadyToSend(ClientSubscriptionHandle h, SipMessage& msg)
15 {
16 // default is to do nothing. this is for adornment
17 }
18
19 void
20 ClientSubscriptionHandler::onNotifyNotReceived(ClientSubscriptionHandle h)
21 {
22 // By default, tear down the sub.
23 h->end();
24 }
25
26 void
27 ClientSubscriptionHandler::onFlowTerminated(ClientSubscriptionHandle h)
28 {
29 // re-Subscribe
30 InfoLog(<< "ClientSubscriptionHandler::onFlowTerminated");
31 h->reSubscribe();
32 }
33
34 const Mimes&
35 ServerSubscriptionHandler::getSupportedMimeTypes() const
36 {
37 return empty;
38 }
39
40 void
41 ServerSubscriptionHandler::onError(ServerSubscriptionHandle, const SipMessage& msg)
42 {
43 }
44
45 void
46 ServerSubscriptionHandler::onExpiredByClient(ServerSubscriptionHandle, const SipMessage& sub, SipMessage& notify)
47 {
48 }
49
50 void
51 ServerSubscriptionHandler::onExpired(ServerSubscriptionHandle, SipMessage& notify)
52 {
53 }
54
55 //!dcm! -- a bit clunky, but really want these objects to not have state
56 bool
57 ServerSubscriptionHandler::hasDefaultExpires() const
58 {
59 return false;
60 }
61
62 UInt32
63 ServerSubscriptionHandler::getDefaultExpires() const
64 {
65 return 0;
66 }
67
68 bool
69 ServerSubscriptionHandler::hasMinExpires() const
70 {
71 return false;
72 }
73
74 UInt32
75 ServerSubscriptionHandler::getMinExpires() const
76 {
77 return 0;
78 }
79 bool
80 ServerSubscriptionHandler::hasMaxExpires() const
81 {
82 return false;
83 }
84
85 UInt32
86 ServerSubscriptionHandler::getMaxExpires() const
87 {
88 return 0;
89 }
90
91 void
92 ServerSubscriptionHandler::getExpires(const SipMessage &msg, UInt32 &expires, int &errorResponseCode)
93 {
94 if (msg.exists(h_Expires))
95 {
96 expires = msg.header(h_Expires).value();
97
98 if (expires > 0)
99 {
100 if (hasMinExpires() && (expires < getMinExpires()))
101 {
102 errorResponseCode = 423;
103 }
104 else if (hasMaxExpires() && (expires > getMaxExpires()))
105 {
106 expires = getMaxExpires();
107 }
108 }
109 }
110 else if (hasDefaultExpires())
111 {
112 expires = getDefaultExpires();
113 }
114 else
115 {
116 errorResponseCode = 400;
117 }
118 }
119
120 void
121 ServerSubscriptionHandler::onRefresh(ServerSubscriptionHandle handle, const SipMessage& sub)
122 {
123 handle->send(handle->accept(200));
124 handle->send(handle->neutralNotify());
125 }
126
127 void
128 ServerSubscriptionHandler::onPublished(ServerSubscriptionHandle associated,
129 ServerPublicationHandle publication,
130 const Contents* contents,
131 const SecurityAttributes* attrs)
132 {
133 // do nothing by default
134 }
135
136 void
137 ServerSubscriptionHandler::onNotifyAccepted(ServerSubscriptionHandle h, const SipMessage& msg)
138 {
139 }
140
141 void
142 ServerSubscriptionHandler::onNotifyRejected(ServerSubscriptionHandle h, const SipMessage& msg)
143 {
144 }
145
146 void
147 ServerSubscriptionHandler::onReadyToSend(ServerSubscriptionHandle h, SipMessage& msg)
148 {
149 // default is to do nothing. this is for adornment
150 }
151
152 void
153 ServerSubscriptionHandler::onNewSubscriptionFromRefer(ServerSubscriptionHandle, const SipMessage& sub)
154 {
155 }
156
157 void
158 ServerSubscriptionHandler::onFlowTerminated(ServerSubscriptionHandle h)
159 {
160 InfoLog(<< "ServerSubscriptionHandler::onFlowTerminated");
161 // By default, tear down the sub.
162 h->end();
163 }
164
165
166
167 /* ====================================================================
168 * The Vovida Software License, Version 1.0
169 *
170 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
171 *
172 * Redistribution and use in source and binary forms, with or without
173 * modification, are permitted provided that the following conditions
174 * are met:
175 *
176 * 1. Redistributions of source code must retain the above copyright
177 * notice, this list of conditions and the following disclaimer.
178 *
179 * 2. Redistributions in binary form must reproduce the above copyright
180 * notice, this list of conditions and the following disclaimer in
181 * the documentation and/or other materials provided with the
182 * distribution.
183 *
184 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
185 * and "Vovida Open Communication Application Library (VOCAL)" must
186 * not be used to endorse or promote products derived from this
187 * software without prior written permission. For written
188 * permission, please contact vocal@vovida.org.
189 *
190 * 4. Products derived from this software may not be called "VOCAL", nor
191 * may "VOCAL" appear in their name, without prior written
192 * permission of Vovida Networks, Inc.
193 *
194 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
195 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
196 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
197 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
198 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
199 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
200 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
201 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
202 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
203 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
204 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
205 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
206 * DAMAGE.
207 *
208 * ====================================================================
209 *
210 * This software consists of voluntary contributions made by Vovida
211 * Networks, Inc. and many individuals on behalf of Vovida Networks,
212 * Inc. For more information on Vovida Networks, Inc., please see
213 * <http://www.vovida.org/>.
214 *
215 */

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