Leaked source code of windows server 2003
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.

157 lines
2.9 KiB

  1. #ifndef _MNLBUIDATA_H
  2. #define _MNLBUIDATA_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 : muidata interface file.
  11. // DevUnit : wlbstest
  12. // Author : Murtaza Hakim
  13. //
  14. // Description:
  15. // -----------
  16. // This data structure is as follows
  17. //
  18. // ClusterData has inforamtion about
  19. // cluster
  20. // portrules
  21. // and hosts.
  22. //
  23. // The portRules are map structures with the start port mapping to the detailed port rule.
  24. //
  25. // the portrules unequal load balanced have a map which maps the host id and the
  26. // load weight for that particular host.
  27. //
  28. // the portrules failover have a map which maps the host id and the
  29. // priority for that particular host.
  30. //
  31. //
  32. #include "utils.h"
  33. class PortDataX
  34. {
  35. public:
  36. enum MNLBPortRule_Error
  37. {
  38. MNLBPortRule_SUCCESS = 0,
  39. InvalidRule = 1,
  40. InvalidNode = 2,
  41. COM_FAILURE = 10,
  42. };
  43. enum Protocol
  44. {
  45. tcp,
  46. udp,
  47. both,
  48. };
  49. enum Affinity
  50. {
  51. none,
  52. single,
  53. classC,
  54. };
  55. //
  56. // Description:
  57. // -----------
  58. // constructor.
  59. //
  60. // Parameters:
  61. // ----------
  62. // startPort IN : start port in range.
  63. // endPort IN : end port in range.
  64. // trafficToHandle IN : set port for specified protocol.
  65. //
  66. // Returns:
  67. // -------
  68. // none.
  69. PortDataX( long startPort,
  70. long endPort,
  71. Protocol trafficToHandle,
  72. bool equal,
  73. long load,
  74. Affinity affinity,
  75. long priority);
  76. //
  77. // Description:
  78. // -----------
  79. // default constructor.
  80. //
  81. // Parameters:
  82. // ----------
  83. // none.
  84. //
  85. // Returns:
  86. // -------
  87. // none.
  88. PortDataX();
  89. bool
  90. operator==(const PortDataX& objToCompare ) const;
  91. bool
  92. operator!=(const PortDataX& objToCompare ) const;
  93. long _key;
  94. long _startPort;
  95. long _endPort;
  96. Protocol _trafficToHandle;
  97. bool _isEqualLoadBalanced;
  98. long _load;
  99. long _priority;
  100. Affinity _affinity;
  101. map< _bstr_t, long > machineMapToLoadWeight;
  102. map< _bstr_t, long > machineMapToPriority;
  103. set<long>
  104. getAvailablePriorities();
  105. };
  106. struct HostData
  107. {
  108. HostProperties hp;
  109. _bstr_t connectionIP;
  110. };
  111. struct ClusterData
  112. {
  113. vector<_bstr_t> virtualIPs;
  114. vector<_bstr_t> virtualSubnets;
  115. ClusterProperties cp;
  116. map< long, PortDataX> portX;
  117. map< _bstr_t, HostData> hosts;
  118. set<int>
  119. getAvailableHostIDS();
  120. bool connectedDirect;
  121. };
  122. #endif