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.

199 lines
6.4 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 IP Address.
  68. DWORD
  69. DwGetClusterIPAddress( void ) const throw() { return m_dwClusterIPAddress; }
  70. // Get the cluster service account credentials.
  71. IClusCfgCredentials &
  72. GetServiceAccountCredentials( void ) const throw() { return *m_pcccServiceAccount; }
  73. // Get the cluster service account UPN
  74. CStr
  75. StrGetServiceAccountUPN( void );
  76. // Get the cluster binding string.
  77. const CStr &
  78. RStrGetClusterBindingString( void ) const throw() { return m_strClusterBindingString; }
  79. // Get the SID of the cluster service account.
  80. SID *
  81. PSidGetServiceAccountSID( void ) const throw() { return m_sspClusterAccountSid.PMem(); }
  82. // Get the LSA policy handle.
  83. LSA_HANDLE
  84. HGetLSAPolicyHandle( void ) const throw() { return m_slsahPolicyHandle.HHandle(); }
  85. // Get the NodeId of this node.
  86. virtual const WCHAR *
  87. PszGetNodeIdString( void ) const throw() = 0;
  88. // Indicates if version checking is disabled or not.
  89. bool
  90. FIsVersionCheckingDisabled( void ) const throw() { return m_fIsVersionCheckingDisabled; }
  91. protected:
  92. //////////////////////////////////////////////////////////////////////////
  93. // Constructors and destructors
  94. //////////////////////////////////////////////////////////////////////////
  95. // Constructor.
  96. CBaseClusterAddNode(
  97. CBCAInterface * pbcaiInterfaceIn
  98. , const WCHAR * pcszClusterNameIn
  99. , const WCHAR * pszClusterBindingStringIn
  100. , IClusCfgCredentials * pcccServiceAccountIn
  101. , DWORD dwClusterIPAddressIn
  102. );
  103. // Default destructor.
  104. ~CBaseClusterAddNode( void ) throw();
  105. //////////////////////////////////////////////////////////////////////////
  106. // Protected accessors
  107. //////////////////////////////////////////////////////////////////////////
  108. // Set the name of the cluster being formed.
  109. void
  110. SetClusterName( const WCHAR * pszClusterNameIn );
  111. // Set the cluster IP Address
  112. void
  113. SetClusterIPAddress( DWORD dwClusterIPAddressIn )
  114. {
  115. m_dwClusterIPAddress = dwClusterIPAddressIn;
  116. }
  117. void
  118. SetVersionCheckingDisabled( bool fDisabledIn = true )
  119. {
  120. m_fIsVersionCheckingDisabled = fDisabledIn;
  121. }
  122. private:
  123. //////////////////////////////////////////////////////////////////////////
  124. // Private types
  125. //////////////////////////////////////////////////////////////////////////
  126. typedef CBaseClusterAction BaseClass;
  127. typedef CSmartGenericPtr< CPtrTrait< SID > > SmartSIDPtr;
  128. typedef CSmartResource<
  129. CHandleTrait<
  130. LSA_HANDLE
  131. , NTSTATUS
  132. , LsaClose
  133. >
  134. >
  135. SmartLSAHandle;
  136. //////////////////////////////////////////////////////////////////////////
  137. // Private data
  138. //////////////////////////////////////////////////////////////////////////
  139. // Name of the cluster
  140. CStr m_strClusterName;
  141. CStr m_strClusterNetBIOSName;
  142. // Name and version information of this computer
  143. WCHAR m_szComputerName[ MAX_COMPUTERNAME_LENGTH + 1 ];
  144. DWORD m_dwComputerNameLen;
  145. DWORD m_dwNodeHighestVersion;
  146. DWORD m_dwNodeLowestVersion;
  147. DWORD m_dwClusterIPAddress;
  148. bool m_fIsVersionCheckingDisabled;
  149. // Cluster service account information.
  150. IClusCfgCredentials * m_pcccServiceAccount;
  151. CStr m_strClusterDomainAccount;
  152. CStr m_strClusterBindingString;
  153. SmartSIDPtr m_sspClusterAccountSid;
  154. // Smart handle to the LSA policy.
  155. SmartLSAHandle m_slsahPolicyHandle;
  156. }; //*** class CBaseClusterAddNode