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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

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 bcampen 8478 virtual void onTerminated(ClientSubscriptionHandle, const SipMessage* msg)=0;
28 derek 3066 //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 bcampen 8478 virtual void onNotifyNotReceived(ClientSubscriptionHandle);
34 sgodin 9033
35     /// Called when a TCP or TLS flow to the server has terminated. This can be caused by socket
36     /// errors, or missing CRLF keep alives pong responses from the server.
37     // Called only if clientOutbound is enabled on the UserProfile and the first hop server
38     /// supports RFC5626 (outbound).
39     /// Default implementation is to re-form the subscription using a new flow
40     virtual void onFlowTerminated(ClientSubscriptionHandle);
41 jason 2727 };
42    
43     class ServerSubscriptionHandler
44     {
45 derek 3067 public:
46 greg 4768 virtual ~ServerSubscriptionHandler() {}
47    
48 derek 3058 virtual void onNewSubscription(ServerSubscriptionHandle, const SipMessage& sub)=0;
49 daniel 6126 virtual void onNewSubscriptionFromRefer(ServerSubscriptionHandle, const SipMessage& sub);
50 derek 3450 virtual void onRefresh(ServerSubscriptionHandle, const SipMessage& sub);
51 jason 3545 virtual void onPublished(ServerSubscriptionHandle associated,
52     ServerPublicationHandle publication,
53     const Contents* contents,
54     const SecurityAttributes* attrs);
55 derek 3066
56 fjoanis 10126 virtual void onNotifyAccepted(ServerSubscriptionHandle, const SipMessage& msg);
57 derek 3676 virtual void onNotifyRejected(ServerSubscriptionHandle, const SipMessage& msg);
58    
59 derek 3066 //called when this usage is destroyed for any reason. One of the following
60     //three methods will always be called before this, but this is the only
61     //method that MUST be implemented by a handler
62     virtual void onTerminated(ServerSubscriptionHandle)=0;
63    
64 jason 5508 virtual void onReadyToSend(ServerSubscriptionHandle, SipMessage& msg);
65 daniel 5505
66 derek 3676 //will be called when a NOTIFY is not delivered(with a usage terminating
67     //statusCode), or the Dialog is destroyed
68 derek 3067 virtual void onError(ServerSubscriptionHandle, const SipMessage& msg);
69 derek 3066
70 jason 3433 //app can synchronously decorate terminating NOTIFY messages. The only
71 derek 3066 //graceful termination mechanism is expiration, but the client can
72     //explicity end a subscription with an Expires header of 0.
73     virtual void onExpiredByClient(ServerSubscriptionHandle, const SipMessage& sub, SipMessage& notify);
74     virtual void onExpired(ServerSubscriptionHandle, SipMessage& notify);
75 derek 3450
76 sgodin 9033 /// Called when a TCP or TLS flow to the server has terminated. This can be caused by socket
77     /// errors, or missing CRLF keep alives pong responses from the server.
78     // Called only if clientOutbound is enabled on the UserProfile and the first hop server
79     /// supports RFC5626 (outbound).
80     /// Default implementation is to tear down the subscription
81     virtual void onFlowTerminated(ServerSubscriptionHandle);
82 jmatthewsr 8176
83 sgodin 9033 /** 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
84     * not exists, use getDefaultExpires(). If hasDefaultExpires() is false, then reject the message with a 400.
85     * Set errorReturnCode to an error code >= 400 to reject this subscription.
86     */
87     virtual void getExpires(const SipMessage &msg, UInt32 &expires, int &errorResponseCode);//ivr mod
88    
89 derek 3450 virtual bool hasDefaultExpires() const;
90 sgodin 6507 virtual UInt32 getDefaultExpires() const;
91 derek 3570
92 sgodin 9033 virtual bool hasMinExpires() const;
93     virtual UInt32 getMinExpires() const;
94 jmatthewsr 8176
95 sgodin 9033 virtual bool hasMaxExpires() const;
96     virtual UInt32 getMaxExpires() const;
97 jmatthewsr 8176
98 derek 3570 const Mimes& getSupportedMimeTypes() const;
99 jason 2727 };
100    
101     }
102    
103 derek 3058 #endif
104 jason 4010
105     /* ====================================================================
106     * The Vovida Software License, Version 1.0
107     *
108     * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
109     *
110     * Redistribution and use in source and binary forms, with or without
111     * modification, are permitted provided that the following conditions
112     * are met:
113     *
114     * 1. Redistributions of source code must retain the above copyright
115     * notice, this list of conditions and the following disclaimer.
116     *
117     * 2. Redistributions in binary form must reproduce the above copyright
118     * notice, this list of conditions and the following disclaimer in
119     * the documentation and/or other materials provided with the
120     * distribution.
121     *
122     * 3. The names "VOCAL", "Vovida Open Communication Application Library",
123     * and "Vovida Open Communication Application Library (VOCAL)" must
124     * not be used to endorse or promote products derived from this
125     * software without prior written permission. For written
126     * permission, please contact vocal@vovida.org.
127     *
128     * 4. Products derived from this software may not be called "VOCAL", nor
129     * may "VOCAL" appear in their name, without prior written
130     * permission of Vovida Networks, Inc.
131     *
132     * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
133     * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
134     * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
135     * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
136     * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
137     * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
138     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
139     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
140     * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
141     * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
142     * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
143     * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
144     * DAMAGE.
145     *
146     * ====================================================================
147     *
148     * This software consists of voluntary contributions made by Vovida
149     * Networks, Inc. and many individuals on behalf of Vovida Networks,
150     * Inc. For more information on Vovida Networks, Inc., please see
151     * <http://www.vovida.org/>.
152     *
153     */

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