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.

243 lines
5.4 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997 - 1998 **/
  4. /**********************************************************************/
  5. /*
  6. ipnamepr.h
  7. Ip name pair (name/ip) class
  8. FILE HISTORY:
  9. */
  10. #ifndef _IPNAMEPR_H
  11. #define _IPNAMEPR_H
  12. #ifndef _IPADDRES_H
  13. #include "ipaddres.h"
  14. #endif
  15. class CIpNamePair : public CObjectPlus
  16. {
  17. public:
  18. CIpNamePair();
  19. CIpNamePair(const CIpAddress& ia, const CString& str);
  20. CIpNamePair(const CIpNamePair& inpAddress);
  21. public:
  22. int Compare(const CIpNamePair& inpTarget, BOOL fBoth) const;
  23. CIpNamePair & operator=(const CIpNamePair& inpNew)
  24. {
  25. m_iaIpAddress = inpNew.m_iaIpAddress;
  26. m_strNetBIOSName = inpNew.m_strNetBIOSName;
  27. return *this;
  28. }
  29. inline CIpAddress QueryIpAddress() const
  30. {
  31. return m_iaIpAddress;
  32. }
  33. inline virtual CIpAddress& GetIpAddress()
  34. {
  35. return m_iaIpAddress;
  36. }
  37. inline virtual void SetIpAddress(CIpAddress& ip)
  38. {
  39. m_iaIpAddress = ip;
  40. }
  41. inline virtual void SetIpAddress(long ip)
  42. {
  43. m_iaIpAddress = ip;
  44. }
  45. inline virtual void SetIpAddress(CString& str)
  46. {
  47. m_iaIpAddress = str;
  48. }
  49. inline CString& GetNetBIOSName()
  50. {
  51. return m_strNetBIOSName;
  52. }
  53. inline void SetNetBIOSName(CString& str)
  54. {
  55. m_strNetBIOSName = str;
  56. }
  57. inline int GetNetBIOSNameLength()
  58. {
  59. return m_nNameLength;
  60. }
  61. inline void SetNetBIOSNameLength(int nLength)
  62. {
  63. m_nNameLength = nLength;
  64. }
  65. int OrderByName ( const CObjectPlus * pobMapping ) const ;
  66. int OrderByIp ( const CObjectPlus * pobMapping ) const ;
  67. protected:
  68. CIpAddress m_iaIpAddress;
  69. CString m_strNetBIOSName;
  70. int m_nNameLength;
  71. };
  72. class CWinsServerObj : public CIpNamePair
  73. {
  74. public:
  75. CWinsServerObj();
  76. CWinsServerObj(
  77. const CIpAddress& ia,
  78. const CString& str,
  79. BOOL fPush = FALSE,
  80. BOOL fPull = FALSE,
  81. CIntlNumber inPushUpdateCount = 0,
  82. CIntlNumber inPullReplicationInterval = 0,
  83. CIntlTime itmPullStartTime = (time_t)0
  84. );
  85. CWinsServerObj(
  86. const CIpNamePair& inpAddress,
  87. BOOL fPush = FALSE,
  88. BOOL fPull = FALSE,
  89. CIntlNumber inPushUpdateCount = 0,
  90. CIntlNumber inPullReplicationInterval = 0,
  91. CIntlTime itmPullStartTime = (time_t)0
  92. );
  93. CWinsServerObj(const CWinsServerObj& wsServer);
  94. public:
  95. CWinsServerObj & operator=(const CWinsServerObj& wsNew);
  96. public:
  97. inline const BOOL IsPush() const
  98. {
  99. return m_fPush;
  100. }
  101. inline const BOOL IsPull() const
  102. {
  103. return m_fPull;
  104. }
  105. void SetPush(BOOL fPush = TRUE, BOOL fClean = FALSE)
  106. {
  107. m_fPush = fPush;
  108. if (fClean)
  109. {
  110. m_fPushInitially = fPush;
  111. }
  112. }
  113. void SetPull(BOOL fPull = TRUE, BOOL fClean = FALSE)
  114. {
  115. m_fPull = fPull;
  116. if (fClean)
  117. {
  118. m_fPullInitially = fPull;
  119. }
  120. }
  121. inline BOOL IsClean() const
  122. {
  123. return m_fPullInitially == m_fPull
  124. && m_fPushInitially == m_fPush;
  125. }
  126. inline void SetPullClean(BOOL fClean = TRUE)
  127. {
  128. m_fPullInitially = m_fPull;
  129. }
  130. inline void SetPrimaryIpAddress(const CIpAddress ia)
  131. {
  132. m_iaPrimaryAddress = ia;
  133. }
  134. inline CIpAddress QueryPrimaryIpAddress() const
  135. {
  136. return m_iaPrimaryAddress;
  137. }
  138. void SetPushClean(BOOL fClean = TRUE)
  139. {
  140. m_fPushInitially = m_fPush;
  141. }
  142. inline CIntlNumber& GetPushUpdateCount()
  143. {
  144. return m_inPushUpdateCount;
  145. }
  146. inline void SetPushUpdateCount(LONG lUpdateCount)
  147. {
  148. m_inPushUpdateCount = lUpdateCount;
  149. }
  150. inline CIntlNumber& GetPullReplicationInterval()
  151. {
  152. return m_inPullReplicationInterval;
  153. }
  154. inline void SetPullReplicationInterval(LONG lPullTimeInterval)
  155. {
  156. m_inPullReplicationInterval = lPullTimeInterval;
  157. }
  158. inline CIntlTime& GetPullStartTime()
  159. {
  160. return m_itmPullStartTime;
  161. }
  162. inline void SetPullStartTime(LONG lSpTime)
  163. {
  164. m_itmPullStartTime = lSpTime;
  165. }
  166. CString& GetstrIPAddress()
  167. {
  168. return m_strIPAddress;
  169. }
  170. void SetstrIPAddress(CString &strIP)
  171. {
  172. m_strIPAddress = strIP;
  173. }
  174. BOOL GetPullPersistence()
  175. {
  176. return m_fPullPersistence;
  177. }
  178. void SetPullPersistence(BOOL bValue)
  179. {
  180. m_fPullPersistence = bValue;
  181. }
  182. BOOL GetPushPersistence()
  183. {
  184. return m_fPushPersistence;
  185. }
  186. void SetPushPersistence(BOOL bValue)
  187. {
  188. m_fPushPersistence = bValue;
  189. }
  190. private:
  191. CIntlNumber m_inPushUpdateCount; // 0 means not specified.
  192. CIntlNumber m_inPullReplicationInterval; // 0 means not specified
  193. CIntlTime m_itmPullStartTime; // 0 means no time selected.
  194. BOOL m_fPull;
  195. BOOL m_fPush;
  196. //
  197. // Change flags
  198. //
  199. BOOL m_fPullInitially;
  200. BOOL m_fPushInitially;
  201. CIpAddress m_iaPrimaryAddress;
  202. CString m_strIPAddress;
  203. // For persistence connection
  204. BOOL m_fPushPersistence;
  205. BOOL m_fPullPersistence;
  206. };
  207. #endif