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.

147 lines
5.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. struct NETCFG_WLBS_CONFIG {
  33. DWORD dwHostPriority; // Host priority ID.
  34. bool fRctEnabled; // TRUE - remote control enabled.
  35. bool fJoinClusterOnBoot; // TRUE - join cluster on boot.
  36. bool fMcastSupport; // TRUE - multicast mode, FALSE - unicast mode.
  37. bool fIGMPSupport; // TRUE - IGMP enabled.
  38. bool fIpToMCastIp; // TRUE - derive multicast IP from cluster IP.
  39. WCHAR szMCastIpAddress[CVY_MAX_CL_IP_ADDR + 1]; // The multicast IP address, if user-specified.
  40. TCHAR cl_mac_addr[CVY_MAX_NETWORK_ADDR + 1]; // Cluster MAC address.
  41. TCHAR cl_ip_addr[CVY_MAX_CL_IP_ADDR + 1]; // Cluster IP address.
  42. TCHAR cl_net_mask[CVY_MAX_CL_NET_MASK + 1]; // Netmask for cluster IP.
  43. TCHAR ded_ip_addr[CVY_MAX_DED_IP_ADDR + 1]; // Dedicated IP address or "" for none.
  44. TCHAR ded_net_mask[CVY_MAX_DED_NET_MASK + 1]; // Netmask for dedicated IP address or "" for none.
  45. TCHAR domain_name[CVY_MAX_DOMAIN_NAME + 1]; // Full Qualified Domain Name of the cluster.
  46. bool fChangePassword; // Whether to change password, valid for SetAdapterConfig only.
  47. TCHAR szPassword[CVY_MAX_RCT_CODE + 1]; // Remote control password, valid for SetAdapterConfig only.
  48. bool fConvertMac; // Whether the mac address is generated from IP.
  49. DWORD dwMaxHosts; // Maximum # hosts allowed.
  50. DWORD dwMaxRules; // Maximum # port group rules allowed.
  51. DWORD dwNumRules; // # active port group rules
  52. NETCFG_WLBS_PORT_RULE port_rules[CVY_MAX_RULES]; // Port rules
  53. };
  54. class CNetcfgCluster;
  55. struct WlbsApiFuncs;
  56. //+----------------------------------------------------------------------------
  57. //
  58. // class CWlbsConfig
  59. //
  60. // Description: Provide the functionality for the notifier object.
  61. // It would be used by TCPIP notifier if WLBS UI merged with TCPIP
  62. //
  63. // History: fengsun Created Header 2/11/00
  64. //
  65. //+----------------------------------------------------------------------------
  66. class CWlbsConfig
  67. {
  68. public:
  69. CWlbsConfig(VOID);
  70. ~CWlbsConfig(VOID);
  71. STDMETHOD (Initialize) (IN INetCfg* pINetCfg, IN BOOL fInstalling);
  72. STDMETHOD (ReadAnswerFile) (PCWSTR szAnswerFile, PCWSTR szAnswerSections);
  73. STDMETHOD (Upgrade) (DWORD, DWORD);
  74. STDMETHOD (Install) (DWORD);
  75. STDMETHOD (Removing) ();
  76. STDMETHOD (QueryBindingPath) (DWORD dwChangeFlag, INetCfgComponent * pAdapter);
  77. STDMETHOD (NotifyBindingPath) (DWORD dwChangeFlag, INetCfgBindingPath * pncbp);
  78. STDMETHOD (GetAdapterConfig) (const GUID & AdapterGuid, NETCFG_WLBS_CONFIG * pClusterConfig);
  79. STDMETHOD (SetAdapterConfig) (const GUID & AdapterGuid, NETCFG_WLBS_CONFIG * pClusterConfig);
  80. STDMETHOD_(void, SetDefaults) (NETCFG_WLBS_CONFIG * pClusterConfig);
  81. STDMETHOD (ApplyRegistryChanges) ();
  82. STDMETHOD (ApplyPnpChanges) ();
  83. STDMETHOD (ValidateProperties) (HWND hwndSheet, GUID adapterGUID, NETCFG_WLBS_CONFIG * adapterConfig);
  84. STDMETHOD (CheckForDuplicateCLusterIPAddresses) (GUID adapterGUID, NETCFG_WLBS_CONFIG * adapterConfig);
  85. #ifdef DEBUG
  86. void AssertValid();
  87. #endif
  88. protected:
  89. CNetcfgCluster * GetCluster (const GUID& AdapterGuid);
  90. HRESULT LoadAllAdapterSettings (bool fUpgradeFromWin2k);
  91. vector<CNetcfgCluster*> m_vtrCluster; // List of clusters.
  92. HANDLE m_hDeviceWlbs; // Handle to the WLBS device object.
  93. enum ENUM_WLBS_SERVICE {
  94. WLBS_SERVICE_NONE,
  95. WLBS_SERVICE_INSTALL,
  96. WLBS_SERVICE_REMOVE,
  97. WLBS_SERVICE_UPGRADE
  98. };
  99. ENUM_WLBS_SERVICE m_ServiceOperation; // Operations to be applied
  100. INetCfgComponent * m_pWlbsComponent; // Wlbs Component.
  101. public:
  102. HRESULT IsBoundTo (INetCfgComponent* pAdapter);
  103. //
  104. // To avoid link with wlbsctrl.dll, which only shiped in adavanced server
  105. // Can not put them as global variables, because multiple instance of this
  106. // object could exist
  107. //
  108. INetCfg * m_pNetCfg;
  109. HINSTANCE m_hdllWlbsCtrl;
  110. WlbsApiFuncs * m_pWlbsApiFuncs;
  111. };