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

Annotation of /main/resip/dum/SubscriptionHandler.hxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 8176 - (hide annotations) (download)
Fri Aug 1 22:26:06 2008 UTC (11 years, 4 months ago) by jmatthewsr
File MIME type: text/plain
File size: 6152 byte(s)
Add expires logic to SubscriptionHandler to allow validating the inbound expires value against a min and max user setting.  If expires < Min then reject with a 423.  If expires > max then use the max.  Previous functionality is preserved as hasMaxExpires and HasMinExpires are false by default.
1 jason 2727 #if !defined(RESIP_SUBSCRIPTIONHANDLER_HXX)
2     #define RESIP_SUBSCRIPTIONHANDLER_HXX
3    
4 jason 5276 #include "resip/dum/Handles.hxx"
5 derek 5283 #include "resip/stack/Mime.hxx"
6     #include "resip/stack/Contents.hxx"
7 jason 2727
8     namespace resip
9     {
10     class SipMessage;
11 jason 3545 class SecurityAttributes;
12 jason 2727
13     class ClientSubscriptionHandler
14     {
15     public:
16 greg 4768 virtual ~ClientSubscriptionHandler() { }
17    
18 derek 3676 //Client must call acceptUpdate or rejectUpdate for any onUpdateFoo
19 daniel 5767 virtual void onUpdatePending(ClientSubscriptionHandle, const SipMessage& notify, bool outOfOrder)=0;
20     virtual void onUpdateActive(ClientSubscriptionHandle, const SipMessage& notify, bool outOfOrder)=0;
21 derek 3067 //unknown Subscription-State value
22 daniel 5767 virtual void onUpdateExtension(ClientSubscriptionHandle, const SipMessage& notify, bool outOfOrder)=0;
23 derek 3066
24 dlb 4052 virtual int onRequestRetry(ClientSubscriptionHandle, int retrySeconds, const SipMessage& notify)=0;
25    
26 derek 3066 //subscription can be ended through a notify or a failure response.
27     virtual void onTerminated(ClientSubscriptionHandle, const SipMessage& msg)=0;
28     //not sure if this has any value.
29 derek 3570 virtual void onNewSubscription(ClientSubscriptionHandle, const SipMessage& notify)=0;
30 daniel 5505
31     /// called to allow app to adorn a message.
32 jason 5508 virtual void onReadyToSend(ClientSubscriptionHandle, SipMessage& msg);
33 jason 2727 };
34    
35     class ServerSubscriptionHandler
36     {
37 derek 3067 public:
38 greg 4768 virtual ~ServerSubscriptionHandler() {}
39    
40 derek 3058 virtual void onNewSubscription(ServerSubscriptionHandle, const SipMessage& sub)=0;
41 daniel 6126 virtual void onNewSubscriptionFromRefer(ServerSubscriptionHandle, const SipMessage& sub);
42 derek 3450 virtual void onRefresh(ServerSubscriptionHandle, const SipMessage& sub);
43 jason 3545 virtual void onPublished(ServerSubscriptionHandle associated,
44     ServerPublicationHandle publication,
45     const Contents* contents,
46     const SecurityAttributes* attrs);
47 derek 3066
48 derek 3676 virtual void onNotifyRejected(ServerSubscriptionHandle, const SipMessage& msg);
49    
50 derek 3066 //called when this usage is destroyed for any reason. One of the following
51     //three methods will always be called before this, but this is the only
52     //method that MUST be implemented by a handler
53     virtual void onTerminated(ServerSubscriptionHandle)=0;
54    
55 jason 5508 virtual void onReadyToSend(ServerSubscriptionHandle, SipMessage& msg);
56 daniel 5505
57 derek 3676 //will be called when a NOTIFY is not delivered(with a usage terminating
58     //statusCode), or the Dialog is destroyed
59 derek 3067 virtual void onError(ServerSubscriptionHandle, const SipMessage& msg);
60 derek 3066
61 jason 3433 //app can synchronously decorate terminating NOTIFY messages. The only
62 derek 3066 //graceful termination mechanism is expiration, but the client can
63     //explicity end a subscription with an Expires header of 0.
64     virtual void onExpiredByClient(ServerSubscriptionHandle, const SipMessage& sub, SipMessage& notify);
65     virtual void onExpired(ServerSubscriptionHandle, SipMessage& notify);
66 derek 3450
67 jmatthewsr 8176 /** Default behavior is to use the expires value in the SipMessage, if it exists. Then verify the expires >= Min and <= Max (if set). If an expires value does
68     * not exists, use getDefaultExpires(). If hasDefaultExpires() is false, then reject the message with a 400.
69     * Set errorReturnCode to an error code >= 400 to reject this subscription.
70     */
71     virtual void getExpires(const SipMessage &msg, UInt32 &expires, int &errorResponseCode);//ivr mod
72    
73 derek 3450 virtual bool hasDefaultExpires() const;
74 sgodin 6507 virtual UInt32 getDefaultExpires() const;
75 derek 3570
76 jmatthewsr 8176 virtual bool hasMinExpires() const;
77     virtual UInt32 getMinExpires() const;
78    
79     virtual bool hasMaxExpires() const;
80     virtual UInt32 getMaxExpires() const;
81    
82 derek 3570 const Mimes& getSupportedMimeTypes() const;
83 jason 2727 };
84    
85     }
86    
87 derek 3058 #endif
88 jason 4010
89     /* ====================================================================
90     * The Vovida Software License, Version 1.0
91     *
92     * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
93     *
94     * Redistribution and use in source and binary forms, with or without
95     * modification, are permitted provided that the following conditions
96     * are met:
97     *
98     * 1. Redistributions of source code must retain the above copyright
99     * notice, this list of conditions and the following disclaimer.
100     *
101     * 2. Redistributions in binary form must reproduce the above copyright
102     * notice, this list of conditions and the following disclaimer in
103     * the documentation and/or other materials provided with the
104     * distribution.
105     *
106     * 3. The names "VOCAL", "Vovida Open Communication Application Library",
107     * and "Vovida Open Communication Application Library (VOCAL)" must
108     * not be used to endorse or promote products derived from this
109     * software without prior written permission. For written
110     * permission, please contact vocal@vovida.org.
111     *
112     * 4. Products derived from this software may not be called "VOCAL", nor
113     * may "VOCAL" appear in their name, without prior written
114     * permission of Vovida Networks, Inc.
115     *
116     * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
117     * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
118     * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
119     * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
120     * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
121     * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
122     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
123     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
124     * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
125     * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
126     * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
127     * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
128     * DAMAGE.
129     *
130     * ====================================================================
131     *
132     * This software consists of voluntary contributions made by Vovida
133     * Networks, Inc. and many individuals on behalf of Vovida Networks,
134     * Inc. For more information on Vovida Networks, Inc., please see
135     * <http://www.vovida.org/>.
136     *
137     */

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