|
reSIProcate/DialogUsageManager
9680
|
00001 #if !defined(RESIP_CLIENTDIALOGSET_HXX) 00002 #define RESIP_CLIENTDIALOGSET_HXX 00003 00004 #include <map> 00005 #include <list> 00006 00007 #include "resip/dum/DialogId.hxx" 00008 #include "resip/dum/DialogSetId.hxx" 00009 #include "resip/dum/MergedRequestKey.hxx" 00010 #include "resip/dum/Handles.hxx" 00011 #include "resip/stack/SipMessage.hxx" 00012 #include "rutil/SharedPtr.hxx" 00013 00014 namespace resip 00015 { 00016 00017 class BaseCreator; 00018 class Dialog; 00019 class DialogUsageManager; 00020 class AppDialogSet; 00021 class ClientOutOfDialogReq; 00022 class UserProfile; 00023 00024 class DialogSet 00025 { 00026 public: 00027 DialogSet(BaseCreator* creator, DialogUsageManager& dum); 00028 DialogSet(const SipMessage& request, DialogUsageManager& dum); 00029 virtual ~DialogSet(); 00030 00031 DialogSetId getId() const; 00032 void addDialog(Dialog*); 00033 bool empty() const; 00034 BaseCreator* getCreator(); 00035 00036 SharedPtr<UserProfile> getUserProfile() const; 00037 void setUserProfile(SharedPtr<UserProfile> userProfile); 00038 00039 void end(); 00040 void dispatch(const SipMessage& msg); 00041 00042 ClientRegistrationHandle getClientRegistration(); 00043 ServerRegistrationHandle getServerRegistration(); 00044 ClientPublicationHandle getClientPublication(); 00045 ClientOutOfDialogReqHandle getClientOutOfDialog(); 00046 ServerOutOfDialogReqHandle getServerOutOfDialog(); 00047 00048 bool isDestroying() { return mState == Destroying; }; 00049 00050 private: 00051 friend class Dialog; 00052 friend class DialogUsage; 00053 friend class ClientInviteSession; 00054 friend class NonDialogUsage; 00055 friend class DialogUsageManager; 00056 friend class ClientRegistration; 00057 friend class ServerRegistration; 00058 friend class ClientOutOfDialogReq; 00059 friend class ServerOutOfDialogReq; 00060 friend class ClientPublication; 00061 friend class RedirectManager; 00062 friend class ClientPagerMessage; 00063 friend class ServerPagerMessage; 00064 00065 typedef enum 00066 { 00067 Initial, // No session setup yet 00068 WaitingToEnd, 00069 ReceivedProvisional, 00070 Established, 00071 Terminating, 00072 Cancelling, // only used when cancelling and no dialogs exist 00073 Destroying 00074 } State; 00075 00076 void possiblyDie(); 00077 00078 void onForkAccepted(); 00079 bool handledByAuthOrRedirect(const SipMessage& msg); 00080 00082 void appDissociate() 00083 { 00084 assert(mAppDialogSet); 00085 mAppDialogSet = 0; 00086 } 00087 friend class AppDialogSet; 00088 00089 Dialog* findDialog(const SipMessage& msg); 00090 Dialog* findDialog(const DialogId id); 00091 00092 ClientOutOfDialogReq* findMatchingClientOutOfDialogReq(const SipMessage& msg); 00093 00094 ClientRegistration* makeClientRegistration(const SipMessage& msg); 00095 ClientPublication* makeClientPublication( const SipMessage& msg); 00096 ClientOutOfDialogReq* makeClientOutOfDialogReq(const SipMessage& msg); 00097 00098 ServerRegistration* makeServerRegistration(const SipMessage& msg); 00099 ServerOutOfDialogReq* makeServerOutOfDialog(const SipMessage& msg); 00100 00101 ServerPagerMessage* makeServerPagerMessage(const SipMessage& request); 00102 00103 void dispatchToAllDialogs(const SipMessage& msg); 00104 00105 void flowTerminated(const Tuple& flow); 00106 00107 MergedRequestKey mMergeKey; 00108 Data mCancelKey; 00109 typedef std::map<DialogId,Dialog*> DialogMap; 00110 DialogMap mDialogs; 00111 BaseCreator* mCreator; 00112 DialogSetId mId; 00113 DialogUsageManager& mDum; 00114 AppDialogSet* mAppDialogSet; 00115 State mState; 00116 ClientRegistration* mClientRegistration; 00117 ServerRegistration* mServerRegistration; 00118 ClientPublication* mClientPublication; 00119 std::list<ClientOutOfDialogReq*> mClientOutOfDialogRequests; 00120 ServerOutOfDialogReq* mServerOutOfDialogRequest; 00121 00122 ClientPagerMessage* mClientPagerMessage; 00123 ServerPagerMessage* mServerPagerMessage; 00124 SharedPtr<UserProfile> mUserProfile; 00125 00126 friend EncodeStream& operator<<(EncodeStream& strm, const DialogSet& ds); 00127 }; 00128 00129 EncodeStream& 00130 operator<<(EncodeStream& strm, const DialogSet& ds); 00131 00132 } 00133 00134 #endif 00135 00136 /* ==================================================================== 00137 * The Vovida Software License, Version 1.0 00138 * 00139 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved. 00140 * 00141 * Redistribution and use in source and binary forms, with or without 00142 * modification, are permitted provided that the following conditions 00143 * are met: 00144 * 00145 * 1. Redistributions of source code must retain the above copyright 00146 * notice, this list of conditions and the following disclaimer. 00147 * 00148 * 2. Redistributions in binary form must reproduce the above copyright 00149 * notice, this list of conditions and the following disclaimer in 00150 * the documentation and/or other materials provided with the 00151 * distribution. 00152 * 00153 * 3. The names "VOCAL", "Vovida Open Communication Application Library", 00154 * and "Vovida Open Communication Application Library (VOCAL)" must 00155 * not be used to endorse or promote products derived from this 00156 * software without prior written permission. For written 00157 * permission, please contact vocal@vovida.org. 00158 * 00159 * 4. Products derived from this software may not be called "VOCAL", nor 00160 * may "VOCAL" appear in their name, without prior written 00161 * permission of Vovida Networks, Inc. 00162 * 00163 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED 00164 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00165 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND 00166 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA 00167 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES 00168 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, 00169 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00170 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00171 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 00172 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00173 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 00174 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 00175 * DAMAGE. 00176 * 00177 * ==================================================================== 00178 * 00179 * This software consists of voluntary contributions made by Vovida 00180 * Networks, Inc. and many individuals on behalf of Vovida Networks, 00181 * Inc. For more information on Vovida Networks, Inc., please see 00182 * <http://www.vovida.org/>. 00183 * 00184 */
1.7.5.1