|
reSIProcate/DialogUsageManager
9680
|
00001 #if !defined(RESIP_APPDIALOGSET_HXX) 00002 #define RESIP_APPDIALOGSET_HXX 00003 00004 #include "resip/dum/Handles.hxx" 00005 #include "resip/dum/Handled.hxx" 00006 #include "resip/dum/DialogSet.hxx" 00007 #include "resip/dum/DialogSetId.hxx" 00008 #include "resip/dum/UserProfile.hxx" 00009 #include "resip/dum/DumCommand.hxx" 00010 00011 namespace resip 00012 { 00013 00014 class SipMessage; 00015 class DialogUsageManager; 00016 00017 class AppDialogSet : public Handled 00018 { 00019 public: 00020 00021 // by default, dum calls the destructor. application can override this if it 00022 // wants to manage memory on its own. 00023 virtual void destroy(); 00024 00025 virtual void end(); 00026 00027 // Asynchronously calls end() through a DUM command 00028 virtual void endCommand(); 00029 00030 virtual SharedPtr<UserProfile> getUserProfile(); 00031 00032 virtual AppDialog* createAppDialog(const SipMessage&); 00033 00034 AppDialogSetHandle getHandle(); 00035 DialogSetId getDialogSetId(); 00036 00037 virtual const Data getClassName(); 00038 00039 virtual EncodeStream& dump(EncodeStream& strm) const; 00040 00041 protected: 00042 00043 class AppDialogSetEndCommand : public DumCommandAdapter 00044 { 00045 public: 00046 AppDialogSetEndCommand(const AppDialogSetHandle& dialogSet) 00047 : mAppDialogSet(dialogSet) 00048 { 00049 } 00050 00051 virtual void executeCommand() 00052 { 00053 if(mAppDialogSet.isValid()) 00054 { 00055 mAppDialogSet->end(); 00056 } 00057 } 00058 00059 virtual EncodeStream& encodeBrief(EncodeStream& strm) const 00060 { 00061 return strm << "AppDialogSetEndCommand"; 00062 } 00063 private: 00064 AppDialogSetHandle mAppDialogSet; 00065 }; 00066 00067 AppDialogSet(DialogUsageManager& dum); 00068 00069 DialogUsageManager& mDum; 00070 virtual ~AppDialogSet(); 00071 // This is called by the DialogUsageManager to select an userProfile to assign to a UAS DialogSet. 00072 // The application should not call this directly, but should override it, in order to assign 00073 // an userProfile other than the MasterProfile 00074 virtual SharedPtr<UserProfile> selectUASUserProfile(const SipMessage&); 00075 00076 private: 00080 AppDialogSet* reuse(); 00081 bool isReUsed() const; 00082 00083 friend class DialogUsageManager; 00084 friend class AppDialogSetFactory; 00085 friend class ClientSubscription; 00086 00087 DialogSet* mDialogSet; 00088 bool mIsReUsed; 00089 }; 00090 00091 } 00092 00093 #endif 00094 00095 /* ==================================================================== 00096 * The Vovida Software License, Version 1.0 00097 * 00098 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved. 00099 * 00100 * Redistribution and use in source and binary forms, with or without 00101 * modification, are permitted provided that the following conditions 00102 * are met: 00103 * 00104 * 1. Redistributions of source code must retain the above copyright 00105 * notice, this list of conditions and the following disclaimer. 00106 * 00107 * 2. Redistributions in binary form must reproduce the above copyright 00108 * notice, this list of conditions and the following disclaimer in 00109 * the documentation and/or other materials provided with the 00110 * distribution. 00111 * 00112 * 3. The names "VOCAL", "Vovida Open Communication Application Library", 00113 * and "Vovida Open Communication Application Library (VOCAL)" must 00114 * not be used to endorse or promote products derived from this 00115 * software without prior written permission. For written 00116 * permission, please contact vocal@vovida.org. 00117 * 00118 * 4. Products derived from this software may not be called "VOCAL", nor 00119 * may "VOCAL" appear in their name, without prior written 00120 * permission of Vovida Networks, Inc. 00121 * 00122 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED 00123 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00124 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND 00125 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA 00126 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES 00127 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, 00128 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00129 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00130 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 00131 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00132 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 00133 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 00134 * DAMAGE. 00135 * 00136 * ==================================================================== 00137 * 00138 * This software consists of voluntary contributions made by Vovida 00139 * Networks, Inc. and many individuals on behalf of Vovida Networks, 00140 * Inc. For more information on Vovida Networks, Inc., please see 00141 * <http://www.vovida.org/>. 00142 * 00143 */
1.7.5.1