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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 8478 - (show annotations) (download)
Wed May 6 20:50:59 2009 UTC (10 years, 7 months ago) by bcampen
File MIME type: text/plain
File size: 6218 byte(s)
Fixing ClientSubscription's reaction (or rather lack thereof) when the server never sends a NOTIFY.

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

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