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.

284 lines
7.2 KiB

  1. //============================================================================
  2. // Copyright (C) Microsoft Corporation, 1997 - 1999
  3. //
  4. // File: summary.h
  5. //
  6. // History:
  7. // 07/22/97 Kenn M. Takara Created.
  8. //
  9. // IPX interfaces summary view.
  10. //
  11. //============================================================================
  12. #ifndef _SUMMARY_H
  13. #define _SUMMARY_H
  14. #ifndef _BASEHAND_H
  15. #include "basehand.h"
  16. #endif
  17. #ifndef _HANDLERS_H
  18. #include "handlers.h"
  19. #endif
  20. #ifndef _XSTREAM_H
  21. #include "xstream.h" // need for ColumnData
  22. #endif
  23. #ifndef _INFO_H
  24. #include "info.h"
  25. #endif
  26. #ifndef _IPXFACE_H
  27. #include "ipxface.h"
  28. #endif
  29. #ifndef _BASECON_H
  30. #include "basecon.h" // BaseContainerHandler
  31. #endif
  32. #ifndef _IPXSTRM_H
  33. #include "ipxstrm.h"
  34. #endif
  35. #ifndef _RTRSHEET_H
  36. #include "rtrsheet.h"
  37. #endif
  38. #ifndef _IPXCONN_H
  39. #include "ipxconn.h" // IPXConnection
  40. #endif
  41. // forward declarations
  42. class IPXAdminConfigStream;
  43. struct SIPXSummaryNodeMenu;
  44. /*---------------------------------------------------------------------------
  45. This is the list of columns available for the IPX Summary interfaces
  46. node.
  47. - Name, "[1] DEC DE500 ..."
  48. - Type, "Dedicated"
  49. - Adminstrative status, "Up"
  50. - Operational status, "Operational"
  51. - Packets sent
  52. - Packets received
  53. - Out filtered packets
  54. - Out dropped packets
  55. - In filtered packets
  56. - In No-routes packets
  57. - In Dropped packets
  58. ---------------------------------------------------------------------------*/
  59. //
  60. // If you ADD any columns to this enum, Be sure to update
  61. // the string ids for the column headers in summary.cpp
  62. //
  63. enum
  64. {
  65. IPXSUM_SI_NAME = 0,
  66. IPXSUM_SI_TYPE,
  67. IPXSUM_SI_ADMINSTATE,
  68. IPXSUM_SI_OPERSTATE,
  69. IPXSUM_SI_NETWORK,
  70. IPXSUM_SI_PACKETS_SENT,
  71. IPXSUM_SI_PACKETS_RCVD,
  72. IPXSUM_SI_OUT_FILTERED,
  73. IPXSUM_SI_OUT_DROPPED,
  74. IPXSUM_SI_IN_FILTERED,
  75. IPXSUM_SI_IN_NOROUTES,
  76. IPXSUM_SI_IN_DROPPED,
  77. IPXSUM_MAX_COLUMNS
  78. };
  79. /*---------------------------------------------------------------------------
  80. We store a pointer to the IPXConnection object in our node data
  81. ---------------------------------------------------------------------------*/
  82. #define GET_IPXSUMMARY_NODEDATA(pNode) \
  83. (IPXConnection *) pNode->GetData(TFS_DATA_USER)
  84. #define SET_IPXSUMMARY_NODEDATA(pNode, pData) \
  85. pNode->SetData(TFS_DATA_USER, (LONG_PTR) pData)
  86. /*---------------------------------------------------------------------------
  87. Struct: IPXSummaryListEntry
  88. ---------------------------------------------------------------------------*/
  89. struct IPXSummaryListEntry
  90. {
  91. CString m_stId;
  92. CString m_stTitle;
  93. UCHAR m_network[4];
  94. DWORD m_dwAdminState;
  95. DWORD m_dwIfType;
  96. DWORD m_dwOperState;
  97. DWORD m_dwSent;
  98. DWORD m_dwRcvd;
  99. DWORD m_dwOutFiltered;
  100. DWORD m_dwOutDropped;
  101. DWORD m_dwInFiltered;
  102. DWORD m_dwInNoRoutes;
  103. DWORD m_dwInDropped;
  104. };
  105. typedef CList<IPXSummaryListEntry *, IPXSummaryListEntry *> IPXSummaryList;
  106. /*---------------------------------------------------------------------------
  107. Class: IPXSummaryHandler
  108. ---------------------------------------------------------------------------*/
  109. class IPXSummaryHandler :
  110. public BaseContainerHandler
  111. {
  112. public:
  113. IPXSummaryHandler(ITFSComponentData *pTFSCompData);
  114. // Override QI to handle embedded interface
  115. STDMETHOD(QueryInterface)(REFIID iid, LPVOID *ppv);
  116. DeclareEmbeddedInterface(IRtrAdviseSink, IUnknown)
  117. // base handler functionality we override
  118. OVERRIDE_NodeHandler_GetString();
  119. OVERRIDE_NodeHandler_OnCreateDataObject();
  120. OVERRIDE_NodeHandler_OnAddMenuItems();
  121. OVERRIDE_NodeHandler_OnCommand();
  122. OVERRIDE_NodeHandler_DestroyHandler();
  123. OVERRIDE_BaseHandlerNotify_OnExpand();
  124. OVERRIDE_ResultHandler_AddMenuItems();
  125. OVERRIDE_ResultHandler_Command();
  126. OVERRIDE_ResultHandler_CompareItems();
  127. OVERRIDE_BaseResultHandlerNotify_OnResultShow();
  128. OVERRIDE_BaseResultHandlerNotify_OnResultRefresh();
  129. // Initializes the handler
  130. HRESULT Init(IRtrMgrInfo *pRtrMgrInfo, IPXAdminConfigStream *pConfigStream);
  131. // Initializes the node
  132. HRESULT ConstructNode(ITFSNode *pNode, LPCTSTR szName,
  133. IPXConnection *pIPXConn);
  134. public:
  135. // Structure used to pass data to callbacks - used as a way of
  136. // avoiding recomputation
  137. struct SMenuData
  138. {
  139. SPITFSNode m_spNode;
  140. };
  141. // Function callbacks for menu enabling/disabling
  142. protected:
  143. // Refresh the data for these nodes
  144. HRESULT SynchronizeNodeData(ITFSNode *pThisNode);
  145. HRESULT GetIPXSummaryData(ITFSNode *pThisNode, IPXSummaryList * pIPXSumList);
  146. HRESULT GetClientInterfaceData(IPXSummaryListEntry *pClient, IRtrMgrInfo *pRm);
  147. // Helper function to add interfaces to the UI
  148. HRESULT AddInterfaceNode(ITFSNode *pParent,
  149. IInterfaceInfo *pIf,
  150. BOOL fClient,
  151. ITFSNode **ppNewNode);
  152. // Command implementations
  153. HRESULT OnNewInterface();
  154. LONG_PTR m_ulConnId; // notification id for router info
  155. LONG_PTR m_ulRefreshConnId; // notification id for router refresh
  156. LONG_PTR m_ulStatsConnId; // notification for stats refresh
  157. MMC_COOKIE m_cookie; // cookie for the node
  158. SPIRtrMgrInfo m_spRtrMgrInfo;
  159. IPXAdminConfigStream * m_pConfigStream;
  160. CString m_stTitle;
  161. };
  162. /*---------------------------------------------------------------------------
  163. Class: IPXSummaryInterfaceHandler
  164. This is the handler for the interface nodes that appear in the IPXSummary
  165. node.
  166. ---------------------------------------------------------------------------*/
  167. class IPXSummaryInterfaceHandler : public BaseIPXResultHandler
  168. {
  169. public:
  170. IPXSummaryInterfaceHandler(ITFSComponentData *pCompData);
  171. OVERRIDE_NodeHandler_HasPropertyPages();
  172. OVERRIDE_NodeHandler_CreatePropertyPages();
  173. OVERRIDE_NodeHandler_OnCreateDataObject();
  174. OVERRIDE_ResultHandler_AddMenuItems();
  175. OVERRIDE_ResultHandler_Command();
  176. OVERRIDE_ResultHandler_OnCreateDataObject();
  177. OVERRIDE_ResultHandler_DestroyResultHandler();
  178. OVERRIDE_ResultHandler_HasPropertyPages()
  179. { return hrOK; };
  180. OVERRIDE_ResultHandler_CreatePropertyPages();
  181. OVERRIDE_BaseResultHandlerNotify_OnResultDelete();
  182. // Initializes the node
  183. HRESULT ConstructNode(ITFSNode *pNode, IInterfaceInfo *pIfInfo,
  184. IPXConnection *pIPXConn);
  185. HRESULT Init(IRtrMgrInfo *pRm, IInterfaceInfo *pInfo,
  186. ITFSNode *pParent);
  187. // Removes IPX from this interface
  188. HRESULT OnRemoveInterface();
  189. // Refresh the data for this node
  190. void RefreshInterface(MMC_COOKIE cookie);
  191. //sets the IPX enable/disable flag for the interface
  192. HRESULT OnEnableDisableIPX(BOOL fEnable, MMC_COOKIE cookie );
  193. void SetInfoBase(SPIInfoBase & spInfoBase )
  194. {
  195. m_spInfoBase = spInfoBase.Transfer();
  196. };
  197. private:
  198. HRESULT LoadInfoBase( IPXConnection *pIPXConn);
  199. HRESULT SaveChanges();
  200. public:
  201. // Structure used to pass data to callbacks - used as a way of
  202. // avoiding recomputation
  203. struct SMenuData
  204. {
  205. SPITFSNode m_spNode;
  206. SPIInterfaceInfo m_spInterfaceInfo;
  207. SPIInfoBase m_spInfoBaseCopy;
  208. };
  209. static ULONG GetUpdateRoutesFlags(const SRouterNodeMenu *, INT_PTR);
  210. static ULONG GetEnableFlags(const SRouterNodeMenu *, INT_PTR);
  211. static ULONG GetDisableFlags(const SRouterNodeMenu *, INT_PTR);
  212. HRESULT OnUpdateRoutes(MMC_COOKIE cookie);
  213. protected:
  214. LONG_PTR m_ulConnId;
  215. SPIRtrMgrInfo m_spRm;
  216. SPIInterfaceInfo m_spInterfaceInfo;
  217. SPIInfoBase m_spInfoBase;
  218. SPIRtrMgrInterfaceInfo m_spRmIf;
  219. BOOL m_bClientInfoBase;
  220. IPXConnection * m_pIPXConn;
  221. };
  222. #endif _SUMMARY_H