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.

227 lines
4.5 KiB

  1. /*
  2. * Filename: NLB_Common.h
  3. * Description:
  4. * Author: shouse, 04.10.01
  5. */
  6. #ifndef __NLB_COMMON_H__
  7. #define __NLB_COMMON_H__
  8. #include "stdafx.h"
  9. #include "wlbsparm.h"
  10. #include <vector>
  11. using namespace std;
  12. #define NLB_MAX_NAME 100
  13. #define NLB_MAX_HOST_NAME 100
  14. #define NLB_MAX_DOMAIN_NAME 100
  15. #define NLB_MAX_IPADDRESS 15
  16. #define NLB_MAX_SUBNETMASK 15
  17. #define NLB_MAX_NETWORK_ADDRESS 17
  18. #define NLB_MAX_ADAPTER_GUID 40
  19. #define NLB_MAX_ADAPTER_NAME 100
  20. #define NLB_MAX_LABEL 100
  21. #define NLB_MAX_PASSWORD 16
  22. #define NLB_MIN_HOST_ID 0
  23. #define NLB_MAX_HOST_ID 32
  24. class NLB_Label {
  25. public:
  26. NLB_Label ();
  27. ~NLB_Label ();
  28. bool IsValid ();
  29. bool GetText (PWSTR * outText);
  30. bool SetText (PWSTR inText);
  31. private:
  32. WCHAR Text[NLB_MAX_LABEL + 1];
  33. };
  34. class NLB_Name {
  35. public:
  36. NLB_Name ();
  37. ~NLB_Name ();
  38. bool IsValid ();
  39. bool GetName (PWSTR * outName);
  40. bool SetName (PWSTR inName);
  41. private:
  42. WCHAR Name[NLB_MAX_NAME + 1];
  43. };
  44. class NLB_HostID {
  45. public:
  46. NLB_HostID ();
  47. ~NLB_HostID ();
  48. bool IsValid ();
  49. bool GetID (int * outID);
  50. bool SetID (int inID);
  51. private:
  52. int ID;
  53. };
  54. class NLB_HostName {
  55. public:
  56. NLB_HostName ();
  57. ~NLB_HostName ();
  58. bool IsValid ();
  59. bool GetName (PWSTR * outName);
  60. bool SetName (PWSTR inName);
  61. private:
  62. WCHAR Name[NLB_MAX_HOST_NAME + 1];
  63. };
  64. class NLB_RemoteControl {
  65. public:
  66. typedef enum {
  67. Invalid = -1,
  68. No,
  69. Yes
  70. } NLB_RemoteControlEnabled;
  71. NLB_RemoteControl ();
  72. ~NLB_RemoteControl ();
  73. bool IsValid ();
  74. bool GetPassword (PWSTR * outName);
  75. bool GetEnabled (NLB_RemoteControlEnabled * outEnabled);
  76. bool SetPassword (PWSTR inName);
  77. bool SetEnabled (NLB_RemoteControlEnabled inEnabled);
  78. private:
  79. NLB_RemoteControlEnabled Enabled;
  80. WCHAR Password[NLB_MAX_PASSWORD + 1];
  81. };
  82. class NLB_DomainName {
  83. public:
  84. NLB_DomainName ();
  85. ~NLB_DomainName ();
  86. bool IsValid ();
  87. bool GetDomain (PWSTR * outDomain);
  88. bool SetDomain (PWSTR inDomain);
  89. private:
  90. WCHAR Domain[NLB_MAX_DOMAIN_NAME + 1];
  91. };
  92. class NLB_NetworkAddress {
  93. public:
  94. NLB_NetworkAddress ();
  95. ~NLB_NetworkAddress ();
  96. bool IsValid ();
  97. bool GetAddress (PWSTR * outAddress);
  98. bool SetAddress (PWSTR inAddress);
  99. private:
  100. WCHAR Address[NLB_MAX_NETWORK_ADDRESS + 1];
  101. };
  102. class NLB_ClusterMode {
  103. public:
  104. typedef enum {
  105. Invalid = -1,
  106. Unicast,
  107. Multicast,
  108. IGMP
  109. } NLB_ClusterModeType;
  110. NLB_ClusterMode ();
  111. ~NLB_ClusterMode ();
  112. bool IsValid ();
  113. bool GetMode (NLB_ClusterModeType * outMode);
  114. bool SetMode (NLB_ClusterModeType inMode);
  115. private:
  116. NLB_ClusterModeType Mode;
  117. };
  118. class NLB_HostState {
  119. public:
  120. typedef enum {
  121. Invalid = -1,
  122. Started,
  123. Stopped,
  124. Suspended
  125. } NLB_HostStateType;
  126. NLB_HostState ();
  127. ~NLB_HostState ();
  128. bool IsValid ();
  129. bool GetState (NLB_HostStateType * outState);
  130. bool SetState (NLB_HostStateType inState);
  131. private:
  132. NLB_HostStateType State;
  133. };
  134. class NLB_Adapter {
  135. public:
  136. typedef enum {
  137. Invalid = -1,
  138. ByGUID,
  139. ByName
  140. } NLB_AdapterIdentifier;
  141. NLB_Adapter ();
  142. ~NLB_Adapter ();
  143. bool IsValid ();
  144. bool GetAdapter (PWSTR * outAdapter);
  145. bool GetIdentifiedBy (NLB_AdapterIdentifier * outIdentifiedBy);
  146. bool SetAdapter (PWSTR inAdapter);
  147. bool SetIdentifiedBy (NLB_AdapterIdentifier inIdentifiedBy);
  148. private:
  149. NLB_AdapterIdentifier IdentifiedBy;
  150. struct {
  151. WCHAR Name[NLB_MAX_ADAPTER_NAME + 1];
  152. WCHAR GUID[NLB_MAX_ADAPTER_GUID + 1];
  153. };
  154. };
  155. class NLB_IPAddress {
  156. public:
  157. typedef enum {
  158. Invalid = -1,
  159. Primary,
  160. Secondary,
  161. Virtual,
  162. Dedicated,
  163. Connection,
  164. IGMP
  165. } NLB_IPAddressType;
  166. NLB_IPAddress ();
  167. ~NLB_IPAddress ();
  168. bool IsValid ();
  169. bool GetIPAddressType (NLB_IPAddressType * outType);
  170. bool GetIPAddress (PWSTR * outIPAddress);
  171. bool GetSubnetMask (PWSTR * outSubnetMask);
  172. bool SetIPAddressType (NLB_IPAddressType inType);
  173. bool SetIPAddress (PWSTR inIPAddress);
  174. bool SetSubnetMask (PWSTR inSubnetMask);
  175. NLB_Adapter * GetAdapter ();
  176. private:
  177. NLB_IPAddressType Type;
  178. NLB_Adapter Adapter;
  179. WCHAR IPAddress[NLB_MAX_IPADDRESS + 1];
  180. WCHAR SubnetMask[NLB_MAX_SUBNETMASK + 1];
  181. };
  182. #endif