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.

340 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_CreatePropertyPages();
  160. OVERRIDE_ResultHandler_GetString();
  161. // base result handler overrides
  162. OVERRIDE_BaseResultHandlerNotify_OnResultPropertyChange();
  163. OVERRIDE_BaseResultHandlerNotify_OnResultRefresh();
  164. //Implementation
  165. public:
  166. WCHAR * InitData(CONST WCHAR grszwBootTable[], DWORD dwLength);
  167. int CchGetDataLength();
  168. WCHAR * PchStoreData(OUT WCHAR szwBuffer[]);
  169. void SetBootImage(LPCTSTR szBootImage) { m_strBootImage = szBootImage; }
  170. void SetFileServer(LPCTSTR szFileServer) { m_strFileServer = szFileServer; }
  171. void SetFileName(LPCTSTR szFileName) { m_strFileName = szFileName; }
  172. LPCTSTR QueryBootImage() { return m_strBootImage; }
  173. LPCTSTR QueryFileServer() { return m_strFileServer; }
  174. LPCTSTR QueryFileName() { return m_strFileName; }
  175. BOOL operator == (CDhcpBootpEntry & bootpEntry);
  176. public:
  177. // CDhcpHandler overrides
  178. virtual HRESULT InitializeNode(ITFSNode * pNode);
  179. private:
  180. //Attributes
  181. private:
  182. CString m_strBootImage;
  183. CString m_strFileServer;
  184. CString m_strFileName;
  185. };
  186. /*---------------------------------------------------------------------------
  187. Class: CDhcpOptionItem
  188. ---------------------------------------------------------------------------*/
  189. class CDhcpOptionItem : public CDhcpHandler, public CDhcpOptionValue
  190. {
  191. public:
  192. CDhcpOptionItem(ITFSComponentData * pTFSCompData,
  193. LPDHCP_OPTION_VALUE pOptionValue,
  194. int nOptionImage);
  195. CDhcpOptionItem(ITFSComponentData * pTFSCompData,
  196. CDhcpOption * pOption,
  197. int nOptionImage);
  198. ~CDhcpOptionItem();
  199. // Interface
  200. public:
  201. // Result handler functionality
  202. OVERRIDE_ResultHandler_GetString();
  203. OVERRIDE_ResultHandler_HasPropertyPages() { return hrOK; }
  204. OVERRIDE_ResultHandler_CreatePropertyPages();
  205. OVERRIDE_BaseResultHandlerNotify_OnResultRefresh();
  206. // Implementation
  207. public:
  208. // CDhcpHandler overrides
  209. virtual HRESULT InitializeNode(ITFSNode * pNode);
  210. public:
  211. // helpers
  212. DHCP_OPTION_ID GetOptionId() { return m_dhcpOptionId; }
  213. LPCTSTR GetVendor() { return m_strVendor.IsEmpty() ? NULL : (LPCTSTR) m_strVendor; }
  214. LPCTSTR GetVendorDisplay() { return m_strVendorDisplay; }
  215. LPCTSTR GetClassName() { return m_strClassName; }
  216. BOOL IsVendorOption() { return m_strVendor.IsEmpty() ? FALSE : TRUE; }
  217. BOOL IsClassOption() { return m_strClassName.IsEmpty() ? FALSE : TRUE; }
  218. void SetClassName(LPCTSTR pClassName) { m_strClassName = pClassName; }
  219. void SetVendor(LPCTSTR pszVendor);
  220. private:
  221. CDhcpOption * FindOptionDefinition(ITFSComponent * pComponent, ITFSNode * pNode);
  222. // Attributes
  223. private:
  224. CString m_strName;
  225. CString m_strValue;
  226. CString m_strVendor;
  227. CString m_strVendorDisplay;
  228. CString m_strClassName;
  229. DHCP_OPTION_ID m_dhcpOptionId;
  230. int m_nOptionImage;
  231. };
  232. /*---------------------------------------------------------------------------
  233. Class: CDhcpMCastLease
  234. ---------------------------------------------------------------------------*/
  235. class CDhcpMCastLease : public CDhcpHandler
  236. {
  237. public:
  238. CDhcpMCastLease(ITFSComponentData * pTFSCompData);
  239. // Interface
  240. public:
  241. // Result handler functionality
  242. OVERRIDE_ResultHandler_GetString();
  243. OVERRIDE_ResultHandler_HasPropertyPages() { return hrFalse; }
  244. OVERRIDE_BaseResultHandlerNotify_OnResultRefresh();
  245. // Implementation
  246. public:
  247. // CDhcpHandler overrides
  248. virtual HRESULT InitializeNode(ITFSNode * pNode);
  249. public:
  250. // helpers
  251. HRESULT InitMCastInfo(LPDHCP_MCLIENT_INFO pMClientInfo);
  252. DHCP_IP_ADDRESS GetIpAddress() { return m_dhcpClientIpAddress; };
  253. LPCTSTR GetName() { return m_strName; }
  254. void SetName(LPCTSTR pName) { m_strName = pName; }
  255. LPCTSTR GetClientId() { return m_strUID; }
  256. void GetLeaseStartTime (CTime & time) { time = m_timeStart; }
  257. void GetLeaseExpirationTime (CTime & time) { time = m_timeStop; }
  258. private:
  259. // Attributes
  260. private:
  261. CString m_strIp;
  262. CString m_strName;
  263. CString m_strLeaseStart;
  264. CString m_strLeaseStop;
  265. CString m_strUID;
  266. CTime m_timeStart;
  267. CTime m_timeStop;
  268. DHCP_IP_ADDRESS m_dhcpClientIpAddress;
  269. DWORD m_dwTypeFlags;
  270. };
  271. #endif _DHCPNODE_H