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.

254 lines
6.2 KiB

  1. //============================================================================
  2. // Copyright (C) Microsoft Corporation, 1997 - 1999
  3. //
  4. // File: sapview.h
  5. //
  6. // History:
  7. // 09/05/97 Kenn M. Takara Created.
  8. //
  9. // IPX SAP view
  10. //
  11. //============================================================================
  12. #ifndef _SAPVIEW_H
  13. #define _SAPVIEW_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 _SAPSTRM_H
  33. #include "sapstrm.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. #ifndef _SAPSTATS_H_
  42. #include "sapstats.h"
  43. #endif
  44. // forward declarations
  45. struct SSapNodeMenu;
  46. /*---------------------------------------------------------------------------
  47. This is the list of columns available for the IP Static Routes
  48. node.
  49. - Interface, e.g. "[1] Foobar nic..."
  50. - Relay mode, e.g. "Enabled"
  51. - Requests received
  52. - Replies received
  53. - Requests discarded
  54. - Replies discarded
  55. - Send failures
  56. - Receive failres
  57. ---------------------------------------------------------------------------*/
  58. //
  59. // If you ADD any columns to this enum, Be sure to update
  60. // the string ids for the column headers in srview.cpp
  61. //
  62. enum
  63. {
  64. SAP_SI_INTERFACE = 0,
  65. SAP_SI_TYPE,
  66. SAP_SI_ACCEPT_ROUTES,
  67. SAP_SI_SUPPLY_ROUTES,
  68. SAP_SI_GSNR,
  69. SAP_SI_UPDATE_MODE,
  70. SAP_SI_UPDATE_PERIOD,
  71. SAP_SI_AGE_MULTIPLIER,
  72. SAP_SI_ADMIN_STATE,
  73. SAP_SI_OPER_STATE,
  74. SAP_SI_PACKETS_SENT,
  75. SAP_SI_PACKETS_RECEIVED,
  76. SAP_SI_MAX_COLUMNS,
  77. };
  78. /*---------------------------------------------------------------------------
  79. We store a pointer to the IPXConnection object in our node data
  80. ---------------------------------------------------------------------------*/
  81. #define GET_SAP_NODEDATA(pNode) \
  82. (IPXConnection *) pNode->GetData(TFS_DATA_USER)
  83. #define SET_SAP_NODEDATA(pNode, pData) \
  84. pNode->SetData(TFS_DATA_USER, (LONG_PTR) pData)
  85. /*---------------------------------------------------------------------------
  86. Struct: SapListEntry
  87. ---------------------------------------------------------------------------*/
  88. struct SapListEntry
  89. {
  90. SPIInterfaceInfo m_spIf; // ptr to interface
  91. SAP_IF_INFO m_info;
  92. SAP_IF_STATS m_stats;
  93. BOOL m_fClient; // TRUE if client interface
  94. DWORD m_dwIfIndex; // interface index
  95. BOOL m_fFoundIfIndex;
  96. SPITFSNode m_spNode;
  97. };
  98. typedef CList<SapListEntry *, SapListEntry *> SapList;
  99. /*---------------------------------------------------------------------------
  100. Class: SapNodeHandler
  101. ---------------------------------------------------------------------------*/
  102. class SapNodeHandler :
  103. public BaseContainerHandler
  104. {
  105. public:
  106. SapNodeHandler(ITFSComponentData *pTFSCompData);
  107. // Override QI to handle embedded interface
  108. STDMETHOD(QueryInterface)(REFIID iid, LPVOID *ppv);
  109. DeclareEmbeddedInterface(IRtrAdviseSink, IUnknown)
  110. // base handler functionality we override
  111. OVERRIDE_NodeHandler_HasPropertyPages();
  112. OVERRIDE_NodeHandler_CreatePropertyPages();
  113. OVERRIDE_NodeHandler_GetString();
  114. OVERRIDE_NodeHandler_OnCreateDataObject();
  115. OVERRIDE_NodeHandler_OnAddMenuItems();
  116. OVERRIDE_NodeHandler_OnCommand();
  117. OVERRIDE_NodeHandler_DestroyHandler();
  118. OVERRIDE_BaseHandlerNotify_OnExpand();
  119. OVERRIDE_ResultHandler_AddMenuItems();
  120. OVERRIDE_ResultHandler_Command();
  121. OVERRIDE_ResultHandler_CompareItems();
  122. OVERRIDE_BaseResultHandlerNotify_OnResultShow();
  123. // Initializes the handler
  124. HRESULT Init(IRouterInfo *pRouter, SapConfigStream *pConfigStream);
  125. // Initializes the node
  126. HRESULT ConstructNode(ITFSNode *pNode);
  127. public:
  128. // Structure used to pass data to callbacks - used as a way of
  129. // avoiding recomputation
  130. struct SMenuData
  131. {
  132. SPITFSNode m_spNode;
  133. };
  134. protected:
  135. // Refresh the data for these nodes
  136. HRESULT SynchronizeNodeData(ITFSNode *pThisNode);
  137. HRESULT GetSapData(ITFSNode *pThisNode, SapList *pSapList);
  138. HRESULT FillInInterfaceIndex(IPXConnection *pIPXConn, SapList *pSapList);
  139. HRESULT FillClientData(SapListEntry *pSapEntry);
  140. // Helper function to add interfaces to the UI
  141. HRESULT AddInterfaceNode(ITFSNode *pParent,
  142. IInterfaceInfo *pIf,
  143. BOOL fClient);
  144. HRESULT AddProtocolToInfoBase(ITFSNode *pParent);
  145. HRESULT AddProtocolToInterface(ITFSNode *pParent);
  146. LONG_PTR m_ulConnId;// notification id for RtrMgrProt
  147. LONG_PTR m_ulRmConnId;
  148. LONG_PTR m_ulRefreshConnId; // notification id for Refresh
  149. LONG_PTR m_ulStatsConnId;
  150. MMC_COOKIE m_cookie; // cookie for the node
  151. SPIRtrMgrInfo m_spRm;
  152. SPIRtrMgrProtocolInfo m_spRmProt;
  153. SapConfigStream * m_pConfigStream;
  154. CString m_stTitle;
  155. BOOL m_fProtocolIsRunning; // TRUE if protocol is running
  156. SAPParamsStatistics m_SAPParamsStats;
  157. };
  158. /*---------------------------------------------------------------------------
  159. Class: SapInterfaceHandler
  160. This is the handler for the interface nodes that appear in the Sap
  161. node.
  162. ---------------------------------------------------------------------------*/
  163. class SapInterfaceHandler : public BaseIPXResultHandler
  164. {
  165. public:
  166. SapInterfaceHandler(ITFSComponentData *pCompData);
  167. OVERRIDE_NodeHandler_HasPropertyPages();
  168. OVERRIDE_NodeHandler_CreatePropertyPages();
  169. OVERRIDE_NodeHandler_OnCreateDataObject();
  170. OVERRIDE_ResultHandler_AddMenuItems();
  171. OVERRIDE_ResultHandler_Command();
  172. OVERRIDE_ResultHandler_OnCreateDataObject();
  173. OVERRIDE_ResultHandler_DestroyResultHandler();
  174. OVERRIDE_ResultHandler_HasPropertyPages()
  175. { return hrOK; };
  176. OVERRIDE_ResultHandler_CreatePropertyPages();
  177. // Initializes the node
  178. HRESULT ConstructNode(ITFSNode *pNode, IInterfaceInfo *pIfInfo,
  179. IPXConnection *pIPXConn);
  180. HRESULT Init(IInterfaceInfo *pInfo, IRouterInfo *pRouter, ITFSNode *pParent);
  181. // Refresh the data for this node
  182. void RefreshInterface(MMC_COOKIE cookie);
  183. public:
  184. // Structure used to pass data to callbacks - used as a way of
  185. // avoiding recomputation
  186. struct SMenuData
  187. {
  188. ULONG m_ulMenuId;
  189. SPITFSNode m_spNode;
  190. };
  191. protected:
  192. LONG_PTR m_ulConnId;
  193. SPIInterfaceInfo m_spInterfaceInfo;
  194. };
  195. #endif _SAPVIEW_H