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.

197 lines
4.7 KiB

  1. #ifndef _COMMON_H
  2. #define _COMMON_H
  3. //
  4. // Copyright (c) Microsoft. All Rights Reserved
  5. //
  6. // THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF Microsoft.
  7. // The copyright notice above does not evidence any
  8. // actual or intended publication of such source code.
  9. //
  10. // OneLiner : common include file.
  11. // DevUnit : wlbstest
  12. // Author : Murtaza Hakim
  13. //
  14. // Description:
  15. // -----------
  16. // History:
  17. // --------
  18. //
  19. //
  20. // Revised by : mhakim
  21. // Date : 02-12-01
  22. // Reason : added password to clusterproperties.
  23. #include <vector>
  24. #include <wbemidl.h>
  25. #include <comdef.h>
  26. using namespace std;
  27. #if 0
  28. enum WLBS_STATUS
  29. {
  30. WLBS_OK = 1000,
  31. WLBS_ALREADY = 1001,
  32. WLBS_DRAIN_STOP = 1002,
  33. WLBS_BAD_PARAMS = 1003,
  34. WLBS_NOT_FOUND = 1004,
  35. WLBS_STOPPED = 1005,
  36. WLBS_CONVERGING = 1006,
  37. WLBS_CONVERGED = 1007,
  38. WLBS_DEFAULT = 1008,
  39. WLBS_DRAINING = 1009,
  40. WLBS_SUSPENDED = 1013,
  41. WLBS_REBOOT = 1050,
  42. WLBS_INIT_ERROR = 1100,
  43. WLBS_BAD_PASSW = 1101,
  44. WLBS_IO_ERROR = 1102,
  45. WLBS_TIMEOUT = 1103,
  46. WLBS_PORT_OVERLAP = 1150,
  47. WLBS_BAD_PORT_PARAMS = 1151,
  48. WLBS_MAX_PORT_RULES = 1152,
  49. WLBS_TRUNCATED = 1153,
  50. WLBS_REG_ERROR = 1154,
  51. };
  52. #endif
  53. struct NicInfo
  54. {
  55. // default constructor
  56. NicInfo();
  57. // Equality operator
  58. bool
  59. operator==( const NicInfo& objToCompare );
  60. // inequality operator
  61. bool
  62. operator!=( const NicInfo& objToCompare );
  63. _bstr_t fullNicName;
  64. _bstr_t adapterGuid;
  65. _bstr_t friendlyName;
  66. bool dhcpEnabled;
  67. vector<_bstr_t> ipsOnNic;
  68. vector<_bstr_t> subnetMasks;
  69. };
  70. struct ClusterProperties
  71. {
  72. // default constructor
  73. ClusterProperties();
  74. // Equality operator
  75. bool
  76. operator==( const ClusterProperties& objToCompare );
  77. // inequality operator
  78. bool
  79. operator!=( const ClusterProperties& objToCompare );
  80. bool HaveClusterPropertiesChanged( const ClusterProperties& objToCompare,
  81. bool *pbOnlyClusterNameChanged,
  82. bool *pbClusterIpChanged);
  83. _bstr_t cIP; // Primary IP address.
  84. _bstr_t cSubnetMask; // Subnet mask.
  85. _bstr_t cFullInternetName; // Full Internet name.
  86. _bstr_t cNetworkAddress; // Network address.
  87. bool multicastSupportEnabled; // Multicast support.
  88. bool remoteControlEnabled; // Remote control.
  89. // Edited (mhakim 12-02-01)
  90. // password may be required to be set.
  91. // but note that it cannot be got from an existing cluster.
  92. _bstr_t password; // Remote control password.
  93. // for whistler
  94. bool igmpSupportEnabled; // igmp support
  95. bool clusterIPToMulticastIP; // indicates whether to use cluster ip or user provided ip.
  96. _bstr_t multicastIPAddress; // user provided multicast ip.
  97. long igmpJoinInterval; // user provided multicast ip.
  98. };
  99. struct HostProperties
  100. {
  101. // default constructor
  102. HostProperties();
  103. // Equality operator
  104. bool
  105. operator==( const HostProperties& objToCompare );
  106. // inequality operator
  107. bool
  108. operator!=( const HostProperties& objToCompare );
  109. _bstr_t hIP; // Dedicated IP Address.
  110. _bstr_t hSubnetMask; // Subnet mask.
  111. long hID; // Priority(Unique host ID).
  112. bool initialClusterStateActive; // Initial Cluster State.
  113. DWORD hostStatus; // status of host.
  114. NicInfo nicInfo; // info about nic to which nlb bound.
  115. _bstr_t machineName; // machine name.
  116. };
  117. class Common
  118. {
  119. public:
  120. enum
  121. {
  122. BUF_SIZE = 1000,
  123. ALL_PORTS = 0xffffffff,
  124. ALL_HOSTS = 100,
  125. THIS_HOST = 0,
  126. };
  127. //WLBS_STATUS
  128. static
  129. DWORD
  130. getHostsInCluster( _bstr_t clusterIP, vector< HostProperties >* hostPropertiesStore );
  131. static
  132. void
  133. getWLBSErrorString( DWORD errStatus, // IN
  134. _bstr_t& errString, // OUT
  135. _bstr_t& extErrString // OUT
  136. );
  137. static
  138. DWORD
  139. getNLBNicInfoForWin2k( const _bstr_t& machineInfo, NicInfo& nicInfo );
  140. static
  141. DWORD
  142. getNLBNicInfoForWhistler( const _bstr_t& machineInfo, const _bstr_t& guid, NicInfo& nicInfo );
  143. static
  144. _bstr_t
  145. mapNicToClusterIP( const _bstr_t& machineIP,
  146. const _bstr_t& fullNICName );
  147. };
  148. #endif