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.

417 lines
13 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1997-1999 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // ClusNode.h
  7. //
  8. // Description:
  9. // Definition of the node classes for the MSCLUS automation classes.
  10. //
  11. // Implementation File:
  12. // ClusNode.cpp
  13. //
  14. // Author:
  15. // Charles Stacy Harris (stacyh) 28-Feb-1997
  16. // Galen Barbee (galenb) July 1998
  17. //
  18. // Revision History:
  19. // July 1998 GalenB Maaaaaajjjjjjjjjoooooorrrr clean up
  20. //
  21. // Notes:
  22. //
  23. /////////////////////////////////////////////////////////////////////////////
  24. #ifndef _CLUSNODE_H_
  25. #define _CLUSNODE_H_
  26. /////////////////////////////////////////////////////////////////////////////
  27. // Forward Class Declarations
  28. /////////////////////////////////////////////////////////////////////////////
  29. class CClusNode;
  30. class CNodes;
  31. class CClusNodes;
  32. class CClusResGroupPreferredOwnerNodes;
  33. class CClusResPossibleOwnerNodes;
  34. const IID IID_CClusNode = {0xf2e60800,0x2631,0x11d1,{0x89,0xf1,0x00,0xa0,0xc9,0x0d,0x06,0x1e}};
  35. /////////////////////////////////////////////////////////////////////////////
  36. //++
  37. //
  38. // class CClusNode
  39. //
  40. // Description:
  41. // Cluster Node Automation Class.
  42. //
  43. // Inheritance:
  44. // IDispatchImpl< ISClusNode, &IID_ISClusNode, &LIBID_MSClusterLib, MAJORINTERFACEVER, MINORINTERFACEVER >,
  45. // CSupportErrorInfo
  46. // CComObjectRootEx< CComSingleThreadModel >
  47. // CComCoClass< CClusNode, &CLSID_ClusNode >
  48. // CClusterObject
  49. //
  50. //--
  51. /////////////////////////////////////////////////////////////////////////////
  52. class ATL_NO_VTABLE CClusNode :
  53. public IDispatchImpl< ISClusNode, &IID_ISClusNode, &LIBID_MSClusterLib, MAJORINTERFACEVER, MINORINTERFACEVER >,
  54. public CSupportErrorInfo,
  55. public CComObjectRootEx< CComSingleThreadModel >,
  56. public CComCoClass< CClusNode, &CLSID_ClusNode >,
  57. public CClusterObject
  58. {
  59. typedef CComObjectRootEx< CComSingleThreadModel > BaseComClass;
  60. public:
  61. CClusNode( void );
  62. ~CClusNode( void );
  63. BEGIN_COM_MAP(CClusNode)
  64. COM_INTERFACE_ENTRY(IDispatch)
  65. COM_INTERFACE_ENTRY(ISClusNode)
  66. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  67. COM_INTERFACE_ENTRY_IID(IID_CClusNode, CClusNode)
  68. END_COM_MAP()
  69. DECLARE_NOT_AGGREGATABLE(CClusNode)
  70. DECLARE_NO_REGISTRY()
  71. private:
  72. HNODE m_hNode;
  73. ISClusRefObject * m_pClusRefObject;
  74. CComBSTR m_bstrNodeName;
  75. CComObject< CClusResGroups > * m_pResourceGroups;
  76. CComObject< CClusProperties > * m_pCommonProperties;
  77. CComObject< CClusProperties > * m_pPrivateProperties;
  78. CComObject< CClusProperties > * m_pCommonROProperties;
  79. CComObject< CClusProperties > * m_pPrivateROProperties;
  80. CComObject< CClusNodeNetInterfaces > * m_pNetInterfaces;
  81. HRESULT Close( void );
  82. HRESULT GetProperties( OUT ISClusProperties ** ppProperties, IN BOOL bPrivate, IN BOOL bReadOnly );
  83. protected:
  84. virtual DWORD ScWriteProperties( IN const CClusPropList & rcplPropList, IN BOOL bPrivate );
  85. public:
  86. HRESULT Open( IN ISClusRefObject * pClusRefObject, IN BSTR bstrNodeName );
  87. STDMETHODIMP get_Handle( OUT ULONG_PTR * phandle );
  88. STDMETHODIMP get_Name( OUT BSTR * pbstrNodeName );
  89. STDMETHODIMP get_NodeID( OUT BSTR * pbstrNodeID );
  90. STDMETHODIMP get_State( OUT CLUSTER_NODE_STATE * dwState );
  91. STDMETHODIMP Pause( void );
  92. STDMETHODIMP Resume( void );
  93. STDMETHODIMP Evict( void );
  94. STDMETHODIMP get_ResourceGroups( OUT ISClusResGroups ** ppResourceGroups );
  95. STDMETHODIMP get_CommonProperties( OUT ISClusProperties ** ppProperties );
  96. STDMETHODIMP get_PrivateProperties( OUT ISClusProperties ** ppProperties );
  97. STDMETHODIMP get_CommonROProperties( OUT ISClusProperties ** ppProperties );
  98. STDMETHODIMP get_PrivateROProperties( OUT ISClusProperties ** ppProperties );
  99. STDMETHODIMP get_NetInterfaces( OUT ISClusNodeNetInterfaces ** ppNetInterfaces );
  100. STDMETHODIMP get_Cluster( OUT ISCluster ** ppCluster );
  101. virtual HRESULT HrLoadProperties( OUT CClusPropList & rcplPropList, IN BOOL bReadOnly, IN BOOL bPrivate );
  102. const CComBSTR Name( void ) const { return m_bstrNodeName; };
  103. const HNODE & RhNode( void ) const { return m_hNode; };
  104. }; //*** Class CClusNode
  105. /////////////////////////////////////////////////////////////////////////////
  106. //++
  107. //
  108. // class CNodes
  109. //
  110. // Description:
  111. // Cluster Nodes Collection Implementation Class.
  112. //
  113. // Inheritance:
  114. //
  115. //--
  116. /////////////////////////////////////////////////////////////////////////////
  117. class CNodes
  118. {
  119. public:
  120. CNodes( void );
  121. ~CNodes( void );
  122. HRESULT Create( ISClusRefObject * pClusRefObject );
  123. protected:
  124. typedef std::vector< CComObject< CClusNode > * > NodeList;
  125. ISClusRefObject * m_pClusRefObject;
  126. NodeList m_Nodes;
  127. void Clear( void );
  128. HRESULT FindItem( IN LPWSTR lpszNodeName, OUT UINT * pnIndex );
  129. HRESULT FindItem( IN ISClusNode * pClusterNode, OUT UINT * pnIndex );
  130. HRESULT GetIndex( IN VARIANT varIndex, OUT UINT * pnIndex );
  131. HRESULT GetItem( IN LPWSTR lpszNodeName, OUT ISClusNode ** ppClusterNode );
  132. HRESULT GetItem( IN UINT nIndex, OUT ISClusNode ** ppClusterNode );
  133. HRESULT GetNodeItem( IN VARIANT varIndex, OUT ISClusNode ** ppClusterNode );
  134. HRESULT InsertAt( IN CComObject< CClusNode > * pNode, IN size_t pos );
  135. HRESULT RemoveAt( IN size_t pos );
  136. }; //*** Class CNodes
  137. /////////////////////////////////////////////////////////////////////////////
  138. //++
  139. //
  140. // class CClusNodes
  141. //
  142. // Description:
  143. // Cluster Nodes Collection Automation Class.
  144. //
  145. // Inheritance:
  146. // IDispatchImpl< ISClusNodes, &IID_ISClusNodes, &LIBID_MSClusterLib, MAJORINTERFACEVER, MINORINTERFACEVER >,
  147. // CSupportErrorInfo
  148. // CComObjectRootEx< CComSingleThreadModel >
  149. // CNodes,
  150. // CComCoClass< CClusNodes, &CLSID_ClusNodes >
  151. //
  152. //--
  153. /////////////////////////////////////////////////////////////////////////////
  154. class ATL_NO_VTABLE CClusNodes :
  155. public IDispatchImpl< ISClusNodes, &IID_ISClusNodes, &LIBID_MSClusterLib, MAJORINTERFACEVER, MINORINTERFACEVER >,
  156. public CSupportErrorInfo,
  157. public CComObjectRootEx< CComSingleThreadModel >,
  158. public CNodes,
  159. public CComCoClass< CClusNodes, &CLSID_ClusNodes >
  160. {
  161. typedef CComObjectRootEx< CComSingleThreadModel > BaseComClass;
  162. public:
  163. CClusNodes( void );
  164. ~CClusNodes( void );
  165. BEGIN_COM_MAP(CClusNodes)
  166. COM_INTERFACE_ENTRY(IDispatch)
  167. COM_INTERFACE_ENTRY(ISClusNodes)
  168. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  169. END_COM_MAP()
  170. DECLARE_NOT_AGGREGATABLE(CClusNodes)
  171. DECLARE_NO_REGISTRY()
  172. STDMETHODIMP get_Count( OUT long * plCount );
  173. STDMETHODIMP get__NewEnum( OUT IUnknown ** ppunk );
  174. STDMETHODIMP get_Item( IN VARIANT varIndex, OUT ISClusNode ** ppClusterNode );
  175. STDMETHODIMP Refresh( void );
  176. }; //*** CClusNodes
  177. /////////////////////////////////////////////////////////////////////////////
  178. //++
  179. //
  180. // class CClusResGroupPreferredOwnerNodes
  181. //
  182. // Description:
  183. // Cluster Group Owner Nodes Collection Automation Class.
  184. //
  185. // Inheritance:
  186. // IDispatchImpl< ISClusResGroupPreferredOwnerNodes, &IID_ISClusResGroupPreferredOwnerNodes, &LIBID_MSClusterLib, MAJORINTERFACEVER, MINORINTERFACEVER >,
  187. // CSupportErrorInfo
  188. // CComObjectRootEx< CComSingleThreadModel >
  189. // CNodes
  190. // CComCoClass< CClusResGroupPreferredOwnerNodes, &CLSID_ClusResGroupPreferredOwnerNodes >
  191. //
  192. //--
  193. /////////////////////////////////////////////////////////////////////////////
  194. class ATL_NO_VTABLE CClusResGroupPreferredOwnerNodes :
  195. public IDispatchImpl< ISClusResGroupPreferredOwnerNodes, &IID_ISClusResGroupPreferredOwnerNodes, &LIBID_MSClusterLib, MAJORINTERFACEVER, MINORINTERFACEVER >,
  196. public CSupportErrorInfo,
  197. public CComObjectRootEx< CComSingleThreadModel >,
  198. public CNodes,
  199. public CComCoClass< CClusResGroupPreferredOwnerNodes, &CLSID_ClusResGroupPreferredOwnerNodes >
  200. {
  201. typedef CComObjectRootEx< CComSingleThreadModel > BaseComClass;
  202. public:
  203. CClusResGroupPreferredOwnerNodes( void );
  204. ~CClusResGroupPreferredOwnerNodes( void );
  205. BEGIN_COM_MAP(CClusResGroupPreferredOwnerNodes)
  206. COM_INTERFACE_ENTRY(IDispatch)
  207. COM_INTERFACE_ENTRY(ISClusResGroupPreferredOwnerNodes)
  208. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  209. END_COM_MAP()
  210. DECLARE_NOT_AGGREGATABLE(CClusResGroupPreferredOwnerNodes)
  211. DECLARE_NO_REGISTRY()
  212. HRESULT Create( IN ISClusRefObject* pClusRefObject, IN CRefcountedHGROUP hGroup );
  213. STDMETHODIMP get_Count( OUT long * plCount );
  214. STDMETHODIMP get_Item( IN VARIANT varIndex, OUT ISClusNode ** ppClusterNode );
  215. STDMETHODIMP InsertItem( IN ISClusNode* pNode, IN long nPostion );
  216. STDMETHODIMP RemoveItem( IN VARIANT varIndex );
  217. STDMETHODIMP Refresh( void );
  218. STDMETHODIMP get_Modified( OUT VARIANT * pvarModified );
  219. STDMETHODIMP get__NewEnum( OUT IUnknown ** ppunk );
  220. STDMETHODIMP SaveChanges( void );
  221. STDMETHODIMP AddItem( IN ISClusNode* pNode );
  222. private:
  223. CRefcountedHGROUP m_hGroup;
  224. BOOL m_bModified;
  225. }; //*** Class CClusResGroupPreferredOwnerNodes
  226. /////////////////////////////////////////////////////////////////////////////
  227. //++
  228. //
  229. // class CClusResPossibleOwnerNodes
  230. //
  231. // Description:
  232. // Cluster Resource Owner Nodes Collection Automation Class.
  233. //
  234. // Inheritance:
  235. // IDispatchImpl< ISClusResPossibleOwnerNodes, &IID_ISClusResPossibleOwnerNodes, &LIBID_MSClusterLib, MAJORINTERFACEVER, MINORINTERFACEVER >,
  236. // CSupportErrorInfo
  237. // CComObjectRootEx< CComSingleThreadModel >
  238. // CNodes
  239. // CComCoClass< CClusResPossibleOwnerNodes, &CLSID_ClusResPossibleOwnerNodes >
  240. //
  241. //--
  242. /////////////////////////////////////////////////////////////////////////////
  243. class ATL_NO_VTABLE CClusResPossibleOwnerNodes :
  244. public IDispatchImpl< ISClusResPossibleOwnerNodes, &IID_ISClusResPossibleOwnerNodes, &LIBID_MSClusterLib, MAJORINTERFACEVER, MINORINTERFACEVER >,
  245. public CSupportErrorInfo,
  246. public CComObjectRootEx< CComSingleThreadModel >,
  247. public CNodes,
  248. public CComCoClass< CClusResPossibleOwnerNodes, &CLSID_ClusResPossibleOwnerNodes >
  249. {
  250. typedef CComObjectRootEx< CComSingleThreadModel > BaseComClass;
  251. public:
  252. CClusResPossibleOwnerNodes( void );
  253. ~CClusResPossibleOwnerNodes( void );
  254. BEGIN_COM_MAP(CClusResPossibleOwnerNodes)
  255. COM_INTERFACE_ENTRY(IDispatch)
  256. COM_INTERFACE_ENTRY(ISClusResPossibleOwnerNodes)
  257. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  258. END_COM_MAP()
  259. DECLARE_NOT_AGGREGATABLE(CClusResPossibleOwnerNodes)
  260. DECLARE_NO_REGISTRY()
  261. HRESULT Create( IN ISClusRefObject * pClusRefObject, IN HRESOURCE hResource );
  262. STDMETHODIMP get_Count( OUT long * plCount );
  263. STDMETHODIMP get_Item( IN VARIANT varIndex, OUT ISClusNode ** ppClusterNode );
  264. STDMETHODIMP AddItem( IN ISClusNode * pNode );
  265. STDMETHODIMP RemoveItem( IN VARIANT varIndex );
  266. STDMETHODIMP Refresh( void );
  267. STDMETHODIMP get_Modified( OUT VARIANT * pvarModified );
  268. STDMETHODIMP get__NewEnum( OUT IUnknown ** ppunk );
  269. private:
  270. HRESOURCE m_hResource;
  271. BOOL m_bModified;
  272. }; //*** Class CClusResPossibleOwnerNodes
  273. #if CLUSAPI_VERSION >= 0x0500
  274. /////////////////////////////////////////////////////////////////////////////
  275. //++
  276. //
  277. // class CClusResTypePossibleOwnerNodes
  278. //
  279. // Description:
  280. // Cluster Resource Type Possible Owner Nodes Collection Automation Class.
  281. //
  282. // Inheritance:
  283. // IDispatchImpl< ISClusResTypePossibleOwnerNodes, &IID_ISClusResTypePossibleOwnerNodes, &LIBID_MSClusterLib, MAJORINTERFACEVER, MINORINTERFACEVER >,
  284. // CSupportErrorInfo
  285. // CComObjectRootEx< CComSingleThreadModel >
  286. // CNodes
  287. // CComCoClass< CClusResTypePossibleOwnerNodes, &CLSID_ClusResTypePossibleOwnerNodes >
  288. //
  289. //--
  290. /////////////////////////////////////////////////////////////////////////////
  291. class ATL_NO_VTABLE CClusResTypePossibleOwnerNodes :
  292. public IDispatchImpl< ISClusResTypePossibleOwnerNodes, &IID_ISClusResTypePossibleOwnerNodes, &LIBID_MSClusterLib, MAJORINTERFACEVER, MINORINTERFACEVER >,
  293. public CSupportErrorInfo,
  294. public CComObjectRootEx< CComSingleThreadModel >,
  295. public CNodes,
  296. public CComCoClass< CClusResTypePossibleOwnerNodes, &CLSID_ClusResTypePossibleOwnerNodes >
  297. {
  298. typedef CComObjectRootEx< CComSingleThreadModel > BaseComClass;
  299. public:
  300. CClusResTypePossibleOwnerNodes( void );
  301. ~CClusResTypePossibleOwnerNodes( void );
  302. BEGIN_COM_MAP(CClusResTypePossibleOwnerNodes)
  303. COM_INTERFACE_ENTRY(IDispatch)
  304. COM_INTERFACE_ENTRY(ISClusResTypePossibleOwnerNodes)
  305. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  306. END_COM_MAP()
  307. DECLARE_NOT_AGGREGATABLE(CClusResTypePossibleOwnerNodes)
  308. DECLARE_NO_REGISTRY()
  309. HRESULT Create( IN ISClusRefObject * pClusRefObject, IN BSTR bstrResTypeName );
  310. STDMETHODIMP get_Count( OUT long * plCount );
  311. STDMETHODIMP get_Item( IN VARIANT varIndex, OUT ISClusNode ** ppClusterNode );
  312. STDMETHODIMP Refresh( void );
  313. STDMETHODIMP get__NewEnum( OUT IUnknown ** ppunk );
  314. private:
  315. CComBSTR m_bstrResTypeName;
  316. }; //*** Class CClusResTypePossibleOwnerNodes
  317. #endif // CLUSAPI_VERSION >= 0x0500
  318. #endif // _CLUSNODE_H_