|
reSIProcate/DialogUsageManager
9680
|
00001 #if !defined(RESIP_DIALOGUSAGE_HXX) 00002 #define RESIP_DIALOGUSAGE_HXX 00003 00004 #include "rutil/BaseException.hxx" 00005 #include "rutil/SharedPtr.hxx" 00006 #include "resip/dum/DumCommand.hxx" 00007 #include "resip/dum/UserProfile.hxx" 00008 #include "resip/dum/BaseUsage.hxx" 00009 #include "resip/dum/Handles.hxx" 00010 00011 namespace resip 00012 { 00013 00014 class DialogUsageManager; 00015 class Dialog; 00016 class DialogId; 00017 class DumTimeout; 00018 class SipMessage; 00019 class NameAddr; 00020 00021 class DialogUsage : public BaseUsage 00022 { 00023 public: 00024 class Exception : public BaseException 00025 { 00026 public: 00027 Exception(const Data& msg,const Data& file,int line); 00028 virtual const char* name() const; 00029 }; 00030 00031 AppDialogSetHandle getAppDialogSet(); 00032 AppDialogHandle getAppDialog(); 00033 00034 // Convenience methods for accessing attributes of a dialog. 00035 const NameAddr& myAddr() const; 00036 const NameAddr& peerAddr() const; 00037 const NameAddr& remoteTarget() const; 00038 const DialogId& getDialogId() const; 00039 const Data& getCallId() const; 00040 SharedPtr<UserProfile> getUserProfile(); 00041 00042 protected: 00043 friend class DialogSet; 00044 friend class DialogUsageManager; 00045 friend class DialogUsageSendCommand; 00046 00047 class DialogUsageSendCommand : public DumCommandAdapter 00048 { 00049 public: 00050 DialogUsageSendCommand(DialogUsage& usage, SharedPtr<SipMessage> msg) 00051 : mDialogUsage(usage), 00052 mMessage(msg) 00053 { 00054 } 00055 00056 virtual void executeCommand() 00057 { 00058 mDialogUsage.send(mMessage); 00059 } 00060 00061 virtual EncodeStream& encodeBrief(EncodeStream& strm) const 00062 { 00063 return strm << "DialogUsageSendCommand"; 00064 } 00065 private: 00066 DialogUsage& mDialogUsage; 00067 SharedPtr<SipMessage> mMessage; 00068 }; 00069 00070 00071 //virtual void send(SipMessage& msg); 00072 virtual void send(SharedPtr<SipMessage> msg); 00073 virtual void sendCommand(SharedPtr<SipMessage> msg); 00074 00075 // any usage that wants to give app a chance to adorn the message 00076 // should override this method. 00077 virtual void onReadyToSend(SipMessage&) {} 00078 00079 DialogUsage(DialogUsageManager& dum, Dialog& dialog); 00080 virtual ~DialogUsage(); 00081 00082 //virtual void sendToDialog(SharedPtr<SipMessage> msg); 00083 00084 virtual void dialogDestroyed(const SipMessage& msg) = 0; 00085 00086 Dialog& mDialog; 00087 }; 00088 00089 } 00090 00091 #endif 00092 00093 /* ==================================================================== 00094 * The Vovida Software License, Version 1.0 00095 * 00096 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved. 00097 * 00098 * Redistribution and use in source and binary forms, with or without 00099 * modification, are permitted provided that the following conditions 00100 * are met: 00101 * 00102 * 1. Redistributions of source code must retain the above copyright 00103 * notice, this list of conditions and the following disclaimer. 00104 * 00105 * 2. Redistributions in binary form must reproduce the above copyright 00106 * notice, this list of conditions and the following disclaimer in 00107 * the documentation and/or other materials provided with the 00108 * distribution. 00109 * 00110 * 3. The names "VOCAL", "Vovida Open Communication Application Library", 00111 * and "Vovida Open Communication Application Library (VOCAL)" must 00112 * not be used to endorse or promote products derived from this 00113 * software without prior written permission. For written 00114 * permission, please contact vocal@vovida.org. 00115 * 00116 * 4. Products derived from this software may not be called "VOCAL", nor 00117 * may "VOCAL" appear in their name, without prior written 00118 * permission of Vovida Networks, Inc. 00119 * 00120 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED 00121 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00122 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND 00123 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA 00124 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES 00125 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, 00126 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00127 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00128 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 00129 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00130 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 00131 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 00132 * DAMAGE. 00133 * 00134 * ==================================================================== 00135 * 00136 * This software consists of voluntary contributions made by Vovida 00137 * Networks, Inc. and many individuals on behalf of Vovida Networks, 00138 * Inc. For more information on Vovida Networks, Inc., please see 00139 * <http://www.vovida.org/>. 00140 * 00141 */
1.7.5.1