Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

222 lines
7.4 KiB

  1. /*++
  2. Module Name:
  3. CusTop.cpp
  4. Abstract:
  5. This module contains the declaration of the CCustomTopology.
  6. This class displays the Customize Topology Dialog.
  7. */
  8. #ifndef __CUSTOP_H_
  9. #define __CUSTOP_H_
  10. #include "resource.h" // main symbols
  11. #include "DfsEnums.h"
  12. #include "DfsCore.h"
  13. #include <schedule.h>
  14. #include <list>
  15. using namespace std;
  16. class CCusTopMember
  17. {
  18. public:
  19. ~CCusTopMember();
  20. CComBSTR m_bstrMemberDN;
  21. CComBSTR m_bstrServer;
  22. CComBSTR m_bstrSite;
  23. HRESULT Init(BSTR bstrMemberDN, BSTR bstrServer, BSTR bstrSite);
  24. void _Reset();
  25. };
  26. typedef list<CCusTopMember *> CCusTopMemberList;
  27. void FreeCusTopMembers(CCusTopMemberList *pList);
  28. class CCusTopConnection
  29. {
  30. public:
  31. CCusTopConnection();
  32. ~CCusTopConnection();
  33. CComBSTR m_bstrFromMemberDN;
  34. CComBSTR m_bstrFromServer;
  35. CComBSTR m_bstrFromSite;
  36. CComBSTR m_bstrToMemberDN;
  37. CComBSTR m_bstrToServer;
  38. CComBSTR m_bstrToSite;
  39. BOOL m_bStateOld;
  40. BOOL m_bStateNew;
  41. SCHEDULE* m_pScheduleOld;
  42. SCHEDULE* m_pScheduleNew;
  43. CONNECTION_OPTYPE m_opType;
  44. BOOL m_bSyncImmediatelyOld;
  45. BOOL m_bSyncImmediatelyNew;
  46. Connection_Priority m_nPriorityOld;
  47. Connection_Priority m_nPriorityNew;
  48. HRESULT Init(
  49. BSTR bstrFromMemberDN, BSTR bstrFromServer, BSTR bstrFromSite,
  50. BSTR bstrToMemberDN, BSTR bstrToServer, BSTR bstrToSite,
  51. BOOL bState = TRUE, CONNECTION_OPTYPE opType = CONNECTION_OPTYPE_OTHERS,
  52. BOOL bSyncImmediately = FALSE, Connection_Priority nPriority = PRIORITY_LOW);
  53. HRESULT Copy(CCusTopConnection* pConn);
  54. void _Reset();
  55. };
  56. typedef list<CCusTopConnection *> CCusTopConnectionList;
  57. void FreeCusTopConnections(CCusTopConnectionList *pList);
  58. typedef struct _RSTOPOLOGYPREF_STRING
  59. {
  60. PTSTR pszTopologyPref;
  61. int nStringID;
  62. } RSTOPOLOGYPREF_STRING;
  63. extern RSTOPOLOGYPREF_STRING g_TopologyPref[];
  64. /////////////////////////////////////////////////////////////////////////////
  65. // CCustomTopology
  66. class CCustomTopology :
  67. public CDialogImpl<CCustomTopology>
  68. {
  69. public:
  70. CCustomTopology();
  71. ~CCustomTopology();
  72. enum { IDD = IDD_FRS_CUSTOM_TOPOLOGY };
  73. BEGIN_MSG_MAP(CCustomTopology)
  74. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  75. MESSAGE_HANDLER(WM_HELP, OnCtxHelp)
  76. MESSAGE_HANDLER(WM_CONTEXTMENU, OnCtxMenuHelp)
  77. MESSAGE_HANDLER(WM_NOTIFY, OnNotify)
  78. COMMAND_ID_HANDLER(IDOK, OnOK)
  79. COMMAND_ID_HANDLER(IDCANCEL, OnCancel)
  80. COMMAND_ID_HANDLER(IDC_FRS_CUSTOP_TOPOLOGYPREF, OnTopologyPref)
  81. COMMAND_ID_HANDLER(IDC_FRS_CUSTOP_HUBSERVER, OnHubServer)
  82. COMMAND_ID_HANDLER(IDC_FRS_CUSTOP_REBUILD, OnRebuild)
  83. COMMAND_ID_HANDLER(IDC_FRS_CUSTOP_CONNECTIONS_NEW, OnConnectionsNew)
  84. COMMAND_ID_HANDLER(IDC_FRS_CUSTOP_CONNECTIONS_DELETE, OnConnectionsDelete)
  85. COMMAND_ID_HANDLER(IDC_FRS_CUSTOP_SCHEDULE, OnSchedule)
  86. COMMAND_ID_HANDLER(IDC_FRS_CUSTOP_ADVANCED, OnAdvanced)
  87. END_MSG_MAP()
  88. // Command Handlers
  89. LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  90. LRESULT OnCtxHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  91. LRESULT OnCtxMenuHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  92. LRESULT OnOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  93. LRESULT OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  94. LRESULT OnTopologyPref(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  95. LRESULT OnHubServer(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  96. LRESULT OnRebuild(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  97. LRESULT OnConnectionsNew(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  98. LRESULT OnConnectionsDelete(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  99. LRESULT OnSchedule(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  100. LRESULT OnAdvanced(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  101. LRESULT OnNotify(
  102. IN UINT i_uMsg,
  103. IN WPARAM i_wParam,
  104. IN LPARAM i_lParam,
  105. IN OUT BOOL& io_bHandled
  106. );
  107. // Methods to access data in the dialog.
  108. HRESULT put_ReplicaSet(IReplicaSet* i_piReplicaSet);
  109. protected:
  110. void _Reset();
  111. void _EnableButtonsForConnectionList();
  112. BOOL _EnableRebuild();
  113. HRESULT _AddToConnectionListAndView(CCusTopConnection *pConn);
  114. HRESULT _RemoveFromConnectionList(CCusTopConnection *pConn);
  115. HRESULT _SetConnectionState(CCusTopConnection *pConn);
  116. HRESULT _InsertConnection(CCusTopConnection *pConn);
  117. HRESULT _SortMemberList();
  118. HRESULT _GetMemberList();
  119. HRESULT _GetConnectionList();
  120. HRESULT _GetMemberDNInfo(
  121. IN BSTR i_bstrMemberDN,
  122. OUT BSTR* o_pbstrServer,
  123. OUT BSTR* o_pbstrSite
  124. );
  125. HRESULT _GetHubMember(
  126. OUT CCusTopMember** o_ppMember
  127. );
  128. HRESULT _RebuildConnections(
  129. IN BSTR i_bstrTopologyPref,
  130. IN CCusTopMember* i_pHubMember
  131. );
  132. HRESULT _MakeConnections();
  133. HRESULT _InitScheduleOnSelectedConnections();
  134. HRESULT _UpdateScheduleOnSelectedConnections(IN SCHEDULE* i_pSchedule);
  135. CComBSTR m_bstrTopologyPref; // FRS_RSTOPOLOGYPREF
  136. CComBSTR m_bstrHubMemberDN; // HubMemberDN
  137. CComPtr<IReplicaSet> m_piReplicaSet;
  138. CCusTopMemberList m_MemberList;
  139. CCusTopConnectionList m_ConnectionList;
  140. };
  141. /////////////////////////////////////////////////////////////////////////////
  142. // CNewConnections
  143. class CNewConnections :
  144. public CDialogImpl<CNewConnections>
  145. {
  146. public:
  147. CNewConnections();
  148. ~CNewConnections();
  149. enum { IDD = IDD_FRS_NEW_CONNECTIONS };
  150. BEGIN_MSG_MAP(CNewConnections)
  151. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  152. MESSAGE_HANDLER(WM_HELP, OnCtxHelp)
  153. MESSAGE_HANDLER(WM_CONTEXTMENU, OnCtxMenuHelp)
  154. MESSAGE_HANDLER(WM_NOTIFY, OnNotify)
  155. COMMAND_ID_HANDLER(IDOK, OnOK)
  156. COMMAND_ID_HANDLER(IDCANCEL, OnCancel)
  157. END_MSG_MAP()
  158. // Command Handlers
  159. LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  160. LRESULT OnCtxHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  161. LRESULT OnCtxMenuHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  162. LRESULT OnOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  163. LRESULT OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  164. LRESULT OnNotify(
  165. IN UINT i_uMsg,
  166. IN WPARAM i_wParam,
  167. IN LPARAM i_lParam,
  168. IN OUT BOOL& io_bHandled
  169. );
  170. HRESULT Initialize(CCusTopMemberList* i_pMemberList);
  171. HRESULT get_NewConnections(CCusTopConnectionList** ppConnectionList);
  172. protected:
  173. CCusTopMemberList* m_pMemberList; // do not release it
  174. CCusTopConnectionList m_NewConnectionList; // released in desctructor
  175. };
  176. int CALLBACK ConnectionsListCompareProc(
  177. IN LPARAM lParam1,
  178. IN LPARAM lParam2,
  179. IN LPARAM lParamColumn);
  180. int CALLBACK MembersListCompareProc(
  181. IN LPARAM lParam1,
  182. IN LPARAM lParam2,
  183. IN LPARAM lParamColumn);
  184. #endif //__CUSTOP_H_