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.

334 lines
5.3 KiB

  1. /*
  2. * Filename: NLB_Host.cpp
  3. * Description:
  4. * Author: shouse, 04.10.01
  5. */
  6. #include <stdio.h>
  7. #include "NLB_Host.h"
  8. /*
  9. * Method:
  10. * Description:
  11. * Author: Created by shouse, 4.26.01
  12. * Notes:
  13. */
  14. NLB_Host::NLB_Host () {
  15. }
  16. /*
  17. * Method:
  18. * Description:
  19. * Author: Created by shouse, 4.26.01
  20. * Notes:
  21. */
  22. NLB_Host::~NLB_Host () {
  23. }
  24. /*
  25. * Method:
  26. * Description:
  27. * Author: Created by shouse, 4.26.01
  28. * Notes:
  29. */
  30. bool NLB_Host::IsValid () {
  31. if (!Name.IsValid())
  32. return false;
  33. if (!HostID.IsValid())
  34. return false;
  35. return true;
  36. }
  37. /*
  38. * Method:
  39. * Description:
  40. * Author: Created by shouse, 4.26.01
  41. * Notes:
  42. */
  43. void NLB_Host::Clear () {
  44. Name.Clear();
  45. Label.Clear();
  46. HostName.Clear();
  47. HostID.Clear();
  48. State.Clear();
  49. DedicatedIPAddress.Clear();
  50. ConnectionIPAddress.Clear();
  51. Adapter.Clear();
  52. }
  53. /*
  54. * Method:
  55. * Description:
  56. * Author: Created by shouse, 4.26.01
  57. * Notes:
  58. */
  59. bool NLB_Host::SetName (PWCHAR pName) {
  60. NLB_ASSERT(pName);
  61. return Name.SetName(pName);
  62. }
  63. /*
  64. * Method:
  65. * Description:
  66. * Author: Created by shouse, 4.26.01
  67. * Notes:
  68. */
  69. bool NLB_Host::GetName (PWCHAR pName, ULONG length) {
  70. NLB_ASSERT(pName);
  71. return Name.GetName(pName, length);
  72. }
  73. /*
  74. * Method:
  75. * Description:
  76. * Author: Created by shouse, 4.26.01
  77. * Notes:
  78. */
  79. bool NLB_Host::SetLabel (PWCHAR pLabel) {
  80. NLB_ASSERT(pLabel);
  81. return Label.SetText(pLabel);
  82. }
  83. /*
  84. * Method:
  85. * Description:
  86. * Author: Created by shouse, 4.26.01
  87. * Notes:
  88. */
  89. bool NLB_Host::GetLabel (PWCHAR pLabel, ULONG length) {
  90. NLB_ASSERT(pLabel);
  91. return Label.GetText(pLabel, length);
  92. }
  93. /*
  94. * Method:
  95. * Description:
  96. * Author: Created by shouse, 4.26.01
  97. * Notes:
  98. */
  99. bool NLB_Host::SetDNSHostname (PWCHAR pName) {
  100. NLB_ASSERT(pName);
  101. return HostName.SetName(pName);
  102. }
  103. /*
  104. * Method:
  105. * Description:
  106. * Author: Created by shouse, 4.26.01
  107. * Notes:
  108. */
  109. bool NLB_Host::GetDNSHostname (PWCHAR pName, ULONG length) {
  110. NLB_ASSERT(pName);
  111. return HostName.GetName(pName, length);
  112. }
  113. /*
  114. * Method:
  115. * Description:
  116. * Author: Created by shouse, 4.26.01
  117. * Notes:
  118. */
  119. bool NLB_Host::SetHostID (ULONG ID) {
  120. return HostID.SetID(ID);
  121. }
  122. /*
  123. * Method:
  124. * Description:
  125. * Author: Created by shouse, 4.26.01
  126. * Notes:
  127. */
  128. bool NLB_Host::GetHostID (ULONG & ID) {
  129. return HostID.GetID(ID);
  130. }
  131. /*
  132. * Method:
  133. * Description:
  134. * Author: Created by shouse, 4.26.01
  135. * Notes:
  136. */
  137. bool NLB_Host::SetState (NLB_HostState::NLB_HostStateType eState) {
  138. return State.SetState(eState);
  139. }
  140. /*
  141. * Method:
  142. * Description:
  143. * Author: Created by shouse, 4.26.01
  144. * Notes:
  145. */
  146. bool NLB_Host::GetState (NLB_HostState::NLB_HostStateType & eState) {
  147. return State.GetState(eState);
  148. }
  149. /*
  150. * Method:
  151. * Description:
  152. * Author: Created by shouse, 4.26.01
  153. * Notes:
  154. */
  155. bool NLB_Host::SetStatePersistence (NLB_HostState::NLB_HostStateType eState, bool bPersist) {
  156. return State.SetPersistence(eState, bPersist);
  157. }
  158. /*
  159. * Method:
  160. * Description:
  161. * Author: Created by shouse, 4.26.01
  162. * Notes:
  163. */
  164. bool NLB_Host::GetStatePersistence (NLB_HostState::NLB_HostStateType eState, bool & bPersist) {
  165. return State.GetPersistence(eState, bPersist);
  166. }
  167. /*
  168. * Method:
  169. * Description:
  170. * Author: Created by shouse, 4.26.01
  171. * Notes:
  172. */
  173. bool NLB_Host::SetDedicatedIPAddress (NLB_IPAddress address) {
  174. NLB_IPAddress::NLB_IPAddressType Type;
  175. if (!address.IsValid())
  176. return false;
  177. if (!address.GetIPAddressType(Type))
  178. return false;
  179. if (Type != NLB_IPAddress::Dedicated)
  180. return false;
  181. DedicatedIPAddress = address;
  182. return true;
  183. }
  184. /*
  185. * Method:
  186. * Description:
  187. * Author: Created by shouse, 4.26.01
  188. * Notes:
  189. */
  190. bool NLB_Host::GetDedicatedIPAddress (NLB_IPAddress & address) {
  191. address = DedicatedIPAddress;
  192. return DedicatedIPAddress.IsValid();
  193. }
  194. /*
  195. * Method:
  196. * Description:
  197. * Author: Created by shouse, 4.26.01
  198. * Notes:
  199. */
  200. bool NLB_Host::SetConnectionIPAddress (NLB_IPAddress address) {
  201. NLB_IPAddress::NLB_IPAddressType Type;
  202. if (!address.IsValid())
  203. return false;
  204. if (!address.GetIPAddressType(Type))
  205. return false;
  206. if (Type != NLB_IPAddress::Connection)
  207. return false;
  208. ConnectionIPAddress = address;
  209. return true;
  210. }
  211. /*
  212. * Method:
  213. * Description:
  214. * Author: Created by shouse, 4.26.01
  215. * Notes:
  216. */
  217. bool NLB_Host::GetConnectionIPAddress (NLB_IPAddress & address) {
  218. address = ConnectionIPAddress;
  219. return ConnectionIPAddress.IsValid();
  220. }
  221. /*
  222. * Method:
  223. * Description:
  224. * Author: Created by shouse, 4.26.01
  225. * Notes:
  226. */
  227. bool NLB_Host::SetAdapterName (PWCHAR pName) {
  228. NLB_ASSERT(pName);
  229. return Adapter.SetName(pName);
  230. }
  231. /*
  232. * Method:
  233. * Description:
  234. * Author: Created by shouse, 4.26.01
  235. * Notes:
  236. */
  237. bool NLB_Host::GetAdapterName (PWCHAR pName, ULONG length) {
  238. NLB_ASSERT(pName);
  239. return Adapter.GetName(pName, length);
  240. }
  241. /*
  242. * Method:
  243. * Description:
  244. * Author: Created by shouse, 4.26.01
  245. * Notes:
  246. */
  247. bool NLB_Host::SetAdapterGUID (PWCHAR pGUID) {
  248. NLB_ASSERT(pGUID);
  249. return Adapter.SetGUID(pGUID);
  250. }
  251. /*
  252. * Method:
  253. * Description:
  254. * Author: Created by shouse, 4.26.01
  255. * Notes:
  256. */
  257. bool NLB_Host::GetAdapterGUID (PWCHAR pGUID, ULONG length) {
  258. NLB_ASSERT(pGUID);
  259. return Adapter.GetGUID(pGUID, length);
  260. }