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.

162 lines
6.5 KiB

  1. /*++
  2. Copyright(c) 1998,99 Microsoft Corporation
  3. Module Name:
  4. wlbscfg.h
  5. Abstract:
  6. Windows Load Balancing Service (WLBS)
  7. Notifier object - Provide the functionality of notifier object
  8. Author:
  9. fengsun
  10. --*/
  11. #pragma once
  12. #include <netcfgx.h>
  13. #include "wlbsparm.h"
  14. #define WLBS_MAX_PASSWORD 16
  15. struct NETCFG_WLBS_PORT_RULE {
  16. TCHAR virtual_ip_addr [CVY_MAX_CL_IP_ADDR + 1]; // Virtual IP Address
  17. DWORD start_port; // Starting port number.
  18. DWORD end_port; // Ending port number.
  19. DWORD mode; // Filtering mode. WLBS_PORT_RULE_XXXX
  20. DWORD protocol; // WLBS_TCP, WLBS_UDP or WLBS_TCP_UDP
  21. union {
  22. struct {
  23. DWORD priority; // Mastership priority: 1..32 or 0 for not-specified.
  24. } single; // Data for single server mode.
  25. struct {
  26. WORD equal_load; // TRUE - Even load distribution.
  27. WORD affinity; // WLBS_AFFINITY_XXX
  28. DWORD load; // Percentage of load to handle locally 0..100.
  29. } multi; // Data for multi-server mode.
  30. } mode_data; // Data for appropriate port group mode.
  31. };
  32. /* This is not visible from the UI, but we need it
  33. to correct some bad configuration on binding. */
  34. struct NETCFG_WLBS_BDA_TEAMING {
  35. WCHAR team_id[CVY_MAX_BDA_TEAM_ID + 1]; /* The team ID - MUST be a GUID. */
  36. ULONG active; /* On write, this flag determines whether to create BDATeaming key - BDA on/off switch. */
  37. ULONG master; /* Boolean indication of master status. */
  38. ULONG reverse_hash; /* Sets direction of hashing - forward (normal) or reverse. */
  39. };
  40. struct NETCFG_WLBS_CONFIG {
  41. DWORD dwHostPriority; // Host priority ID.
  42. DWORD dwPersistedStates; // The states that will be persisted across reboot.
  43. DWORD dwInitialState; // The states that will be persisted across reboot.
  44. bool fRctEnabled; // TRUE - remote control enabled.
  45. bool fMcastSupport; // TRUE - multicast mode, FALSE - unicast mode.
  46. bool fIGMPSupport; // TRUE - IGMP enabled.
  47. bool fIpToMCastIp; // TRUE - derive multicast IP from cluster IP.
  48. WCHAR szMCastIpAddress[CVY_MAX_CL_IP_ADDR + 1]; // The multicast IP address, if user-specified.
  49. TCHAR cl_mac_addr[CVY_MAX_NETWORK_ADDR + 1]; // Cluster MAC address.
  50. TCHAR cl_ip_addr[CVY_MAX_CL_IP_ADDR + 1]; // Cluster IP address.
  51. TCHAR cl_net_mask[CVY_MAX_CL_NET_MASK + 1]; // Netmask for cluster IP.
  52. TCHAR ded_ip_addr[CVY_MAX_DED_IP_ADDR + 1]; // Dedicated IP address or "" for none.
  53. TCHAR ded_net_mask[CVY_MAX_DED_NET_MASK + 1]; // Netmask for dedicated IP address or "" for none.
  54. TCHAR domain_name[CVY_MAX_DOMAIN_NAME + 1]; // Full Qualified Domain Name of the cluster.
  55. bool fChangePassword; // Whether to change password, valid for SetAdapterConfig only.
  56. TCHAR szPassword[CVY_MAX_RCT_CODE + 1]; // Remote control password, valid for SetAdapterConfig only.
  57. bool fConvertMac; // Whether the mac address is generated from IP.
  58. DWORD dwMaxHosts; // Maximum # hosts allowed.
  59. DWORD dwMaxRules; // Maximum # port group rules allowed.
  60. DWORD dwNumRules; // # active port group rules
  61. NETCFG_WLBS_BDA_TEAMING bda_teaming; /* The BDA teaming config, which is NOT visible in the UI. */
  62. NETCFG_WLBS_PORT_RULE port_rules[CVY_MAX_RULES]; // Port rules
  63. };
  64. class CNetcfgCluster;
  65. struct WlbsApiFuncs;
  66. //+----------------------------------------------------------------------------
  67. //
  68. // class CWlbsConfig
  69. //
  70. // Description: Provide the functionality for the notifier object.
  71. // It would be used by TCPIP notifier if WLBS UI merged with TCPIP
  72. //
  73. // History: fengsun Created Header 2/11/00
  74. //
  75. //+----------------------------------------------------------------------------
  76. class CWlbsConfig
  77. {
  78. public:
  79. CWlbsConfig(VOID);
  80. ~CWlbsConfig(VOID);
  81. STDMETHOD (Initialize) (IN INetCfg* pINetCfg, IN BOOL fInstalling);
  82. STDMETHOD (ReadAnswerFile) (PCWSTR szAnswerFile, PCWSTR szAnswerSections);
  83. STDMETHOD (Upgrade) (DWORD, DWORD);
  84. STDMETHOD (Install) (DWORD);
  85. STDMETHOD (Removing) ();
  86. STDMETHOD (QueryBindingPath) (DWORD dwChangeFlag, INetCfgComponent * pAdapter);
  87. STDMETHOD (NotifyBindingPath) (DWORD dwChangeFlag, INetCfgBindingPath * pncbp);
  88. STDMETHOD (GetAdapterConfig) (const GUID & AdapterGuid, NETCFG_WLBS_CONFIG * pClusterConfig);
  89. STDMETHOD (SetAdapterConfig) (const GUID & AdapterGuid, NETCFG_WLBS_CONFIG * pClusterConfig);
  90. STDMETHOD_(void, SetDefaults) (NETCFG_WLBS_CONFIG * pClusterConfig);
  91. STDMETHOD (ApplyRegistryChanges) ();
  92. STDMETHOD (ApplyPnpChanges) ();
  93. STDMETHOD (ValidateProperties) (HWND hwndSheet, GUID adapterGUID, NETCFG_WLBS_CONFIG * adapterConfig);
  94. STDMETHOD (CheckForDuplicateCLusterIPAddresses) (GUID adapterGUID, NETCFG_WLBS_CONFIG * adapterConfig);
  95. STDMETHOD (CheckForDuplicateBDATeamMasters) (GUID adapterGUID, NETCFG_WLBS_CONFIG * adapterConfig);
  96. #ifdef DEBUG
  97. void AssertValid();
  98. #endif
  99. protected:
  100. CNetcfgCluster * GetCluster (const GUID& AdapterGuid);
  101. HRESULT LoadAllAdapterSettings (bool fUpgradeFromWin2k);
  102. vector<CNetcfgCluster*> m_vtrCluster; // List of clusters.
  103. HANDLE m_hDeviceWlbs; // Handle to the WLBS device object.
  104. enum ENUM_WLBS_SERVICE {
  105. WLBS_SERVICE_NONE,
  106. WLBS_SERVICE_INSTALL,
  107. WLBS_SERVICE_REMOVE,
  108. WLBS_SERVICE_UPGRADE
  109. };
  110. ENUM_WLBS_SERVICE m_ServiceOperation; // Operations to be applied
  111. INetCfgComponent * m_pWlbsComponent; // Wlbs Component.
  112. public:
  113. HRESULT IsBoundTo (INetCfgComponent* pAdapter);
  114. ULONG CountNLBBindings ();
  115. //
  116. // To avoid link with wlbsctrl.dll, which only shiped in adavanced server
  117. // Can not put them as global variables, because multiple instance of this
  118. // object could exist
  119. //
  120. INetCfg * m_pNetCfg;
  121. HINSTANCE m_hdllWlbsCtrl;
  122. WlbsApiFuncs * m_pWlbsApiFuncs;
  123. };