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.

1075 lines
50 KiB

  1. /*++
  2. Copyright(c) 1998,99 Microsoft Corporation
  3. Module Name:
  4. wlbsctrl.c
  5. Abstract:
  6. Windows Load Balancing Service (WLBS)
  7. API - specification. This set of API is for internal use only.
  8. another set of WMI API is provided for public use.
  9. Author:
  10. fengsun
  11. --*/
  12. #ifndef _WLBSCTRL_H_
  13. #define _WLBSCTRL_H_
  14. /* CONSTANTS */
  15. #define WLBS_API_VER_MAJOR 2 /* WLBS control API major version. */
  16. #define WLBS_API_VER_MINOR 0 /* WLBS control API minor version. */
  17. #define WLBS_API_VER (WLBS_API_VER_MINOR | (WLBS_API_VER_MAJOR << 8))
  18. /* WLBS control API version. */
  19. #define WLBS_PRODUCT_NAME "WLBS"
  20. /* Default product name used for API
  21. initialization. */
  22. #define WLBS_MAX_HOSTS 32 /* Maximum number of cluster hosts. */
  23. #define WLBS_MAX_RULES 32 /* Maximum number of port rules. */
  24. #define WLBS_ALL_CLUSTERS 0 /* Used to specify all clusters in
  25. WLBS...Set routines. */
  26. #define WLBS_LOCAL_CLUSTER 0 /* Used to specify that cluster
  27. operations are to be performed on the
  28. local host. WLBS_LOCAL_HOST value
  29. below has to be used for the host
  30. argument when using
  31. WLBS_LOCAL_CLUSTER. */
  32. #define WLBS_LOCAL_HOST 0 /* When specifying WLBS_LOCAL_CLUSTER,
  33. this value should be used for the
  34. host argument. */
  35. #define WLBS_DEFAULT_HOST 0 /* Used to specify that remote cluster
  36. operations are to be performed on
  37. the default host. */
  38. #define WLBS_ALL_HOSTS 0xffffffff
  39. /* Used to specify that remote cluster
  40. operation is to be performed on all
  41. hosts. */
  42. #define WLBS_ALL_PORTS 0xffffffff
  43. /* Used to specify all load-balanced
  44. port rules as the target for
  45. enable/disable/drain commands. */
  46. /* WLBS return values. Windows Sockets errors are returned 'as-is'. */
  47. #define WLBS_OK 1000 /* Success. */
  48. #define WLBS_ALREADY 1001 /* Cluster mode is already stopped/
  49. started, or traffic handling is
  50. already enabled/disabled on specified
  51. port. */
  52. #define WLBS_DRAIN_STOP 1002 /* Cluster mode stop or start operation
  53. interrupted connection draining
  54. process. */
  55. #define WLBS_BAD_PARAMS 1003 /* Cluster mode could not be started
  56. due to configuration problems
  57. (bad registry parameters) on the
  58. target host. */
  59. #define WLBS_NOT_FOUND 1004 /* Port number not found among port
  60. rules. */
  61. #define WLBS_STOPPED 1005 /* Cluster mode is stopped on the
  62. host. */
  63. #define WLBS_CONVERGING 1006 /* Cluster is converging. */
  64. #define WLBS_CONVERGED 1007 /* Cluster or host converged
  65. successfully. */
  66. #define WLBS_DEFAULT 1008 /* Host is converged as default host. */
  67. #define WLBS_DRAINING 1009 /* Host is draining after
  68. WLBSDrainStop command. */
  69. #define WLBS_PRESENT 1010 /* WLBS is installed on this host.
  70. Local operations possible. */
  71. #define WLBS_REMOTE_ONLY 1011 /* WLBS is not installed on this host
  72. or is not functioning. Only remote
  73. control operations can be carried
  74. out. */
  75. #define WLBS_LOCAL_ONLY 1012 /* WinSock failed to load. Only local
  76. operations can be carried out. */
  77. #define WLBS_SUSPENDED 1013 /* Cluster control operations are
  78. suspended. */
  79. #define WLBS_REBOOT 1050 /* Reboot required in order for config
  80. changes to take effect. */
  81. #define WLBS_INIT_ERROR 1100 /* Error initializing control module. */
  82. #define WLBS_BAD_PASSW 1101 /* Specified remote control password
  83. was not accepted by the cluster. */
  84. #define WLBS_IO_ERROR 1102 /* Local I/O error opening or
  85. communicating with WLBS driver. */
  86. #define WLBS_TIMEOUT 1103 /* Timed-out awaiting response from
  87. remote host. */
  88. #define WLBS_PORT_OVERLAP 1150 /* Port rule overlaps with existing
  89. port rules. */
  90. #define WLBS_BAD_PORT_PARAMS 1151 /* Invalid parameter(s) in port rule. */
  91. #define WLBS_MAX_PORT_RULES 1152 /* Maximum number of port rules reached. */
  92. #define WLBS_TRUNCATED 1153 /* Return value truncated */
  93. #define WLBS_REG_ERROR 1154 /* Error while accessing the registry */
  94. /* Filtering modes for port rules */
  95. #define WLBS_SINGLE 1 /* single server mode */
  96. #define WLBS_MULTI 2 /* multi-server mode (load balanced) */
  97. #define WLBS_NEVER 3 /* mode for never handled by this server */
  98. #define WLBS_ALL 4 /* all server mode */
  99. /* Protocol qualifiers for port rules */
  100. #define WLBS_TCP 1 /* TCP protocol */
  101. #define WLBS_UDP 2 /* UDP protocol */
  102. #define WLBS_TCP_UDP 3 /* TCP or UDP protocols */
  103. /* Server affinity values for multiple filtering mode */
  104. #define WLBS_AFFINITY_NONE 0 /* no affinity (scale single client) */
  105. #define WLBS_AFFINITY_SINGLE 1 /* single client affinity */
  106. #define WLBS_AFFINITY_CLASSC 2 /* Class C affinity */
  107. /* TYPES */
  108. /* Response value type returned by each of the cluster hosts during remote
  109. operation. */
  110. typedef struct
  111. {
  112. DWORD id; /* Priority ID of the responding cluster
  113. host */
  114. DWORD address; /* Dedicated IP address */
  115. DWORD status; /* Status return value */
  116. DWORD reserved1; /* Reserved for future use */
  117. PVOID reserved2;
  118. }
  119. WLBS_RESPONSE, * PWLBS_RESPONSE;
  120. /* MACROS */
  121. /* Local operations */
  122. #define WlbsLocalQuery(host_map) \
  123. WlbsQuery (WLBS_LOCAL_CLUSTER, WLBS_LOCAL_HOST, NULL, NULL, \
  124. host_map, NULL)
  125. #define WlbsLocalSuspend() \
  126. WlbsSuspend (WLBS_LOCAL_CLUSTER, WLBS_LOCAL_HOST, NULL, NULL)
  127. #define WlbsLocalResume() \
  128. WlbsResume (WLBS_LOCAL_CLUSTER, WLBS_LOCAL_HOST, NULL, NULL)
  129. #define WlbsLocalStart() \
  130. WlbsStart (WLBS_LOCAL_CLUSTER, WLBS_LOCAL_HOST, NULL, NULL)
  131. #define WlbsLocalStop() \
  132. WlbsStop (WLBS_LOCAL_CLUSTER, WLBS_LOCAL_HOST, NULL, NULL)
  133. #define WlbsLocalDrainStop() \
  134. WlbsDrainStop (WLBS_LOCAL_CLUSTER, WLBS_LOCAL_HOST, NULL, NULL)
  135. #define WlbsLocalEnable(port) \
  136. WlbsEnable (WLBS_LOCAL_CLUSTER, WLBS_LOCAL_HOST, NULL, NULL, port)
  137. #define WlbsLocalDisable(port) \
  138. WlbsDisable (WLBS_LOCAL_CLUSTER, WLBS_LOCAL_HOST, NULL, NULL, port)
  139. #define WlbsLocalDrain(port) \
  140. WlbsDrain (WLBS_LOCAL_CLUSTER, WLBS_LOCAL_HOST, NULL, NULL, port)
  141. /* Single host remote operations */
  142. #define WlbsHostQuery(cluster, host, host_map) \
  143. WlbsQuery (cluster, host, NULL, NULL, host_map, NULL)
  144. #define WlbsHostSuspend(cluster, host) \
  145. WlbsSuspend (cluster, host, NULL, NULL)
  146. #define WlbsHostResume(cluster, host) \
  147. WlbsResume (cluster, host, NULL, NULL)
  148. #define WlbsHostStart(cluster, host) \
  149. WlbsStart (cluster, host, NULL, NULL)
  150. #define WlbsHostStop(cluster, host) \
  151. WlbsStop (cluster, host, NULL, NULL)
  152. #define WlbsHostDrainStop(cluster, host) \
  153. WlbsDrainStop (cluster, host, NULL, NULL)
  154. #define WlbsHostEnable(cluster, host, port) \
  155. WlbsEnable (cluster, host, NULL, NULL, port)
  156. #define WlbsHostDisable(cluster, host, port) \
  157. WlbsDisable (cluster, host, NULL, NULL, port)
  158. #define WlbsHostDrain(cluster, host, port) \
  159. WlbsDrain (cluster, host, NULL, NULL, port)
  160. /* Cluster-wide remote operations */
  161. #define WlbsClusterQuery(cluster, response, num_hosts, host_map) \
  162. WlbsQuery (cluster, WLBS_ALL_HOSTS, response, num_hosts, \
  163. host_map, NULL)
  164. #define WlbsClusterSuspend(cluster, response, num_hosts) \
  165. WlbsSuspend (cluster, WLBS_ALL_HOSTS, response, num_hosts)
  166. #define WlbsClusterResume(cluster, response, num_hosts) \
  167. WlbsResume (cluster, WLBS_ALL_HOSTS, response, num_hosts)
  168. #define WlbsClusterStart(cluster, response, num_hosts) \
  169. WlbsStart (cluster, WLBS_ALL_HOSTS, response, num_hosts)
  170. #define WlbsClusterStop(cluster, response, num_hosts) \
  171. WlbsStop (cluster, WLBS_ALL_HOSTS, response, num_hosts)
  172. #define WlbsClusterDrainStop(cluster, response, num_hosts) \
  173. WlbsDrainStop (cluster, WLBS_ALL_HOSTS, response, num_hosts)
  174. #define WlbsClusterEnable(cluster, response, num_hosts, port) \
  175. WlbsEnable (cluster, WLBS_ALL_HOSTS, response, num_hosts, port)
  176. #define WlbsClusterDisable(cluster, response, num_hosts, port) \
  177. WlbsDisable (cluster, WLBS_ALL_HOSTS, response, num_hosts, port)
  178. #define WlbsClusterDrain(cluster, response, num_hosts, port) \
  179. WlbsDrain (cluster, WLBS_ALL_HOSTS, response, num_hosts, port)
  180. /* PROCEDURES */
  181. /*************************************
  182. Initialization and support routines
  183. *************************************/
  184. #ifdef __cplusplus
  185. extern "C" {
  186. #endif
  187. extern DWORD WINAPI WlbsInit
  188. (
  189. WCHAR* Reservered1, /* IN - for backward compatibility */
  190. DWORD version, /* IN - Pass WLBS_API_VER value. */
  191. PVOID Reservered2 /* IN - Pass NULL. Reserved for future use. */
  192. );
  193. /*
  194. Initialize WLBS control module.
  195. returns:
  196. WLBS_PRESENT => WLBS is installed on this host. Local and remote
  197. control operations can be executed.
  198. WLBS_REMOTE_ONLY => WLBS is not installed on this system or is not
  199. functioning properly. Only remote operations can
  200. be carried out.
  201. WLBS_LOCAL_ONLY => WinSock failed to load. Only local operations can
  202. be carried out.
  203. WLBS_INIT_ERROR => Error initializing control module. Cannot perform
  204. control operations.
  205. */
  206. /******************************************************************************
  207. Cluster control routines:
  208. The following routines can be used to control individual cluster hosts or the
  209. entire cluster, both locally and remotely. They are designed to be as generic
  210. as possible. Macros, defined above, are designed to provide simpler
  211. interfaces for particular types of operations.
  212. It is highly recommended to make all response arrays of size WLBS_MAX_HOSTS
  213. to make your implementation independent of the actual cluster size.
  214. Please note that cluster address has to correspond to the primary cluster
  215. address as entered in the WLBS Setup Dialog. WLBS will not recognize
  216. control messages sent to dedicated or additional multi-homed cluster
  217. addresses.
  218. ******************************************************************************/
  219. extern DWORD WINAPI WlbsQuery
  220. (
  221. DWORD cluster, /* IN - Cluster address or WLBS_LOCAL_CLUSTER
  222. for local or this cluster operation. */
  223. DWORD host, /* IN - Host's dedicated address, priority ID,
  224. WLBS_DEFAULT_HOST for current default,
  225. WLBS_ALL_HOSTS for all hosts, or
  226. WLBS_LOCAL_HOST for local operation. */
  227. PWLBS_RESPONSE response, /* OUT - Array of response values from each of
  228. the hosts or NULL if response values
  229. are not desired or operations are being
  230. performed locally. */
  231. PDWORD num_hosts, /* IN - Size of the response array or NULL if
  232. response array is not specified and
  233. host count is not desired.
  234. OUT - Number of responses received. Note that
  235. this value can be larger than the size
  236. of the response array. In this case
  237. only the first few responses that fit
  238. in the array are returned. */
  239. PDWORD host_map, /* OUT - Bitmap with ones in the bit positions
  240. representing priority IDs of the hosts
  241. currently present in the cluster. NULL
  242. if host map information is not
  243. needed. */
  244. PVOID reserved /* IN - Pass NULL. Reserved for future use. */
  245. );
  246. /*
  247. Query status of specified host or all cluster hosts.
  248. returns:
  249. For local operations or remote operations on individual cluster hosts,
  250. return value represents status value returned by the target host. For
  251. cluster-wide remote operations, return value represents the summary of
  252. the return values from all cluster hosts. Individual host responses,
  253. corresponding to a single-host, return values are recorded in the
  254. response array.
  255. WLBS_INIT_ERROR => Error initializing control module. Cannot perform
  256. control operations.
  257. Single-host:
  258. WLBS_SUSPENDED => Cluster mode control suspended.
  259. WLBS_STOPPED => Cluster mode on the host is stopped.
  260. WLBS_CONVERGING => Host is converging.
  261. WLBS_DRAINING => Host is draining.
  262. WLBS_CONVERGED => Host converged.
  263. WLBS_DEFAULT => Host converged as default host.
  264. Cluster-wide:
  265. <1..32> => Number of active cluster hosts when the cluster
  266. is converged.
  267. WLBS_SUSPENDED => Entire cluster is suspended. All cluster hosts
  268. reported as being suspended.
  269. WLBS_STOPPED => Entire cluster is stopped. All cluster hosts reported
  270. as being stopped.
  271. WLBS_DRAINING => Entire cluster is draining. All cluster hosts
  272. reported as being stopped or draining.
  273. WLBS_CONVERGING => Cluster is converging. At least one cluster host
  274. reported its state as converging.
  275. Remote:
  276. WLBS_BAD_PASSW => Specified password was not accepted by the cluster.
  277. WLBS_TIMEOUT => No response received. If this value is returned when
  278. accessing default host (using host priority ID
  279. WLBS_DEFAULT_HOST) it might mean that entire cluster
  280. is stopped and there was no default host to respond
  281. to the query.
  282. WLBS_LOCAL_ONLY => WinSock failed to load. Only local operations can
  283. be carried out.
  284. WSA... => Specified Winsock error occurred when communicating
  285. with the cluster.
  286. Local:
  287. WLBS_REMOTE_ONLY => WLBS is not installed on this system. Only remote
  288. operations can be carried out.
  289. WLBS_IO_ERROR => I/O error opening or communicating with WLBS
  290. driver. WLBS might not be loaded.
  291. */
  292. extern DWORD WINAPI WlbsSuspend
  293. (
  294. DWORD cluster, /* IN - Cluster address or WLBS_LOCAL_CLUSTER
  295. for local or this cluster operation. */
  296. DWORD host, /* IN - Host's dedicated address, priority ID,
  297. WLBS_ALL_HOSTS for all hosts, or
  298. WLBS_LOCAL_HOST for local operation. */
  299. PWLBS_RESPONSE response, /* OUT - Array of response values from each of
  300. the hosts or NULL if response values
  301. are not desired or operations are being
  302. performed locally. */
  303. PDWORD num_hosts /* IN - Size of the response array or NULL if
  304. response array is not specified and
  305. host count is not desired.
  306. OUT - Number of responses received. Note that
  307. this value can be larger than the size
  308. of the response array. In this case
  309. only the first few responses that fit
  310. in the array are returned. */
  311. );
  312. /*
  313. Suspend cluster operation control on specified host or all cluster hosts.
  314. returns:
  315. For local operations or remote operations on individual cluster hosts,
  316. return value represents status value returned by the target host. For
  317. cluster-wide remote operations, return value represents the summary of
  318. the return values from all cluster hosts. Individual host responses,
  319. corresponding to a single-host, return values are recorded in the
  320. response array.
  321. WLBS_INIT_ERROR => Error initializing control module. Cannot perform
  322. control operations.
  323. Single-host:
  324. WLBS_OK => Cluster mode control suspended.
  325. WLBS_ALREADY => Cluster mode control already suspended.
  326. WLBS_STOPPED => Cluster mode was stopped and control suspended.
  327. WLBS_DRAIN_STOP => Suspending cluster mode control interrupted ongoing
  328. connection draining.
  329. Cluster-wide:
  330. WLBS_OK => Cluster mode control suspended on all hosts.
  331. Remote:
  332. WLBS_BAD_PASSW => Specified password was not accepted by at least one member of the cluster.
  333. WLBS_TIMEOUT => No response received.
  334. WLBS_LOCAL_ONLY => WinSock failed to load. Only local operations can
  335. be carried out.
  336. WSA... => Specified Winsock error occurred when communicating
  337. with the cluster.
  338. Local:
  339. WLBS_REMOTE_ONLY => WLBS is not installed on this system or is not
  340. functioning properly. Only remote operations can
  341. be carried out.
  342. WLBS_IO_ERROR => I/O error opening or communicating with WLBS
  343. driver. WLBS might not be loaded.
  344. */
  345. extern DWORD WINAPI WlbsResume
  346. (
  347. DWORD cluster, /* IN - Cluster address or WLBS_LOCAL_CLUSTER
  348. for local or this cluster operation. */
  349. DWORD host, /* IN - Host's dedicated address, priority ID,
  350. WLBS_ALL_HOSTS for all hosts, or
  351. WLBS_LOCAL_HOST for local operation. */
  352. PWLBS_RESPONSE response, /* OUT - Array of response values from each of
  353. the hosts or NULL if response values
  354. are not desired or operations are being
  355. performed locally. */
  356. PDWORD num_hosts /* IN - Size of the response array or NULL if
  357. response array is not specified and
  358. host count is not desired.
  359. OUT - Number of responses received. Note that
  360. this value can be larger than the size
  361. of the response array. In this case
  362. only the first few responses that fit
  363. in the array are returned. */
  364. );
  365. /*
  366. Resume cluster operation control on specified host or all cluster hosts.
  367. returns:
  368. For local operations or remote operations on individual cluster hosts,
  369. return value represents status value returned by the target host. For
  370. cluster-wide remote operations, return value represents the summary of
  371. the return values from all cluster hosts. Individual host responses,
  372. corresponding to a single-host, return values are recorded in the
  373. response array.
  374. WLBS_INIT_ERROR => Error initializing control module. Cannot perform
  375. control operations.
  376. Single-host:
  377. WLBS_OK => Cluster mode control resumed.
  378. WLBS_ALREADY => Cluster mode control already resumed.
  379. Cluster-wide:
  380. WLBS_OK => Cluster mode control resumed on all hosts.
  381. Remote:
  382. WLBS_BAD_PASSW => Specified password was not accepted by the cluster.
  383. WLBS_TIMEOUT => No response received.
  384. WLBS_LOCAL_ONLY => WinSock failed to load. Only local operations can
  385. be carried out.
  386. WSA... => Specified Winsock error occurred when communicating
  387. with the cluster.
  388. Local:
  389. WLBS_REMOTE_ONLY => WLBS is not installed on this system or is not
  390. functioning properly. Only remote operations can
  391. be carried out.
  392. WLBS_IO_ERROR => I/O error opening or communicating with WLBS
  393. driver. WLBS might not be loaded.
  394. */
  395. extern DWORD WINAPI WlbsStart
  396. (
  397. DWORD cluster, /* IN - Cluster address or WLBS_LOCAL_CLUSTER
  398. for local or this cluster operation. */
  399. DWORD host, /* IN - Host's dedicated address, priority ID,
  400. WLBS_ALL_HOSTS for all hosts, or
  401. WLBS_LOCAL_HOST for local operation. */
  402. PWLBS_RESPONSE response, /* OUT - Array of response values from each of
  403. the hosts or NULL if response values
  404. are not desired or operations are being
  405. performed locally. */
  406. PDWORD num_hosts /* IN - Size of the response array or NULL if
  407. response array is not specified and
  408. host count is not desired.
  409. OUT - Number of responses received. Note that
  410. this value can be larger than the size
  411. of the response array. In this case
  412. only the first few responses that fit
  413. in the array are returned. */
  414. );
  415. /*
  416. Start cluster operations on specified host or all cluster hosts.
  417. returns:
  418. For local operations or remote operations on individual cluster hosts,
  419. return value represents status value returned by the target host. For
  420. cluster-wide remote operations, return value represents the summary of
  421. the return values from all cluster hosts. Individual host responses,
  422. corresponding to a single-host, return values are recorded in the
  423. response array.
  424. WLBS_INIT_ERROR => Error initializing control module. Cannot perform
  425. control operations.
  426. Single-host:
  427. WLBS_OK => Cluster mode started.
  428. WLBS_ALREADY => Cluster mode already started.
  429. WLBS_SUSPENDED => Cluster mode control suspended.
  430. WLBS_DRAIN_STOP => Starting cluster mode interrupted ongoing connection
  431. draining.
  432. WLBS_BAD_PARAMS => Could not start cluster mode due to invalid configuration
  433. parameters.
  434. Cluster-wide:
  435. WLBS_OK => Cluster mode started on all hosts.
  436. WLBS_BAD_PARAMS => Could not start cluster mode on at least one host
  437. due to invalid configuration parameters.
  438. WLBS_SUSPENDED => If at least one host is suspended.
  439. Remote:
  440. WLBS_BAD_PASSW => Specified password was not accepted by the cluster.
  441. WLBS_TIMEOUT => No response received.
  442. WLBS_LOCAL_ONLY => WinSock failed to load. Only local operations can
  443. be carried out.
  444. WSA... => Specified Winsock error occurred when communicating
  445. with the cluster.
  446. Local:
  447. WLBS_REMOTE_ONLY => WLBS is not installed on this system or is not
  448. functioning properly. Only remote operations can
  449. be carried out.
  450. WLBS_IO_ERROR => I/O error opening or communicating with WLBS
  451. driver. WLBS might not be loaded.
  452. */
  453. extern DWORD WINAPI WlbsStop
  454. (
  455. DWORD cluster, /* IN - Cluster address or WLBS_LOCAL_CLUSTER
  456. for local or this cluster operation. */
  457. DWORD host, /* IN - Host's dedicated address, priority ID,
  458. WLBS_DEFAULT_HOST for current default
  459. host, WLBS_ALL_HOSTS for all hosts, or
  460. WLBS_LOCAL_HOST for local operation. */
  461. PWLBS_RESPONSE response, /* OUT - Array of response values from each of
  462. the hosts or NULL if response values
  463. are not desired or operations are being
  464. performed locally. */
  465. PDWORD num_hosts /* IN - Size of the response array or NULL if
  466. response array is not specified and
  467. host count is not desired.
  468. OUT - Number of responses received. Note that
  469. this value can be larger than the size
  470. of the response array. In this case
  471. only the first few responses that fit
  472. in the array are returned. */
  473. );
  474. /*
  475. Stop cluster operations on specified host or all cluster hosts.
  476. returns:
  477. For local operations or remote operations on individual cluster hosts,
  478. return value represents status value returned by the target host. For
  479. cluster-wide remote operations, return value represents the summary of
  480. the return values from all cluster hosts. Individual host responses,
  481. corresponding to a single-host, return values are recorded in the
  482. response array.
  483. WLBS_INIT_ERROR => Error initializing control module. Cannot perform
  484. control operations.
  485. Single-host:
  486. WLBS_OK => Cluster mode stopped.
  487. WLBS_ALREADY => Cluster mode already stopped.
  488. WLBS_SUSPENDED => Cluster mode control suspended.
  489. WLBS_DRAIN_STOP => Starting cluster mode interrupted ongoing connection
  490. draining.
  491. Cluster-wide:
  492. WLBS_OK => Cluster mode stopped on all hosts.
  493. WLBS_SUSPENDED => At least one host is suspended.
  494. Remote:
  495. WLBS_BAD_PASSW => Specified password was not accepted by the cluster.
  496. WLBS_TIMEOUT => No response received. If this value is returned when
  497. accessing default host (using host priority ID
  498. WLBS_DEFAULT_HOST) it might mean that entire cluster
  499. is stopped and there was no default host to respond
  500. to the command.
  501. WLBS_LOCAL_ONLY => WinSock failed to load. Only local operations can
  502. be carried out.
  503. WSA... => Specified Winsock error occurred when communicating
  504. with the cluster.
  505. Local:
  506. WLBS_REMOTE_ONLY => WLBS is not installed on this system or is not
  507. functioning properly. Only remote operations can
  508. be carried out.
  509. WLBS_IO_ERROR => I/O error opening or communicating with WLBS
  510. driver. WLBS might not be loaded.
  511. */
  512. extern DWORD WINAPI WlbsDrainStop
  513. (
  514. DWORD cluster, /* IN - Cluster address or WLBS_LOCAL_CLUSTER
  515. for local or this cluster operation. */
  516. DWORD host, /* IN - Host's dedicated address, priority ID,
  517. WLBS_DEFAULT_HOST for current default
  518. host, WLBS_ALL_HOSTS for all hosts, or
  519. WLBS_LOCAL_HOST for local operation. */
  520. PWLBS_RESPONSE response, /* OUT - Array of response values from each of
  521. the hosts or NULL if response values
  522. are not desired or operations are being
  523. performed locally. */
  524. PDWORD num_hosts /* IN - Size of the response array or NULL if
  525. response array is not specified and
  526. host count is not desired.
  527. OUT - Number of responses received. Note that
  528. this value can be larger than the size
  529. of the response array. In this case
  530. only the first few responses that fit
  531. in the array are returned. */
  532. );
  533. /*
  534. Enter draining mode on specified host or all cluster hosts. New connections
  535. will not be accepted. Cluster mode will be stopped when all existing
  536. connections finish. While draining, host will participate in convergence and
  537. remain part of the cluster.
  538. Draining mode can be interrupted by performing WlbsStop or WlbsStart.
  539. WlbsEnable, WlbsDisable and WlbsDrain commands cannot be executed
  540. while the host is draining.
  541. Note that this command is NOT equivalent to doing WlbsDrain with
  542. WLBS_ALL_PORTS parameter followed by WlbsStop. WlbsDrainStop affects all
  543. ports, not just the ones specified in the multiple host filtering mode port
  544. rules.
  545. returns:
  546. For local operations or remote operations on individual cluster hosts,
  547. return value represents status value returned by the target host. For
  548. cluster-wide remote operations, return value represents the summary of
  549. the return values from all cluster hosts. Individual host responses,
  550. corresponding to a single-host, return values are recorded in the
  551. response array.
  552. WLBS_INIT_ERROR => Error initializing control module. Cannot perform
  553. control operations.
  554. Single-host:
  555. WLBS_OK => Host entered draining mode.
  556. WLBS_ALREADY => Host is already draining.
  557. WLBS_SUSPENDED => Cluster mode control suspended.
  558. WLBS_STOPPED => Cluster mode is already stopped.
  559. Cluster-wide:
  560. WLBS_OK => Draining mode entered on all hosts.
  561. WLBS_STOPPED => Cluster mode is already stopped on all hosts.
  562. WLBS_SUSPENDED => At least one host is suspended.
  563. Remote:
  564. WLBS_BAD_PASSW => Specified password was not accepted by the cluster.
  565. WLBS_TIMEOUT => No response received. If this value is returned when
  566. accessing default host (using host priority ID
  567. WLBS_DEFAULT_HOST) it might mean that entire cluster
  568. is stopped and there was no default host to respond
  569. to the command.
  570. WLBS_LOCAL_ONLY => WinSock failed to load. Only local operations can
  571. be carried out.
  572. WSA... => Specified Winsock error occurred when communicating
  573. with the cluster.
  574. Local:
  575. WLBS_REMOTE_ONLY => WLBS is not installed on this system or is not
  576. functioning properly. Only remote operations can
  577. be carried out.
  578. WLBS_IO_ERROR => I/O error opening or communicating with WLBS
  579. driver. WLBS might not be loaded.
  580. */
  581. extern DWORD WINAPI WlbsEnable
  582. (
  583. DWORD cluster, /* IN - Cluster address or WLBS_LOCAL_CLUSTER
  584. for local or this cluster operation. */
  585. DWORD host, /* IN - Host's dedicated address, priority ID,
  586. WLBS_DEFAULT_HOST for current default
  587. host, WLBS_ALL_HOSTS for all hosts, or
  588. WLBS_LOCAL_HOST for local operation. */
  589. PWLBS_RESPONSE response, /* OUT - Array of response values from each of
  590. the hosts or NULL if response values
  591. are not desired or operations are being
  592. performed locally. */
  593. PDWORD num_hosts, /* IN - Size of the response array or NULL if
  594. response array is not specified and
  595. host count is not desired.
  596. OUT - Number of responses received. Note that
  597. this value can be larger than the size
  598. of the response array. In this case
  599. only the first few responses that fit
  600. in the array are returned. */
  601. DWORD port /* IN - Port number to specify the target port
  602. rule or WLBS_ALL_PORTS. */
  603. );
  604. /*
  605. Enable traffic handling for rule containing the specified port on specified
  606. host or all cluster hosts. Only rules that are set for multiple host
  607. filtering mode are affected.
  608. returns:
  609. For local operations or remote operations on individual cluster hosts,
  610. return value represents status value returned by the target host. For
  611. cluster-wide remote operations, return value represents the summary of
  612. the return values from all cluster hosts. Individual host responses,
  613. corresponding to a single-host, return values are recorded in the
  614. response array.
  615. WLBS_INIT_ERROR => Error initializing control module. Cannot perform
  616. control operations.
  617. Single-host:
  618. WLBS_OK => Port rule enabled.
  619. WLBS_ALREADY => Port rule already enabled.
  620. WLBS_SUSPENDED => Cluster mode control suspended.
  621. WLBS_NOT_FOUND => No port rule containing specified port found.
  622. WLBS_STOPPED => Cannot start handling traffic since cluster mode
  623. is stopped.
  624. WLBS_DRAINING => Cannot enable handling traffic since host is draining.
  625. Cluster-wide:
  626. WLBS_OK => Port rule enabled on all hosts with cluster mode
  627. started.
  628. WLBS_NOT_FOUND => At least one host could not find port rule containing
  629. specified port.
  630. WLBS_SUSPENDED => At least one host is suspended.
  631. Remote:
  632. WLBS_BAD_PASSW => Specified password was not accepted by the cluster.
  633. WLBS_TIMEOUT => No response received. If this value is returned when
  634. accessing default host (using host priority ID
  635. WLBS_DEFAULT_HOST) it might mean that entire cluster
  636. is stopped and there was no default host to respond
  637. to the command.
  638. WLBS_LOCAL_ONLY => WinSock failed to load. Only local operations can
  639. be carried out.
  640. WSA... => Specified Winsock error occurred when communicating
  641. with the cluster.
  642. Local:
  643. WLBS_REMOTE_ONLY => WLBS is not installed on this system or is not
  644. functioning properly. Only remote operations can
  645. be carried out.
  646. WLBS_IO_ERROR => I/O error opening or communicating with WLBS
  647. driver. WLBS might not be loaded.
  648. */
  649. extern DWORD WINAPI WlbsDisable
  650. (
  651. DWORD cluster, /* IN - Cluster address or WLBS_LOCAL_CLUSTER
  652. for local or this cluster operation. */
  653. DWORD host, /* IN - Host's dedicated address, priority ID,
  654. WLBS_DEFAULT_HOST for current default
  655. host, WLBS_ALL_HOSTS for all hosts, or
  656. WLBS_LOCAL_HOST for local operation. */
  657. PWLBS_RESPONSE response, /* OUT - Array of response values from each of
  658. the hosts or NULL if response values
  659. are not desired or operations are being
  660. performed locally. */
  661. PDWORD num_hosts, /* IN - Size of the response array or NULL if
  662. response array is not specified and
  663. host count is not desired.
  664. OUT - Number of responses received. Note that
  665. this value can be larger than the size
  666. of the response array. In this case
  667. only the first few responses that fit
  668. in the array are returned. */
  669. DWORD port /* IN - Port number to specify the target port
  670. rule or WLBS_ALL_PORTS. */
  671. );
  672. /*
  673. Disable ALL traffic handling for rule containing the specified port on
  674. specified host or all cluster hosts. Only rules that are set for multiple
  675. host filtering mode are affected.
  676. returns:
  677. For local operations or remote operations on individual cluster hosts,
  678. return value represents status value returned by the target host. For
  679. cluster-wide remote operations, return value represents the summary of
  680. the return values from all cluster hosts. Individual host responses,
  681. corresponding to a single-host, return values are recorded in the
  682. response array.
  683. WLBS_INIT_ERROR => Error initializing control module. Cannot perform
  684. control operations.
  685. Single-host:
  686. WLBS_OK => All traffic handling on the port rule is disabled.
  687. WLBS_ALREADY => Port rule already disabled.
  688. WLBS_SUSPENDED => Cluster mode control suspended.
  689. WLBS_NOT_FOUND => No port rule containing specified port found.
  690. WLBS_STOPPED => Cannot stop handling traffic since cluster mode
  691. is stopped.
  692. WLBS_DRAINING => Cannot stop handling traffic since host is draining.
  693. Cluster-wide:
  694. WLBS_OK => Port rule disabled on all hosts with cluster mode
  695. started.
  696. WLBS_NOT_FOUND => At least one host could not find port rule containing
  697. specified port.
  698. WLBS_SUSPENDED => At least one host is suspended.
  699. Remote:
  700. WLBS_BAD_PASSW => Specified password was not accepted by the cluster.
  701. WLBS_TIMEOUT => No response received. If this value is returned when
  702. accessing default host (using host priority ID
  703. WLBS_DEFAULT_HOST) it might mean that entire cluster
  704. is stopped and there was no default host to respond
  705. to the command.
  706. WLBS_LOCAL_ONLY => WinSock failed to load. Only local operations can
  707. be carried out.
  708. WSA... => Specified Winsock error occurred when communicating
  709. with the cluster.
  710. Local:
  711. WLBS_REMOTE_ONLY => WLBS is not installed on this system or is not
  712. functioning properly. Only remote operations can
  713. be carried out.
  714. WLBS_IO_ERROR => I/O error opening or communicating with WLBS
  715. driver. WLBS might not be loaded.
  716. */
  717. extern DWORD WINAPI WlbsDrain
  718. (
  719. DWORD cluster, /* IN - Cluster address or WLBS_LOCAL_CLUSTER
  720. for local or this cluster operation. */
  721. DWORD host, /* IN - Host's dedicated address, priority ID,
  722. WLBS_DEFAULT_HOST for current default
  723. host, WLBS_ALL_HOSTS for all hosts, or
  724. WLBS_LOCAL_HOST for local operation. */
  725. PWLBS_RESPONSE response, /* OUT - Array of response values from each of
  726. the hosts or NULL if response values
  727. are not desired or operations are being
  728. performed locally. */
  729. PDWORD num_hosts, /* IN - Size of the response array or NULL if
  730. response array is not specified and
  731. host count is not desired.
  732. OUT - Number of responses received. Note that
  733. this value can be larger than the size
  734. of the response array. In this case
  735. only the first few responses that fit
  736. in the array are returned. */
  737. DWORD port /* IN - Port number to specify the target port
  738. rule or WLBS_ALL_PORTS. */
  739. );
  740. /*
  741. Disable NEW traffic handling for rule containing the specified port on
  742. specified host or all cluster hosts. Only rules that are set for multiple
  743. host filtering mode are affected.
  744. returns:
  745. For local operations or remote operations on individual cluster hosts,
  746. return value represents status value returned by the target host. For
  747. cluster-wide remote operations, return value represents the summary of
  748. the return values from all cluster hosts. Individual host responses,
  749. corresponding to a single-host, return values are recorded in the
  750. response array.
  751. WLBS_INIT_ERROR => Error initializing control module. Cannot perform
  752. control operations.
  753. Single-host:
  754. WLBS_OK => New traffic handling on the port rule is disabled.
  755. WLBS_ALREADY => Port rule already being drained.
  756. WLBS_SUSPENDED => Cluster mode control suspended.
  757. WLBS_NOT_FOUND => No port rule containing specified port found.
  758. WLBS_STOPPED => Cannot stop handling traffic since cluster mode
  759. is stopped.
  760. WLBS_DRAINING => Cannot stop handling traffic since host is draining.
  761. Cluster-wide:
  762. WLBS_OK => Port rule disabled on all hosts with cluster mode
  763. started.
  764. WLBS_NOT_FOUND => At least one host could not find port rule containing
  765. specified port.
  766. WLBS_SUSPENDED => At least one host is suspended.
  767. Remote:
  768. WLBS_BAD_PASSW => Specified password was not accepted by the cluster.
  769. WLBS_TIMEOUT => No response received. If this value is returned when
  770. accessing default host (using host priority ID
  771. WLBS_DEFAULT_HOST) it might mean that entire cluster
  772. is stopped and there was no default host to respond
  773. to the command.
  774. WLBS_LOCAL_ONLY => WinSock failed to load. Only local operations can
  775. be carried out.
  776. WSA... => Specified Winsock error occurred when communicating
  777. with the cluster.
  778. Local:
  779. WLBS_REMOTE_ONLY => WLBS is not installed on this system or is not
  780. functioning properly. Only remote operations can
  781. be carried out.
  782. WLBS_IO_ERROR => I/O error opening or communicating with WLBS
  783. driver. WLBS might not be loaded.
  784. */
  785. /******************************************************************************
  786. "Sticky" options for remote operations. Parameters set by these routines will
  787. apply for all subsequent remote cluster control operations for the specified
  788. cluster. Use WLBS_ALL_CLUSTERS to adjust parameters for all clusters.
  789. ******************************************************************************/
  790. extern VOID WINAPI WlbsPortSet
  791. (
  792. DWORD cluster, /* IN - Cluster address or WLBS_ALL_CLUSTERS
  793. for all clusters. */
  794. WORD port /* IN - UDP port or 0 to revert to the
  795. default (2504). */
  796. );
  797. /*
  798. Set UDP port that will be used for sending control messages to the cluster.
  799. returns:
  800. */
  801. extern VOID WINAPI WlbsPasswordSet
  802. (
  803. DWORD cluster, /* IN - Cluster address or WLBS_ALL_CLUSTERS
  804. for all clusters. */
  805. WCHAR* password /* IN - Password or NULL to revert to the
  806. default (no password). */
  807. );
  808. /*
  809. Set password to be used in the subsequent control messages sent to the
  810. cluster.
  811. returns:
  812. */
  813. extern VOID WINAPI WlbsCodeSet
  814. (
  815. DWORD cluster, /* IN - Cluster address or WLBS_ALL_CLUSTERS
  816. for all clusters. */
  817. DWORD password /* IN - Password or 0 to revert to the
  818. default (no password). */
  819. );
  820. /*
  821. Set password to be used in the subsequent control messages sent to the
  822. cluster.
  823. returns:
  824. */
  825. extern VOID WINAPI WlbsDestinationSet
  826. (
  827. DWORD cluster, /* IN - Cluster address or WLBS_ALL_CLUSTERS
  828. for all clusters. */
  829. DWORD dest /* IN - Destination address or 0 to revert to
  830. the default (same as the cluster
  831. address specified during control
  832. calls). */
  833. );
  834. /*
  835. Set the destination address to send cluster control messages to. This
  836. parameter in only supplied for debugging or special purposes. By default
  837. all control messages are sent to the cluster primary address specified
  838. when invoking cluster control routines.
  839. returns:
  840. */
  841. extern VOID WINAPI WlbsTimeoutSet
  842. (
  843. DWORD cluster, /* IN - Cluster address or WLBS_ALL_CLUSTERS
  844. for all clusters. */
  845. DWORD milliseconds /*IN - Number of milliseconds or 0 to revert
  846. to the default (10 seconds). */
  847. );
  848. /*
  849. Set number of milliseconds to wait for replies from cluster hosts when
  850. performing remote operations.
  851. returns:
  852. */
  853. DWORD WINAPI WlbsEnumClusters(OUT DWORD* pdwAddresses, OUT DWORD* pdwNum);
  854. DWORD WINAPI WlbsGetAdapterGuid(IN DWORD cluster, OUT GUID* pAdapterGuid);
  855. #ifdef __cplusplus
  856. } /* extern "C" */
  857. #endif
  858. #endif /* _WLBSCTRL_H_ */