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.

339 lines
10 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997 - 1999 **/
  4. /**********************************************************************/
  5. /*
  6. nodes.h
  7. This file contains all of the prototypes for the DHCP
  8. objects that appear in the result pane of the MMC framework.
  9. The objects are:
  10. CDhcpActiveLease
  11. CDhcpConflicAddress
  12. CDhcpAllocationRange
  13. CDhcpExclusionRange
  14. CDhcpBootpTableEntry
  15. CDhcpOption
  16. FILE HISTORY:
  17. */
  18. #ifndef _DHCPNODE_H
  19. #define _DHCPNODE_H
  20. #ifndef _DHCPHAND_H
  21. #include "dhcphand.h"
  22. #endif
  23. extern const TCHAR g_szClientTypeDhcp[];
  24. extern const TCHAR g_szClientTypeBootp[];
  25. extern const TCHAR g_szClientTypeBoth[];
  26. #define TYPE_FLAG_RESERVATION 0x00000001
  27. #define TYPE_FLAG_ACTIVE 0x00000002
  28. #define TYPE_FLAG_BAD_ADDRESS 0x00000004
  29. #define TYPE_FLAG_RAS 0x00000008
  30. #define TYPE_FLAG_GHOST 0x00000010
  31. // NT5 lease types
  32. #define TYPE_FLAG_DNS_REG 0x00000020
  33. #define TYPE_FLAG_DNS_UNREG 0x00000040
  34. #define TYPE_FLAG_DOOMED 0x00000080
  35. #define RAS_UID _T("RAS")
  36. /*---------------------------------------------------------------------------
  37. Class: CDhcpActiveLease
  38. ---------------------------------------------------------------------------*/
  39. class CDhcpActiveLease : public CDhcpHandler
  40. {
  41. // Constructor/destructor
  42. public:
  43. CDhcpActiveLease(ITFSComponentData * pTFSCompData, LPDHCP_CLIENT_INFO_V5 pDhcpClientInfo);
  44. CDhcpActiveLease(ITFSComponentData * pTFSCompData, LPDHCP_CLIENT_INFO_V4 pDhcpClientInfo);
  45. CDhcpActiveLease(ITFSComponentData * pTFSCompData, LPDHCP_CLIENT_INFO pDhcpClientInfo);
  46. CDhcpActiveLease(ITFSComponentData * pTFSCompData, CDhcpClient & pClient);
  47. ~CDhcpActiveLease();
  48. // Interface
  49. public:
  50. // Result handler functionality
  51. OVERRIDE_ResultHandler_HasPropertyPages() { return hrFalse; }
  52. OVERRIDE_ResultHandler_CreatePropertyPages();
  53. OVERRIDE_ResultHandler_AddMenuItems();
  54. OVERRIDE_ResultHandler_Command();
  55. OVERRIDE_ResultHandler_GetString();
  56. // base result handler overridees
  57. OVERRIDE_BaseResultHandlerNotify_OnResultRefresh();
  58. public:
  59. DHCP_IP_ADDRESS GetIpAddress() { return m_dhcpClientIpAddress; };
  60. void GetLeaseExpirationTime (CTime & time);
  61. BOOL IsReservation(BOOL * pbIsActive, BOOL * pbIsBad);
  62. BOOL IsBadAddress() { return m_dwTypeFlags & TYPE_FLAG_BAD_ADDRESS; }
  63. BOOL IsGhost() { return m_dwTypeFlags & TYPE_FLAG_GHOST; }
  64. BOOL IsUnreg() { return m_dwTypeFlags & TYPE_FLAG_DNS_UNREG; }
  65. BOOL IsDoomed() { return m_dwTypeFlags & TYPE_FLAG_DOOMED; }
  66. LPCTSTR GetClientLeaseExpires() { return m_strLeaseExpires; }
  67. LPCTSTR GetClientType();
  68. LPCTSTR GetUID() { return m_strUID; }
  69. LPCTSTR GetComment() { return m_strComment; }
  70. HRESULT DoPropSheet(ITFSNode * pNode,
  71. LPPROPERTYSHEETCALLBACK lpProvider = NULL,
  72. LONG_PTR handle = 0);
  73. void SetReservation(BOOL fIsRes);
  74. //
  75. // All of these items are optional info
  76. //
  77. LPCTSTR GetClientName() { return m_strClientName; }
  78. HRESULT SetClientName(LPCTSTR pName);
  79. BYTE SetClientType(BYTE bClientType) { BYTE bTmp = m_bClientType; m_bClientType = bClientType; return bTmp; }
  80. // Implementation
  81. public:
  82. // CDhcpHandler overrides
  83. virtual HRESULT InitializeNode(ITFSNode * pNode);
  84. private:
  85. void InitInfo(LPDHCP_CLIENT_INFO pDhcpClientInfo);
  86. // Attributes
  87. private:
  88. DHCP_IP_ADDRESS m_dhcpClientIpAddress;
  89. CString m_strClientName;
  90. CString m_strLeaseExpires;
  91. CTime m_timeLeaseExpires;
  92. DWORD m_dwTypeFlags; // Reservation, Active/Inactive, Bad Address
  93. BYTE m_bClientType; // DHCP, BOOTP or both
  94. CString m_strUID;
  95. CString m_strComment;
  96. FILETIME m_leaseExpires;
  97. };
  98. /*---------------------------------------------------------------------------
  99. Class: CDhcpAllocationRange
  100. ---------------------------------------------------------------------------*/
  101. class CDhcpAllocationRange : public CDhcpHandler, public CDhcpIpRange
  102. {
  103. // Constructor/destructor
  104. public:
  105. CDhcpAllocationRange(ITFSComponentData * pTFSCompData, DHCP_IP_RANGE * pdhcpIpRange);
  106. CDhcpAllocationRange(ITFSComponentData * pTFSCompData, DHCP_BOOTP_IP_RANGE * pdhcpIpRange);
  107. // Interface
  108. public:
  109. // Result handler functionality
  110. OVERRIDE_ResultHandler_GetString();
  111. OVERRIDE_BaseResultHandlerNotify_OnResultRefresh();
  112. // Implementation
  113. public:
  114. // CDhcpHandler overrides
  115. virtual HRESULT InitializeNode(ITFSNode * pNode);
  116. private:
  117. // Attributes
  118. private:
  119. CString m_strEndIpAddress;
  120. CString m_strDescription;
  121. ULONG m_BootpAllocated;
  122. ULONG m_MaxBootpAllowed;
  123. };
  124. /*---------------------------------------------------------------------------
  125. Class: CDhcpExclusionRange
  126. ---------------------------------------------------------------------------*/
  127. class CDhcpExclusionRange : public CDhcpHandler, public CDhcpIpRange
  128. {
  129. public:
  130. CDhcpExclusionRange(ITFSComponentData * pTFSCompData, DHCP_IP_RANGE * pdhcpIpRange);
  131. // Interface
  132. public:
  133. // Result handler functionality
  134. OVERRIDE_ResultHandler_GetString();
  135. // base result handler overrides
  136. OVERRIDE_BaseResultHandlerNotify_OnResultSelect();
  137. OVERRIDE_BaseResultHandlerNotify_OnResultRefresh();
  138. // Implementation
  139. public:
  140. // CDhcpHandler overrides
  141. virtual HRESULT InitializeNode(ITFSNode * pNode);
  142. private:
  143. // Attributes
  144. private:
  145. CString m_strEndIpAddress;
  146. CString m_strDescription;
  147. };
  148. /*---------------------------------------------------------------------------
  149. Class: CDhcpBootpEntry
  150. ---------------------------------------------------------------------------*/
  151. class CDhcpBootpEntry : public CDhcpHandler
  152. {
  153. public:
  154. CDhcpBootpEntry(ITFSComponentData * pTFSCompData);
  155. //Interface
  156. public:
  157. // Result handler functionality
  158. OVERRIDE_ResultHandler_HasPropertyPages() { return hrOK; }
  159. OVERRIDE_ResultHandler_GetString();
  160. // base result handler overrides
  161. OVERRIDE_BaseResultHandlerNotify_OnResultPropertyChange();
  162. OVERRIDE_BaseResultHandlerNotify_OnResultRefresh();
  163. //Implementation
  164. public:
  165. WCHAR * InitData(CONST WCHAR grszwBootTable[], DWORD dwLength);
  166. int CchGetDataLength();
  167. WCHAR * PchStoreData(OUT WCHAR szwBuffer[]);
  168. void SetBootImage(LPCTSTR szBootImage) { m_strBootImage = szBootImage; }
  169. void SetFileServer(LPCTSTR szFileServer) { m_strFileServer = szFileServer; }
  170. void SetFileName(LPCTSTR szFileName) { m_strFileName = szFileName; }
  171. LPCTSTR QueryBootImage() { return m_strBootImage; }
  172. LPCTSTR QueryFileServer() { return m_strFileServer; }
  173. LPCTSTR QueryFileName() { return m_strFileName; }
  174. BOOL operator == (CDhcpBootpEntry & bootpEntry);
  175. public:
  176. // CDhcpHandler overrides
  177. virtual HRESULT InitializeNode(ITFSNode * pNode);
  178. private:
  179. //Attributes
  180. private:
  181. CString m_strBootImage;
  182. CString m_strFileServer;
  183. CString m_strFileName;
  184. };
  185. /*---------------------------------------------------------------------------
  186. Class: CDhcpOptionItem
  187. ---------------------------------------------------------------------------*/
  188. class CDhcpOptionItem : public CDhcpHandler, public CDhcpOptionValue
  189. {
  190. public:
  191. CDhcpOptionItem(ITFSComponentData * pTFSCompData,
  192. LPDHCP_OPTION_VALUE pOptionValue,
  193. int nOptionImage);
  194. CDhcpOptionItem(ITFSComponentData * pTFSCompData,
  195. CDhcpOption * pOption,
  196. int nOptionImage);
  197. ~CDhcpOptionItem();
  198. // Interface
  199. public:
  200. // Result handler functionality
  201. OVERRIDE_ResultHandler_GetString();
  202. OVERRIDE_ResultHandler_HasPropertyPages() { return hrOK; }
  203. OVERRIDE_ResultHandler_CreatePropertyPages();
  204. OVERRIDE_BaseResultHandlerNotify_OnResultRefresh();
  205. // Implementation
  206. public:
  207. // CDhcpHandler overrides
  208. virtual HRESULT InitializeNode(ITFSNode * pNode);
  209. public:
  210. // helpers
  211. DHCP_OPTION_ID GetOptionId() { return m_dhcpOptionId; }
  212. LPCTSTR GetVendor() { return m_strVendor.IsEmpty() ? NULL : (LPCTSTR) m_strVendor; }
  213. LPCTSTR GetVendorDisplay() { return m_strVendorDisplay; }
  214. LPCTSTR GetClassName() { return m_strClassName; }
  215. BOOL IsVendorOption() { return m_strVendor.IsEmpty() ? FALSE : TRUE; }
  216. BOOL IsClassOption() { return m_strClassName.IsEmpty() ? FALSE : TRUE; }
  217. void SetClassName(LPCTSTR pClassName) { m_strClassName = pClassName; }
  218. void SetVendor(LPCTSTR pszVendor);
  219. private:
  220. CDhcpOption * FindOptionDefinition(ITFSComponent * pComponent, ITFSNode * pNode);
  221. // Attributes
  222. private:
  223. CString m_strName;
  224. CString m_strValue;
  225. CString m_strVendor;
  226. CString m_strVendorDisplay;
  227. CString m_strClassName;
  228. DHCP_OPTION_ID m_dhcpOptionId;
  229. int m_nOptionImage;
  230. };
  231. /*---------------------------------------------------------------------------
  232. Class: CDhcpMCastLease
  233. ---------------------------------------------------------------------------*/
  234. class CDhcpMCastLease : public CDhcpHandler
  235. {
  236. public:
  237. CDhcpMCastLease(ITFSComponentData * pTFSCompData);
  238. // Interface
  239. public:
  240. // Result handler functionality
  241. OVERRIDE_ResultHandler_GetString();
  242. OVERRIDE_ResultHandler_HasPropertyPages() { return hrFalse; }
  243. OVERRIDE_BaseResultHandlerNotify_OnResultRefresh();
  244. // Implementation
  245. public:
  246. // CDhcpHandler overrides
  247. virtual HRESULT InitializeNode(ITFSNode * pNode);
  248. public:
  249. // helpers
  250. HRESULT InitMCastInfo(LPDHCP_MCLIENT_INFO pMClientInfo);
  251. DHCP_IP_ADDRESS GetIpAddress() { return m_dhcpClientIpAddress; };
  252. LPCTSTR GetName() { return m_strName; }
  253. void SetName(LPCTSTR pName) { m_strName = pName; }
  254. LPCTSTR GetClientId() { return m_strUID; }
  255. void GetLeaseStartTime (CTime & time) { time = m_timeStart; }
  256. void GetLeaseExpirationTime (CTime & time) { time = m_timeStop; }
  257. private:
  258. // Attributes
  259. private:
  260. CString m_strIp;
  261. CString m_strName;
  262. CString m_strLeaseStart;
  263. CString m_strLeaseStop;
  264. CString m_strUID;
  265. CTime m_timeStart;
  266. CTime m_timeStop;
  267. DHCP_IP_ADDRESS m_dhcpClientIpAddress;
  268. DWORD m_dwTypeFlags;
  269. };
  270. #endif _DHCPNODE_H