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.

219 lines
7.0 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 2000 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // CBaseClusterAddNode.h
  7. //
  8. // Description:
  9. // Header file for CBaseClusterAddNode class.
  10. //
  11. // The CBaseClusterAddNode class is a class that captures the commonality
  12. // between forming and joining a cluster.
  13. //
  14. // Implementation Files:
  15. // CBaseClusterAddNode.cpp
  16. //
  17. // Maintained By:
  18. // Vij Vasu (Vvasu) 03-MAR-2000
  19. //
  20. //////////////////////////////////////////////////////////////////////////////
  21. // Make sure that this file is included only once per compile path.
  22. #pragma once
  23. //////////////////////////////////////////////////////////////////////////
  24. // Include Files
  25. //////////////////////////////////////////////////////////////////////////
  26. // For the base class of this class.
  27. #include "CBaseClusterAction.h"
  28. // For LsaClose, LSA_HANDLE, etc.
  29. #include <ntsecapi.h>
  30. // For the CStr class.
  31. #include "CStr.h"
  32. //////////////////////////////////////////////////////////////////////////////
  33. //++
  34. //
  35. // class CBaseClusterAddNode
  36. //
  37. // Description:
  38. // The CBaseClusterAddNode class is a class that captures the commonality
  39. // between forming and joining a cluster.
  40. //
  41. //--
  42. //////////////////////////////////////////////////////////////////////////////
  43. class CBaseClusterAddNode : public CBaseClusterAction
  44. {
  45. public:
  46. //////////////////////////////////////////////////////////////////////////
  47. // Public accessors
  48. //////////////////////////////////////////////////////////////////////////
  49. // Get the name of the cluster being formed or joined.
  50. const CStr &
  51. RStrGetClusterName( void ) const throw() { return m_strClusterName; }
  52. // Get the NetBIOS name of the cluster being formed or joined.
  53. const CStr &
  54. RStrGetClusterNetBIOSName( void ) const throw() { return m_strClusterNetBIOSName; }
  55. // Get the name of this node.
  56. const WCHAR *
  57. PszGetNodeName( void ) const throw() { return m_szComputerName; }
  58. // Get the length of the name of this node..
  59. DWORD
  60. DwGetNodeNameLength( void ) const throw() { return m_dwComputerNameLen; }
  61. // Get the node highest version.
  62. DWORD
  63. DwGetNodeHighestVersion( void ) const throw() { return m_dwNodeHighestVersion; }
  64. // Get the node lowest version.
  65. DWORD
  66. DwGetNodeLowestVersion( void ) const throw() { return m_dwNodeLowestVersion; }
  67. // Get the cluster service account name.
  68. const CStr &
  69. RStrGetServiceAccountName( void ) const throw() { return m_strClusterAccountName; }
  70. // Get the cluster service account domain.
  71. const CStr &
  72. RStrGetServiceAccountDomain( void ) const throw() { return m_strClusterAccountDomain; }
  73. // Get the cluster service domain account
  74. const CStr &
  75. RStrGetServiceDomainAccountName( void ) const throw() { return m_strClusterDomainAccount; }
  76. // Get the cluster service account password.
  77. const CStr &
  78. RStrGetServiceAccountPassword( void ) const throw() { return m_strClusterAccountPwd; }
  79. // Get the cluster binding string.
  80. const CStr &
  81. RStrGetClusterBindingString( void ) const throw() { return m_strClusterBindingString; }
  82. // Get the SID of the cluster service account.
  83. SID *
  84. PSidGetServiceAccountSID( void ) const throw() { return m_sspClusterAccountSid.PMem(); }
  85. // Get the LSA policy handle.
  86. LSA_HANDLE
  87. HGetLSAPolicyHandle( void ) const throw() { return m_slsahPolicyHandle.HHandle(); }
  88. // Get the NodeId of this node.
  89. virtual const WCHAR *
  90. PszGetNodeIdString( void ) const throw() = 0;
  91. // Indicates if version checking is disabled or not.
  92. bool
  93. FIsVersionCheckingDisabled( void ) const throw() { return m_fIsVersionCheckingDisabled; }
  94. protected:
  95. //////////////////////////////////////////////////////////////////////////
  96. // Constructors and destructors
  97. //////////////////////////////////////////////////////////////////////////
  98. // Constructor.
  99. CBaseClusterAddNode(
  100. CBCAInterface * pbcaiInterfaceIn
  101. , const WCHAR * pcszClusterNameIn
  102. , const WCHAR * pszClusterBindingStringIn
  103. , const WCHAR * pcszClusterAccountNameIn
  104. , const WCHAR * pcszClusterAccountPwdIn
  105. , const WCHAR * pcszClusterAccountDomainIn
  106. );
  107. // Default destructor.
  108. ~CBaseClusterAddNode( void ) throw();
  109. //////////////////////////////////////////////////////////////////////////
  110. // Protected accessors
  111. //////////////////////////////////////////////////////////////////////////
  112. // Set the name of the cluster being formed.
  113. void
  114. SetClusterName( const WCHAR * pszClusterNameIn );
  115. // Set the cluster service account name.
  116. void
  117. SetServiceAccountName( const WCHAR * pszClusterAccountNameIn )
  118. {
  119. m_strClusterAccountName = pszClusterAccountNameIn;
  120. }
  121. // Set the cluster service account domain.
  122. void
  123. SetServiceAccountDomain( const WCHAR * pszClusterAccountDomainIn )
  124. {
  125. m_strClusterAccountDomain = pszClusterAccountDomainIn;
  126. }
  127. // Set the cluster service account password.
  128. void
  129. SetServiceAccountPassword( const WCHAR * pszClusterAccountPwdIn )
  130. {
  131. m_strClusterAccountPwd = pszClusterAccountPwdIn;
  132. }
  133. void
  134. SetVersionCheckingDisabled( bool fDisabledIn = true )
  135. {
  136. m_fIsVersionCheckingDisabled = fDisabledIn;
  137. }
  138. private:
  139. //////////////////////////////////////////////////////////////////////////
  140. // Private types
  141. //////////////////////////////////////////////////////////////////////////
  142. typedef CBaseClusterAction BaseClass;
  143. typedef CSmartGenericPtr< CPtrTrait< SID > > SmartSIDPtr;
  144. typedef CSmartResource<
  145. CHandleTrait<
  146. LSA_HANDLE
  147. , NTSTATUS
  148. , LsaClose
  149. >
  150. >
  151. SmartLSAHandle;
  152. //////////////////////////////////////////////////////////////////////////
  153. // Private data
  154. //////////////////////////////////////////////////////////////////////////
  155. // Name of the cluster
  156. CStr m_strClusterName;
  157. CStr m_strClusterNetBIOSName;
  158. // Name and version information of this computer
  159. WCHAR m_szComputerName[ MAX_COMPUTERNAME_LENGTH + 1 ];
  160. DWORD m_dwComputerNameLen;
  161. DWORD m_dwNodeHighestVersion;
  162. DWORD m_dwNodeLowestVersion;
  163. bool m_fIsVersionCheckingDisabled;
  164. // Cluster service account information.
  165. CStr m_strClusterAccountName;
  166. CStr m_strClusterAccountPwd;
  167. CStr m_strClusterAccountDomain;
  168. CStr m_strClusterDomainAccount;
  169. CStr m_strClusterBindingString;
  170. SmartSIDPtr m_sspClusterAccountSid;
  171. // Smart handle to the LSA policy.
  172. SmartLSAHandle m_slsahPolicyHandle;
  173. }; //*** class CBaseClusterAddNode