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.

428 lines
9.2 KiB

  1. #ifndef _MNLBSETTING_H
  2. #define _MNLBSETTING_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 : MNLBProviderSetting interface.
  11. // DevUnit : wlbstest
  12. // Author : Murtaza Hakim
  13. //
  14. // Description:
  15. // -----------
  16. // Include Files
  17. #include "MNLBPortRule.h"
  18. #include "Common.h"
  19. #include "MWmiObject.h"
  20. #include "MWmiInstance.h"
  21. #include <vector>
  22. #include <memory>
  23. #include <comdef.h>
  24. using namespace std;
  25. class MNLBProviderSetting
  26. {
  27. public:
  28. enum MNLBProviderSetting_Error
  29. {
  30. MNLBProviderSetting_SUCCESS = 0,
  31. COM_FAILURE = 1,
  32. UNCONSTRUCTED = 2,
  33. MACHINE_FAILURE = 3,
  34. BOUND = 4,
  35. UNBOUND = 5,
  36. NO_SUCH_NIC = 6,
  37. NLBS_NOT_INSTALLED = 7,
  38. NO_SUCH_IP = 8,
  39. INVALID_RULE = 9,
  40. };
  41. MNLBProviderSetting( _bstr_t fullNICName );
  42. // NOT IMPLEMENTED.
  43. //
  44. //
  45. // Description:
  46. // -----------
  47. // default constructor.
  48. //
  49. // Parameters:
  50. // ----------
  51. // none.
  52. //
  53. // Returns:
  54. // -------
  55. // none.
  56. MNLBProviderSetting();
  57. //
  58. // Description:
  59. // -----------
  60. // copy constructor.
  61. //
  62. // Parameters:
  63. // ----------
  64. // objToCopy IN : object to copy.
  65. //
  66. // Returns:
  67. // -------
  68. // none.
  69. MNLBProviderSetting(const MNLBProviderSetting& objToCopy );
  70. //
  71. // Description:
  72. // -----------
  73. // assignment operator
  74. //
  75. // Parameters:
  76. // ----------
  77. // rhs IN : object to assign.
  78. //
  79. // Returns:
  80. // -------
  81. // self
  82. MNLBProviderSetting&
  83. operator=( const MNLBProviderSetting& rhs );
  84. //
  85. // Description:
  86. // -----------
  87. // destructor
  88. //
  89. // Parameters:
  90. // ----------
  91. // none
  92. //
  93. // Returns:
  94. // -------
  95. // none.
  96. ~MNLBProviderSetting();
  97. //
  98. // Description:
  99. // -----------
  100. // gets the nlbs host properties.
  101. //
  102. // Parameters:
  103. // ----------
  104. // hp OUT : host properties.
  105. //
  106. // Returns:
  107. // -------
  108. // SUCCESS else error code.
  109. MNLBProviderSetting_Error
  110. getHostProperties( HostProperties* hp );
  111. //
  112. // Description:
  113. // -----------
  114. // gets the nlbs cluster properties.
  115. //
  116. // Parameters:
  117. // ----------
  118. // cp OUT : cluster properties.
  119. //
  120. // Returns:
  121. // -------
  122. // SUCCESS else error code.
  123. MNLBProviderSetting_Error
  124. getClusterProperties( ClusterProperties* cp );
  125. //
  126. // Description:
  127. // -----------
  128. // sets the nlbs host properties.
  129. //
  130. // Parameters:
  131. // ----------
  132. // hp IN : host properties to set.
  133. // retVal OUT : return value of method ran.
  134. //
  135. // Returns:
  136. // -------
  137. // SUCCESS else error code.
  138. MNLBProviderSetting_Error
  139. setHostProperties( const HostProperties& hp,
  140. unsigned long* retVal );
  141. //
  142. // Description:
  143. // -----------
  144. // sets the nlbs cluster properties.
  145. //
  146. // Parameters:
  147. // ----------
  148. // cp IN : cluster properties to set.
  149. // retVal OUT : return value of method ran.
  150. //
  151. // Returns:
  152. // -------
  153. // SUCCESS else error code.
  154. MNLBProviderSetting_Error
  155. setClusterProperties( const ClusterProperties& cp,
  156. unsigned long* retVal );
  157. //
  158. // Description:
  159. // -----------
  160. // sets the nlbs remote control password.
  161. //
  162. // Parameters:
  163. // ----------
  164. // password IN : password to set.
  165. //
  166. // Returns:
  167. // -------
  168. // SUCCESS else error code.
  169. MNLBProviderSetting_Error
  170. setPassword( const _bstr_t& password,
  171. unsigned long* retVal );
  172. //
  173. // Description:
  174. // -----------
  175. // get the load balanced port rules associated with this machine.
  176. //
  177. // Parameters:
  178. // ----------
  179. // portsLB OUT : load balanced port rules associated with this machine.
  180. //
  181. // Returns:
  182. // -------
  183. // SUCCESS else error code.
  184. MNLBProviderSetting_Error
  185. getPortRulesLoadBalanced( vector<MNLBPortRuleLoadBalanced>* portsLB );
  186. //
  187. // Description:
  188. // -----------
  189. // get the failover port rules associated with this machine.
  190. //
  191. // Parameters:
  192. // ----------
  193. // portsF OUT : failover port rules associated with this machine.
  194. //
  195. // Returns:
  196. // -------
  197. // SUCCESS else error code.
  198. MNLBProviderSetting_Error
  199. getPortRulesFailover( vector<MNLBPortRuleFailover>* portsF );
  200. //
  201. // Description:
  202. // -----------
  203. // get the disabled port rules associated with this machine.
  204. //
  205. // Parameters:
  206. // ----------
  207. // portsD OUT : failover port rules associated with this machine.
  208. //
  209. // Returns:
  210. // -------
  211. // SUCCESS else error code.
  212. MNLBProviderSetting_Error
  213. getPortRulesDisabled( vector<MNLBPortRuleDisabled>* portsD );
  214. //
  215. // Description:
  216. // -----------
  217. // adds a load balanced port rule to the machine.
  218. //
  219. // Parameters:
  220. // ----------
  221. // portRuleLB IN : load balanced port rule to add.
  222. //
  223. // Returns:
  224. // -------
  225. // SUCCESS else error code.
  226. MNLBProviderSetting_Error
  227. addPortRuleLoadBalanced( const MNLBPortRuleLoadBalanced& portRuleLB );
  228. //
  229. // Description:
  230. // -----------
  231. // adds a failover port rule to the machine.
  232. //
  233. // Parameters:
  234. // ----------
  235. // portRuleF IN : failover port rule to add.
  236. //
  237. // Returns:
  238. // -------
  239. // SUCCESS else error code.
  240. MNLBProviderSetting_Error
  241. addPortRuleFailover( const MNLBPortRuleFailover& portRuleF );
  242. //
  243. // Description:
  244. // -----------
  245. // adds a disabled port rule to the machine.
  246. //
  247. // Parameters:
  248. // ----------
  249. // portRuleD IN : disabled port rule to add.
  250. //
  251. // Returns:
  252. // -------
  253. // SUCCESS else error code.
  254. MNLBProviderSetting_Error
  255. addPortRuleDisabled( const MNLBPortRuleDisabled& portRuleD );
  256. //
  257. // Description:
  258. // -----------
  259. // removes a load balanced port rule to the machine.
  260. //
  261. // Parameters:
  262. // ----------
  263. // portRuleLB IN : load balanced port rule to remove.
  264. //
  265. // Returns:
  266. // -------
  267. // SUCCESS else error code.
  268. MNLBProviderSetting_Error
  269. removePortRuleLoadBalanced( const MNLBPortRuleLoadBalanced& portRuleLB );
  270. //
  271. // Description:
  272. // -----------
  273. // removes a failover port rule to the machine.
  274. //
  275. // Parameters:
  276. // ----------
  277. // portRuleF IN : failover port rule to remove.
  278. //
  279. // Returns:
  280. // -------
  281. // SUCCESS else error code.
  282. MNLBProviderSetting_Error
  283. removePortRuleFailover( const MNLBPortRuleFailover& portRuleF );
  284. //
  285. // Description:
  286. // -----------
  287. // removes a disabled port rule to the machine.
  288. //
  289. // Parameters:
  290. // ----------
  291. // portRuleD IN : disabled port rule to remove.
  292. //
  293. // Returns:
  294. // -------
  295. // SUCCESS else error code.
  296. MNLBProviderSetting_Error
  297. removePortRuleDisabled( const MNLBPortRuleDisabled& portRuleD );
  298. //
  299. // Description:
  300. // -----------
  301. // sync up the driver with the parameters in the regestry
  302. //
  303. // Parameters:
  304. // ----------
  305. // retVal OUT : whether sync was successful or not.
  306. //
  307. // Returns:
  308. // -------
  309. // SUCCESS else error code.
  310. MNLBProviderSetting_Error
  311. reload( unsigned long* retVal );
  312. private:
  313. // data
  314. auto_ptr<MWmiObject> p_machine;
  315. _bstr_t mIP;
  316. _bstr_t nic;
  317. // functions
  318. MNLBProviderSetting_Error
  319. connectToMachine();
  320. MNLBProviderSetting_Error
  321. checkNicBinding(_bstr_t& guid );
  322. MNLBProviderSetting::MNLBProviderSetting_Error
  323. MNLBProviderSetting::getPortRulesLoadBalanced_private( vector<MNLBPortRuleLoadBalanced>* portsLB,
  324. vector<MWmiInstance>* instances );
  325. MNLBProviderSetting::MNLBProviderSetting_Error
  326. MNLBProviderSetting::getPortRulesFailover_private( vector<MNLBPortRuleFailover>* portsF,
  327. vector<MWmiInstance>* instances );
  328. MNLBProviderSetting::MNLBProviderSetting_Error
  329. MNLBProviderSetting::getPortRulesDisabled_private( vector<MNLBPortRuleDisabled>* portsD,
  330. vector<MWmiInstance>* instances );
  331. MNLBProviderSetting_Error
  332. getClusterIPAndHostID( _bstr_t& clusterIP,
  333. _bstr_t& hostID );
  334. };
  335. // ensure type safety
  336. typedef class MNLBProviderSetting MNLBProviderSetting;
  337. #endif