reSIProcate/DialogUsageManager  9694
SubscriptionHandler.hxx
Go to the documentation of this file.
00001 #if !defined(RESIP_SUBSCRIPTIONHANDLER_HXX)
00002 #define RESIP_SUBSCRIPTIONHANDLER_HXX
00003 
00004 #include "resip/dum/Handles.hxx"
00005 #include "resip/stack/Mime.hxx"
00006 #include "resip/stack/Contents.hxx"
00007 
00008 namespace resip
00009 {
00010 class SipMessage;
00011 class SecurityAttributes;
00012 
00013 class ClientSubscriptionHandler
00014 {
00015   public:
00016       virtual ~ClientSubscriptionHandler() { }
00017 
00018       //Client must call acceptUpdate or rejectUpdate for any onUpdateFoo
00019       virtual void onUpdatePending(ClientSubscriptionHandle, const SipMessage& notify, bool outOfOrder)=0;
00020       virtual void onUpdateActive(ClientSubscriptionHandle, const SipMessage& notify, bool outOfOrder)=0;
00021       //unknown Subscription-State value
00022       virtual void onUpdateExtension(ClientSubscriptionHandle, const SipMessage& notify, bool outOfOrder)=0;
00023 
00024       virtual int onRequestRetry(ClientSubscriptionHandle, int retrySeconds, const SipMessage& notify)=0;
00025       
00026       //subscription can be ended through a notify or a failure response.
00027       virtual void onTerminated(ClientSubscriptionHandle, const SipMessage* msg)=0;   
00028       //not sure if this has any value.
00029       virtual void onNewSubscription(ClientSubscriptionHandle, const SipMessage& notify)=0;
00030 
00032       virtual void onReadyToSend(ClientSubscriptionHandle, SipMessage& msg);
00033       virtual void onNotifyNotReceived(ClientSubscriptionHandle);
00034 
00037       //  Called only if clientOutbound is enabled on the UserProfile and the first hop server 
00040       virtual void onFlowTerminated(ClientSubscriptionHandle);
00041 };
00042 
00043 class ServerSubscriptionHandler
00044 {
00045   public:   
00046       virtual ~ServerSubscriptionHandler() {}
00047 
00048       virtual void onNewSubscription(ServerSubscriptionHandle, const SipMessage& sub)=0;
00049       virtual void onNewSubscriptionFromRefer(ServerSubscriptionHandle, const SipMessage& sub);
00050       virtual void onRefresh(ServerSubscriptionHandle, const SipMessage& sub);
00051       virtual void onPublished(ServerSubscriptionHandle associated, 
00052                                ServerPublicationHandle publication, 
00053                                const Contents* contents,
00054                                const SecurityAttributes* attrs);
00055 
00056       virtual void onNotifyRejected(ServerSubscriptionHandle, const SipMessage& msg);      
00057 
00058       //called when this usage is destroyed for any reason. One of the following
00059       //three methods will always be called before this, but this is the only
00060       //method that MUST be implemented by a handler
00061       virtual void onTerminated(ServerSubscriptionHandle)=0;
00062 
00063       virtual void onReadyToSend(ServerSubscriptionHandle, SipMessage& msg);
00064 
00065       //will be called when a NOTIFY is not delivered(with a usage terminating
00066       //statusCode), or the Dialog is destroyed
00067       virtual void onError(ServerSubscriptionHandle, const SipMessage& msg);      
00068 
00069       //app can synchronously decorate terminating NOTIFY messages. The only
00070       //graceful termination mechanism is expiration, but the client can
00071       //explicity end a subscription with an Expires header of 0.
00072       virtual void onExpiredByClient(ServerSubscriptionHandle, const SipMessage& sub, SipMessage& notify);
00073       virtual void onExpired(ServerSubscriptionHandle, SipMessage& notify);
00074 
00077       //  Called only if clientOutbound is enabled on the UserProfile and the first hop server 
00080       virtual void onFlowTerminated(ServerSubscriptionHandle);
00081 
00086       virtual void getExpires(const SipMessage &msg, UInt32 &expires, int &errorResponseCode);//ivr mod
00087 
00088       virtual bool hasDefaultExpires() const;
00089       virtual UInt32 getDefaultExpires() const;
00090 
00091       virtual bool hasMinExpires() const;
00092       virtual UInt32 getMinExpires() const;
00093 
00094       virtual bool hasMaxExpires() const;
00095       virtual UInt32 getMaxExpires() const;
00096 
00097       const Mimes& getSupportedMimeTypes() const;
00098 };
00099  
00100 }
00101 
00102 #endif
00103 
00104 /* ====================================================================
00105  * The Vovida Software License, Version 1.0 
00106  * 
00107  * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved.
00108  * 
00109  * Redistribution and use in source and binary forms, with or without
00110  * modification, are permitted provided that the following conditions
00111  * are met:
00112  * 
00113  * 1. Redistributions of source code must retain the above copyright
00114  *    notice, this list of conditions and the following disclaimer.
00115  * 
00116  * 2. Redistributions in binary form must reproduce the above copyright
00117  *    notice, this list of conditions and the following disclaimer in
00118  *    the documentation and/or other materials provided with the
00119  *    distribution.
00120  * 
00121  * 3. The names "VOCAL", "Vovida Open Communication Application Library",
00122  *    and "Vovida Open Communication Application Library (VOCAL)" must
00123  *    not be used to endorse or promote products derived from this
00124  *    software without prior written permission. For written
00125  *    permission, please contact vocal@vovida.org.
00126  *
00127  * 4. Products derived from this software may not be called "VOCAL", nor
00128  *    may "VOCAL" appear in their name, without prior written
00129  *    permission of Vovida Networks, Inc.
00130  * 
00131  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
00132  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00133  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
00134  * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
00135  * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
00136  * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
00137  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00138  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00139  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00140  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00141  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00142  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00143  * DAMAGE.
00144  * 
00145  * ====================================================================
00146  * 
00147  * This software consists of voluntary contributions made by Vovida
00148  * Networks, Inc. and many individuals on behalf of Vovida Networks,
00149  * Inc.  For more information on Vovida Networks, Inc., please see
00150  * <http://www.vovida.org/>.
00151  *
00152  */