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.

224 lines
6.8 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 2000-2001 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // CClusCfgCallback.h
  7. //
  8. // Description:
  9. // This file contains the declaration of the CClusCfgCallback
  10. // class.
  11. //
  12. // The class CClusCfgCallback inplements the callback
  13. // interface between this server and its clients. It implements the
  14. // IClusCfgCallback interface.
  15. //
  16. // Documentation:
  17. //
  18. // Implementation Files:
  19. // CClusCfgCallback.cpp
  20. //
  21. // Maintained By:
  22. // Galen Barbee (GalenB) 22-FEB-2000
  23. //
  24. //////////////////////////////////////////////////////////////////////////////
  25. // Make sure that this file is included only once per compile path.
  26. #pragma once
  27. #include <ClusCfgDef.h>
  28. //////////////////////////////////////////////////////////////////////////////
  29. // Include Files
  30. //////////////////////////////////////////////////////////////////////////////
  31. #include <ClusCfgPrivate.h>
  32. #include "PrivateInterfaces.h"
  33. // For ILogger
  34. #include <ClusCfgClient.h>
  35. //////////////////////////////////////////////////////////////////////////////
  36. // Constant Declarations
  37. //////////////////////////////////////////////////////////////////////////////
  38. //
  39. // Timeout for when ClusCfgCallback on the server is waiting for the client
  40. // to pick up the queued status report.
  41. //
  42. const DWORD CCC_WAIT_TIMEOUT = CC_DEFAULT_TIMEOUT;
  43. //////////////////////////////////////////////////////////////////////////////
  44. //++
  45. //
  46. // class CClusCfgCallback
  47. //
  48. // Description:
  49. // The class CClusCfgCallback inplements the callback
  50. // interface between this server and its clients.
  51. //
  52. // Interfaces:
  53. // IClusCfgCallback
  54. // IClusCfgInitialize
  55. // IClusCfgPollingCallback
  56. // IClusCfgSetPollingCallback
  57. //
  58. //--
  59. //////////////////////////////////////////////////////////////////////////////
  60. class CClusCfgCallback
  61. : public IClusCfgCallback
  62. , public IClusCfgInitialize
  63. , public IClusCfgPollingCallback
  64. , public IClusCfgSetPollingCallback
  65. {
  66. private:
  67. //
  68. // Private member functions and data
  69. //
  70. LONG m_cRef;
  71. IClusCfgCallback * m_pccc;
  72. LCID m_lcid;
  73. HANDLE m_hEvent;
  74. HRESULT m_hr;
  75. BOOL m_fPollingMode;
  76. BSTR m_bstrNodeName;
  77. LPCWSTR m_pcszNodeName;
  78. CLSID * m_pclsidTaskMajor;
  79. CLSID * m_pclsidTaskMinor;
  80. ULONG * m_pulMin;
  81. ULONG * m_pulMax;
  82. ULONG * m_pulCurrent;
  83. HRESULT * m_phrStatus;
  84. LPCWSTR m_pcszDescription;
  85. FILETIME * m_pftTime;
  86. LPCWSTR m_pcszReference;
  87. ILogger * m_plLogger; // ILogger for doing logging.
  88. //
  89. // Since actually hitting a stalling RPC problem is rare and hard I decided to write code
  90. // that would simulate that failure. These variables are used for that purpose.
  91. //
  92. #if defined( DEBUG ) && defined( CCS_SIMULATE_RPC_FAILURE )
  93. int m_cMessages; // How many messages have gone through.
  94. bool m_fDoFailure; // When true forces an RPC error.
  95. #endif
  96. // Private constructors and destructors
  97. CClusCfgCallback( void );
  98. ~CClusCfgCallback( void );
  99. // Private copy constructor to prevent copying.
  100. CClusCfgCallback( const CClusCfgCallback & rcccSrcIn );
  101. // Private assignment operator to prevent copying.
  102. CClusCfgCallback & operator = ( const CClusCfgCallback & rcccSrcIn );
  103. HRESULT HrInit( void );
  104. HRESULT HrQueueStatusReport(
  105. LPCWSTR pcszNodeNameIn,
  106. CLSID clsidTaskMajorIn,
  107. CLSID clsidTaskMinorIn,
  108. ULONG ulMinIn,
  109. ULONG ulMaxIn,
  110. ULONG ulCurrentIn,
  111. HRESULT hrStatusIn,
  112. LPCWSTR pcszDescriptionIn,
  113. FILETIME * pftTimeIn,
  114. LPCWSTR pcszReferenceIn
  115. );
  116. public:
  117. //
  118. // Public, non interface methods.
  119. //
  120. static HRESULT S_HrCreateInstance( IUnknown ** ppunkOut );
  121. STDMETHOD( SendStatusReport )(
  122. CLSID clsidTaskMajorIn,
  123. CLSID clsidTaskMinorIn,
  124. ULONG ulMinIn,
  125. ULONG ulMaxIn,
  126. ULONG ulCurrentIn,
  127. HRESULT hrStatusIn,
  128. const WCHAR * pcszDescriptionIn
  129. );
  130. STDMETHOD( SendStatusReport )(
  131. CLSID clsidTaskMajorIn,
  132. CLSID clsidTaskMinorIn,
  133. ULONG ulMinIn,
  134. ULONG ulMaxIn,
  135. ULONG ulCurrentIn,
  136. HRESULT hrStatusIn,
  137. DWORD dwDescriptionIn
  138. );
  139. //
  140. // IUnknown Interfaces
  141. //
  142. STDMETHOD( QueryInterface )( REFIID riid, void ** ppvObject );
  143. STDMETHOD_( ULONG, AddRef )( void );
  144. STDMETHOD_( ULONG, Release )( void );
  145. //
  146. // IClusCfgCallback Interfaces.
  147. //
  148. STDMETHOD( SendStatusReport )(
  149. LPCWSTR pcszNodeNameIn,
  150. CLSID clsidTaskMajorIn,
  151. CLSID clsidTaskMinorIn,
  152. ULONG ulMinIn,
  153. ULONG ulMaxIn,
  154. ULONG ulCurrentIn,
  155. HRESULT hrStatusIn,
  156. LPCWSTR pcszDescriptionIn,
  157. FILETIME * pftTimeIn,
  158. LPCWSTR pcszReference
  159. );
  160. //
  161. // IClusCfgPollingCallback Interfaces.
  162. //
  163. STDMETHOD( GetStatusReport )(
  164. BSTR * pbstrNodeNameOut,
  165. CLSID * pclsidTaskMajorOut,
  166. CLSID * pclsidTaskMinorOut,
  167. ULONG * pulMinOut,
  168. ULONG * pulMaxOut,
  169. ULONG * pulCurrentOut,
  170. HRESULT * phrStatusOut,
  171. BSTR * pbstrDescriptionOut,
  172. FILETIME * pftTimeOut,
  173. BSTR * pbstrReferenceOut
  174. );
  175. STDMETHOD( SetHResult )( HRESULT hrIn );
  176. //
  177. // IClusCfgInitialize Interfaces.
  178. //
  179. STDMETHOD( Initialize )( IUnknown * punkCallbackIn, LCID lcidIn );
  180. //
  181. // IClusCfgSetPollingCallback Interfaces.
  182. //
  183. STDMETHOD( SetPollingMode )( BOOL fUsePollingModeIn );
  184. }; //*** Class CClusCfgCallback