Source code of Windows XP (NT5)
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.

215 lines
6.8 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. HRESULT Init(
  45. BSTR bstrFromMemberDN, BSTR bstrFromServer, BSTR bstrFromSite,
  46. BSTR bstrToMemberDN, BSTR bstrToServer, BSTR bstrToSite,
  47. BOOL bState = TRUE, CONNECTION_OPTYPE opType = CONNECTION_OPTYPE_OTHERS);
  48. HRESULT Copy(CCusTopConnection* pConn);
  49. void _Reset();
  50. };
  51. typedef list<CCusTopConnection *> CCusTopConnectionList;
  52. void FreeCusTopConnections(CCusTopConnectionList *pList);
  53. typedef struct _RSTOPOLOGYPREF_STRING
  54. {
  55. PTSTR pszTopologyPref;
  56. int nStringID;
  57. } RSTOPOLOGYPREF_STRING;
  58. extern RSTOPOLOGYPREF_STRING g_TopologyPref[];
  59. /////////////////////////////////////////////////////////////////////////////
  60. // CCustomTopology
  61. class CCustomTopology :
  62. public CDialogImpl<CCustomTopology>
  63. {
  64. public:
  65. CCustomTopology();
  66. ~CCustomTopology();
  67. enum { IDD = IDD_FRS_CUSTOM_TOPOLOGY };
  68. BEGIN_MSG_MAP(CCustomTopology)
  69. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  70. MESSAGE_HANDLER(WM_HELP, OnCtxHelp)
  71. MESSAGE_HANDLER(WM_CONTEXTMENU, OnCtxMenuHelp)
  72. MESSAGE_HANDLER(WM_NOTIFY, OnNotify)
  73. COMMAND_ID_HANDLER(IDOK, OnOK)
  74. COMMAND_ID_HANDLER(IDCANCEL, OnCancel)
  75. COMMAND_ID_HANDLER(IDC_FRS_CUSTOP_TOPOLOGYPREF, OnTopologyPref)
  76. COMMAND_ID_HANDLER(IDC_FRS_CUSTOP_HUBSERVER, OnHubServer)
  77. COMMAND_ID_HANDLER(IDC_FRS_CUSTOP_REBUILD, OnRebuild)
  78. COMMAND_ID_HANDLER(IDC_FRS_CUSTOP_CONNECTIONS_NEW, OnConnectionsNew)
  79. COMMAND_ID_HANDLER(IDC_FRS_CUSTOP_CONNECTIONS_DELETE, OnConnectionsDelete)
  80. COMMAND_ID_HANDLER(IDC_FRS_CUSTOP_SCHEDULE, OnSchedule)
  81. END_MSG_MAP()
  82. // Command Handlers
  83. LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  84. LRESULT OnCtxHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  85. LRESULT OnCtxMenuHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  86. LRESULT OnOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  87. LRESULT OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  88. LRESULT OnTopologyPref(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  89. LRESULT OnHubServer(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  90. LRESULT OnRebuild(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  91. LRESULT OnConnectionsNew(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  92. LRESULT OnConnectionsDelete(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  93. LRESULT OnSchedule(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  94. LRESULT OnNotify(
  95. IN UINT i_uMsg,
  96. IN WPARAM i_wParam,
  97. IN LPARAM i_lParam,
  98. IN OUT BOOL& io_bHandled
  99. );
  100. // Methods to access data in the dialog.
  101. HRESULT put_ReplicaSet(IReplicaSet* i_piReplicaSet);
  102. protected:
  103. void _Reset();
  104. void _EnableButtonsForConnectionList();
  105. BOOL _EnableRebuild();
  106. HRESULT _AddToConnectionListAndView(CCusTopConnection *pConn);
  107. HRESULT _RemoveFromConnectionList(CCusTopConnection *pConn);
  108. HRESULT _SetConnectionState(CCusTopConnection *pConn);
  109. HRESULT _InsertConnection(CCusTopConnection *pConn);
  110. HRESULT _SortMemberList();
  111. HRESULT _GetMemberList();
  112. HRESULT _GetConnectionList();
  113. HRESULT _GetMemberDNInfo(
  114. IN BSTR i_bstrMemberDN,
  115. OUT BSTR* o_pbstrServer,
  116. OUT BSTR* o_pbstrSite
  117. );
  118. HRESULT _GetHubMember(
  119. OUT CCusTopMember** o_ppMember
  120. );
  121. HRESULT _RebuildConnections(
  122. IN BSTR i_bstrTopologyPref,
  123. IN CCusTopMember* i_pHubMember
  124. );
  125. HRESULT _MakeConnections();
  126. HRESULT _InitScheduleOnSelectedConnections();
  127. HRESULT _UpdateScheduleOnSelectedConnections(IN SCHEDULE* i_pSchedule);
  128. CComBSTR m_bstrTopologyPref; // FRS_RSTOPOLOGYPREF
  129. CComBSTR m_bstrHubMemberDN; // HubMemberDN
  130. CComPtr<IReplicaSet> m_piReplicaSet;
  131. CCusTopMemberList m_MemberList;
  132. CCusTopConnectionList m_ConnectionList;
  133. };
  134. /////////////////////////////////////////////////////////////////////////////
  135. // CNewConnections
  136. class CNewConnections :
  137. public CDialogImpl<CNewConnections>
  138. {
  139. public:
  140. CNewConnections();
  141. ~CNewConnections();
  142. enum { IDD = IDD_FRS_NEW_CONNECTIONS };
  143. BEGIN_MSG_MAP(CNewConnections)
  144. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  145. MESSAGE_HANDLER(WM_HELP, OnCtxHelp)
  146. MESSAGE_HANDLER(WM_CONTEXTMENU, OnCtxMenuHelp)
  147. MESSAGE_HANDLER(WM_NOTIFY, OnNotify)
  148. COMMAND_ID_HANDLER(IDOK, OnOK)
  149. COMMAND_ID_HANDLER(IDCANCEL, OnCancel)
  150. END_MSG_MAP()
  151. // Command Handlers
  152. LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  153. LRESULT OnCtxHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  154. LRESULT OnCtxMenuHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  155. LRESULT OnOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  156. LRESULT OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  157. LRESULT OnNotify(
  158. IN UINT i_uMsg,
  159. IN WPARAM i_wParam,
  160. IN LPARAM i_lParam,
  161. IN OUT BOOL& io_bHandled
  162. );
  163. HRESULT Initialize(CCusTopMemberList* i_pMemberList);
  164. HRESULT get_NewConnections(CCusTopConnectionList** ppConnectionList);
  165. protected:
  166. CCusTopMemberList* m_pMemberList; // do not release it
  167. CCusTopConnectionList m_NewConnectionList; // released in desctructor
  168. };
  169. int CALLBACK ConnectionsListCompareProc(
  170. IN LPARAM lParam1,
  171. IN LPARAM lParam2,
  172. IN LPARAM lParamColumn);
  173. int CALLBACK MembersListCompareProc(
  174. IN LPARAM lParam1,
  175. IN LPARAM lParam2,
  176. IN LPARAM lParamColumn);
  177. #endif //__CUSTOP_H_