reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
SubscriptionHandler.cxx
Go to the documentation of this file.
5#include "rutil/Logger.hxx"
6
7#define RESIPROCATE_SUBSYSTEM Subsystem::DUM
8
9using namespace resip;
10
11static Mimes empty;
12
13void
15{
16 // default is to do nothing. this is for adornment
17}
18
19void
21{
22 // By default, tear down the sub.
23 h->end();
24}
25
26void
28{
29 // re-Subscribe
30 InfoLog(<< "ClientSubscriptionHandler::onFlowTerminated");
31 h->reSubscribe();
32}
33
34const Mimes&
39
40void
44
45void
49
50void
54
56bool
58{
59 return false;
60}
61
67
68bool
70{
71 return false;
72}
73
76{
77 return 0;
78}
79bool
81{
82 return false;
83}
84
87{
88 return 0;
89}
90
91void
92ServerSubscriptionHandler::getExpires(const SipMessage &msg, uint32_t &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
120void
122{
123 handle->send(handle->accept(200));
124 handle->send(handle->neutralNotify());
125}
126
127void
129 ServerPublicationHandle publication,
130 const Contents* contents,
131 const SecurityAttributes* attrs)
132{
133 // do nothing by default
134}
135
136void
140
141void
145
146void
148{
149 // default is to do nothing. this is for adornment
150}
151
152void
156
157void
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 */
#define InfoLog(args_)
Definition Logger.hxx:131
static Mimes empty
virtual void onFlowTerminated(ClientSubscriptionHandle)
Called when a TCP or TLS flow to the server has terminated.
virtual void onReadyToSend(ClientSubscriptionHandle, SipMessage &msg)
called to allow app to adorn a message.
virtual void onNotifyNotReceived(ClientSubscriptionHandle)
Base class for all SIP body types.
Definition Contents.hxx:51
virtual void onFlowTerminated(ServerSubscriptionHandle)
Called when a TCP or TLS flow to the server has terminated.
virtual void onExpiredByClient(ServerSubscriptionHandle, const SipMessage &sub, SipMessage &notify)
virtual void onNewSubscriptionFromRefer(ServerSubscriptionHandle, const SipMessage &sub)
virtual void onRefresh(ServerSubscriptionHandle, const SipMessage &sub)
virtual void onNotifyAccepted(ServerSubscriptionHandle, const SipMessage &msg)
virtual void onExpired(ServerSubscriptionHandle, SipMessage &notify)
virtual uint32_t getMinExpires() const
virtual void onNotifyRejected(ServerSubscriptionHandle, const SipMessage &msg)
virtual void onError(ServerSubscriptionHandle, const SipMessage &msg)
const Mimes & getSupportedMimeTypes() const
virtual bool hasDefaultExpires() const
dcm! – a bit clunky, but really want these objects to not have state
virtual void onReadyToSend(ServerSubscriptionHandle, SipMessage &msg)
virtual uint32_t getMaxExpires() const
virtual void onPublished(ServerSubscriptionHandle associated, ServerPublicationHandle publication, const Contents *contents, const SecurityAttributes *attrs)
virtual uint32_t getDefaultExpires() const
virtual void getExpires(const SipMessage &msg, uint32_t &expires, int &errorResponseCode)
Default behavior is to use the expires value in the SipMessage, if it exists.
std::shared_ptr< SipMessage > neutralNotify()
void end(TerminateReason reason, const Contents *document=0, int retryAfter=0)
std::shared_ptr< SipMessage > accept(int statusCode=202)
void send(std::shared_ptr< SipMessage > msg) override
Represents a SIP message.
const RequestLine & header(const RequestLineType &l) const
Returns the RequestLine. This is only valid for request messages.
bool exists(const HeaderBase &headerType) const
Returns true if the given header field is present, false otherwise.
dcm! – add UnusedChecking(_enum) below;
unsigned int uint32_t
Definition Stun.hxx:34