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.

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