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.

264 lines
6.9 KiB

  1. //============================================================================
  2. // Copyright (C) Microsoft Corporation, 1997 - 1999
  3. //
  4. // File: dvsview.h
  5. //
  6. // History:
  7. //
  8. //============================================================================
  9. #ifndef _DVSVIEW_H
  10. #define _DVSVIEW_H
  11. #ifndef _BASEHAND_H
  12. #include "basehand.h"
  13. #endif
  14. #ifndef _HANDLERS_H
  15. #include "handlers.h"
  16. #endif
  17. #ifndef _XSTREAM_H
  18. #include "xstream.h" // need for ColumnData
  19. #endif
  20. #ifndef _INFO_H
  21. #include "info.h"
  22. #endif
  23. #ifndef _IFACE_H
  24. #include "iface.h"
  25. #endif
  26. #ifndef _BASECON_H
  27. #include "basecon.h" // BaseContainerHandler
  28. #endif
  29. #ifndef _DMVCOMP_H
  30. #include "dmvcomp.h"
  31. #endif
  32. #ifndef _DMVCOMP_H
  33. #include "dmvcomp.h"
  34. #endif
  35. #ifndef _DMVROOT_H
  36. #include "dmvroot.h"
  37. #endif
  38. #ifndef _LIST_
  39. #include <list>
  40. using namespace std;
  41. #endif
  42. #ifndef AFX_DLGSVR_H__19556672_96AB_11D1_8575_00C04FC31FD3__INCLUDED_
  43. #include "rrasqry.h"
  44. #endif
  45. enum
  46. {
  47. DVS_SI_SERVERNAME = 0,
  48. DVS_SI_SERVERTYPE,
  49. DVS_SI_BUILDNO,
  50. DVS_SI_STATE,
  51. DVS_SI_PORTSINUSE,
  52. DVS_SI_PORTSTOTAL,
  53. DVS_SI_UPTIME,
  54. DVS_SI_MAX_COLUMNS,
  55. };
  56. struct _BaseServerData
  57. {
  58. DWORD m_dwData;
  59. CString m_stData;
  60. };
  61. struct DMVNodeData
  62. {
  63. DMVNodeData();
  64. ~DMVNodeData();
  65. HRESULT MergeMachineNodeData(MachineNodeData* pData);
  66. #ifdef DEBUG
  67. char m_szDebug[32]; // for iding structures
  68. #endif
  69. _BaseServerData m_rgData[DVS_SI_MAX_COLUMNS];
  70. SPMachineNodeData m_spMachineData;
  71. static HRESULT InitDMVNodeData(ITFSNode *pNode, MachineNodeData *pData);
  72. static HRESULT FreeDMVNodeData(ITFSNode *pNode);
  73. };
  74. #define GET_DMVNODEDATA(pNode) \
  75. ((DMVNodeData *) pNode->GetData(TFS_DATA_USER))
  76. #define SET_DMVNODEDATA(pNode, pData) \
  77. pNode->SetData(TFS_DATA_USER, (LONG_PTR) pData)
  78. // forward declarations
  79. class RouterRefreshObject;
  80. /*---------------------------------------------------------------------------
  81. Class: DomainStatusHandler
  82. ---------------------------------------------------------------------------*/
  83. class DomainStatusHandler :
  84. public BaseContainerHandler
  85. {
  86. public:
  87. DomainStatusHandler(ITFSComponentData *pTFSCompData);
  88. ~DomainStatusHandler();
  89. // Override QI to handle embedded interface
  90. STDMETHOD(QueryInterface)(REFIID iid, LPVOID *ppv);
  91. DeclareEmbeddedInterface(IRtrAdviseSink, IUnknown)
  92. // base handler functionality we override
  93. OVERRIDE_NodeHandler_HasPropertyPages();
  94. OVERRIDE_NodeHandler_CreatePropertyPages();
  95. OVERRIDE_NodeHandler_GetString();
  96. OVERRIDE_NodeHandler_OnCreateDataObject();
  97. OVERRIDE_NodeHandler_OnAddMenuItems();
  98. OVERRIDE_NodeHandler_OnCommand();
  99. OVERRIDE_NodeHandler_DestroyHandler();
  100. OVERRIDE_BaseHandlerNotify_OnExpand();
  101. OVERRIDE_ResultHandler_AddMenuItems();
  102. OVERRIDE_ResultHandler_Command();
  103. OVERRIDE_ResultHandler_CompareItems();
  104. OVERRIDE_BaseResultHandlerNotify_OnResultShow();
  105. OVERRIDE_BaseResultHandlerNotify_OnResultRefresh();
  106. // Initializes the handler
  107. HRESULT Init(DMVConfigStream *pConfigStream, CServerList* pSList);
  108. // Initializes the node
  109. HRESULT ConstructNode(ITFSNode *pNode);
  110. public:
  111. // Structure used to pass data to callbacks - used as a way of
  112. // avoiding recomputation
  113. struct SMenuData
  114. {
  115. SPITFSNode m_spNode;
  116. DMVConfigStream* m_pConfigStream;
  117. };
  118. static ULONG RebuildServerFlags(const SRouterNodeMenu *pMenuData,
  119. INT_PTR pUserData);
  120. // assign auto refresh object from root handler
  121. HRESULT SetExternalRefreshObject(RouterRefreshObject *pRefresh);
  122. HRESULT UpdateUIItems(ITFSNode *pThisNode);
  123. public:
  124. // for subnodes of status node
  125. static HRESULT UpdateSubItemUI(ITFSNode *pNode); // not reload, only update UI
  126. static HRESULT SynchronizeSubItem(ITFSNode *pNode); // reload and update UI
  127. protected:
  128. static HRESULT GetServerInfo(ITFSNode *pNode);
  129. static HRESULT SynchronizeData(ITFSNode *pNode);
  130. static HRESULT SynchronizeIcon(ITFSNode *pNode);
  131. protected:
  132. // Refresh the data for these nodes
  133. HRESULT SynchronizeNode(ITFSNode *pThisNode);
  134. HRESULT GetDVServerData(ITFSNode *pThisNode);
  135. // Helper function to add interfaces to the UI
  136. HRESULT AddServerNode(ITFSNode *pParent, MachineNodeData *pMachineData);
  137. // auto refresh
  138. SPRouterRefreshObject m_spRefreshObject;
  139. // Command implementations
  140. HRESULT OnNewInterface();
  141. LONG_PTR m_ulRefreshConnId; // notification id for Refresh
  142. LONG_PTR m_ulStatsConnId;
  143. MMC_COOKIE m_cookie; // cookie for the node
  144. DMVConfigStream* m_pConfigStream;
  145. CString m_stTitle;
  146. RRASQryData* m_pQData;
  147. CServerList* m_pServerList;
  148. // Cache commonly loaded strings here.
  149. CString m_szStatAccessDenied;
  150. CString m_szStatUnavail;
  151. CString m_szStatStart;
  152. CString m_szStatStop;
  153. CString m_szStatNotConfig;
  154. };
  155. /*---------------------------------------------------------------------------
  156. Class: DomainStatusServerHandler
  157. This is the handler for the interface nodes that appear in the ATLK
  158. node.
  159. ---------------------------------------------------------------------------*/
  160. class DomainStatusServerHandler : public BaseResultHandler
  161. {
  162. public:
  163. DomainStatusServerHandler(ITFSComponentData *pCompData);
  164. ~DomainStatusServerHandler();
  165. OVERRIDE_NodeHandler_HasPropertyPages();
  166. OVERRIDE_NodeHandler_CreatePropertyPages();
  167. OVERRIDE_NodeHandler_OnCreateDataObject();
  168. OVERRIDE_ResultHandler_AddMenuItems();
  169. OVERRIDE_ResultHandler_Command();
  170. OVERRIDE_ResultHandler_OnCreateDataObject();
  171. OVERRIDE_ResultHandler_DestroyResultHandler();
  172. OVERRIDE_ResultHandler_HasPropertyPages()
  173. { return hrOK; };
  174. OVERRIDE_ResultHandler_CreatePropertyPages();
  175. OVERRIDE_ResultHandler_GetString();
  176. OVERRIDE_ResultHandler_CompareItems();
  177. OVERRIDE_BaseResultHandlerNotify_OnResultDelete();
  178. // Initializes the node
  179. HRESULT ConstructNode(ITFSNode *pNode, MachineNodeData *pMachineData);
  180. HRESULT Init(ITFSNode *pParent, DMVConfigStream *pConfigStream);
  181. HRESULT OnRemoveServer(ITFSNode *pNode);
  182. // Refresh the data for this node
  183. void RefreshInterface(MMC_COOKIE cookie);
  184. public:
  185. // Structure used to pass data to callbacks - used as a way of
  186. // avoiding recomputation
  187. struct SMenuData : public MachineHandler::SMenuData
  188. {
  189. };
  190. static ULONG QueryService(const SRouterNodeMenu *pMenu, INT_PTR pData);
  191. static ULONG GetPauseFlags(const SRouterNodeMenu *pMenu, INT_PTR pData);
  192. // assign auto refresh object from root handler
  193. HRESULT SetExternalRefreshObject(RouterRefreshObject *pRefresh);
  194. protected:
  195. SPIDataObject m_spDataObject; // cachecd data object
  196. // auto refresh
  197. SPRouterRefreshObject m_spRefreshObject;
  198. };
  199. #endif _DVSVIEW_H