|
reSIProcate/DialogUsageManager
9694
|
00001 #if !defined(RESIP_SERVERSUBSCRIPTION_HXX) 00002 #define RESIP_SERVERSUBSCRIPTION_HXX 00003 00004 #include "resip/dum/BaseSubscription.hxx" 00005 00006 namespace resip 00007 { 00008 00009 class DialogUsageManager; 00010 00012 class ServerSubscription : public BaseSubscription 00013 { 00014 public: 00015 typedef Handle<ServerSubscription> ServerSubscriptionHandle; 00016 ServerSubscriptionHandle getHandle(); 00017 00018 const Data& getSubscriber() const { return mSubscriber; } 00019 UInt32 getTimeLeft(); 00020 00021 //only 200 and 202 are permissable. SubscriptionState is not affected. 00022 //currently must be called for a refresh as well as initial creation. 00023 SharedPtr<SipMessage> accept(int statusCode = 202); 00024 SharedPtr<SipMessage> reject(int responseCode); 00025 00026 //used to accept a reresh when there is no useful state to convey to the 00027 //client 00028 SharedPtr<SipMessage> neutralNotify(); 00029 00030 void setSubscriptionState(SubscriptionState state); 00031 00032 SharedPtr<SipMessage> update(const Contents* document); 00033 void end(TerminateReason reason, const Contents* document = 0); 00034 00035 virtual void end(); 00036 virtual void send(SharedPtr<SipMessage> msg); 00037 virtual void sendCommand(SharedPtr<SipMessage> msg) 00038 { 00039 BaseSubscription::sendCommand(msg); 00040 } 00041 00042 // void setTerminationState(TerminateReason reason); 00043 // void setCurrentEventDocument(const Contents* document); 00044 00045 virtual void dispatch(const SipMessage& msg); 00046 virtual void dispatch(const DumTimeout& timer); 00047 00048 virtual EncodeStream& dump(EncodeStream& strm) const; 00049 00050 protected: 00051 virtual ~ServerSubscription(); 00052 virtual void dialogDestroyed(const SipMessage& msg); 00053 void onReadyToSend(SipMessage& msg); 00054 virtual void flowTerminated(); 00055 00056 private: 00057 friend class Dialog; 00058 00059 ServerSubscription(DialogUsageManager& dum, Dialog& dialog, const SipMessage& req); 00060 00061 void makeNotifyExpires(); 00062 void makeNotify(); 00063 00064 bool shouldDestroyAfterSendingFailure(const SipMessage& msg); 00065 00066 Data mSubscriber; 00067 00068 // const Contents* mCurrentEventDocument; 00069 SipMessage mLastSubscribe; 00070 00071 UInt32 mExpires; 00072 00073 // disabled 00074 ServerSubscription(const ServerSubscription&); 00075 ServerSubscription& operator=(const ServerSubscription&); 00076 UInt64 mAbsoluteExpiry; 00077 }; 00078 00079 } 00080 00081 #endif 00082 00083 /* ==================================================================== 00084 * The Vovida Software License, Version 1.0 00085 * 00086 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved. 00087 * 00088 * Redistribution and use in source and binary forms, with or without 00089 * modification, are permitted provided that the following conditions 00090 * are met: 00091 * 00092 * 1. Redistributions of source code must retain the above copyright 00093 * notice, this list of conditions and the following disclaimer. 00094 * 00095 * 2. Redistributions in binary form must reproduce the above copyright 00096 * notice, this list of conditions and the following disclaimer in 00097 * the documentation and/or other materials provided with the 00098 * distribution. 00099 * 00100 * 3. The names "VOCAL", "Vovida Open Communication Application Library", 00101 * and "Vovida Open Communication Application Library (VOCAL)" must 00102 * not be used to endorse or promote products derived from this 00103 * software without prior written permission. For written 00104 * permission, please contact vocal@vovida.org. 00105 * 00106 * 4. Products derived from this software may not be called "VOCAL", nor 00107 * may "VOCAL" appear in their name, without prior written 00108 * permission of Vovida Networks, Inc. 00109 * 00110 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED 00111 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00112 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND 00113 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA 00114 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES 00115 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, 00116 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00117 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00118 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 00119 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00120 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 00121 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 00122 * DAMAGE. 00123 * 00124 * ==================================================================== 00125 * 00126 * This software consists of voluntary contributions made by Vovida 00127 * Networks, Inc. and many individuals on behalf of Vovida Networks, 00128 * Inc. For more information on Vovida Networks, Inc., please see 00129 * <http://www.vovida.org/>. 00130 * 00131 */
1.7.5.1