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.

255 lines
6.2 KiB

  1. //============================================================================
  2. // Copyright (C) Microsoft Corporation, 1997 - 1999
  3. //
  4. // File: ripview.h
  5. //
  6. // History:
  7. // 09/05/97 Kenn M. Takara Created.
  8. //
  9. // IPX RIP view
  10. //
  11. //============================================================================
  12. #ifndef _RIPVIEW_H
  13. #define _RIPVIEW_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 _RIPSTRM_H
  33. #include "ripstrm.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 _RIPSTATS_H_
  42. #include "ripstats.h"
  43. #endif
  44. // forward declarations
  45. struct SRipNodeMenu;
  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. RIP_SI_INTERFACE = 0,
  65. RIP_SI_TYPE,
  66. RIP_SI_ACCEPT_ROUTES,
  67. RIP_SI_SUPPLY_ROUTES,
  68. RIP_SI_UPDATE_MODE,
  69. RIP_SI_UPDATE_PERIOD,
  70. RIP_SI_AGE_MULTIPLIER,
  71. RIP_SI_ADMIN_STATE,
  72. RIP_SI_OPER_STATE,
  73. RIP_SI_PACKETS_SENT,
  74. RIP_SI_PACKETS_RECEIVED,
  75. RIP_SI_MAX_COLUMNS,
  76. };
  77. /*---------------------------------------------------------------------------
  78. We store a pointer to the IPXConnection object in our node data
  79. ---------------------------------------------------------------------------*/
  80. #define GET_RIP_NODEDATA(pNode) \
  81. (IPXConnection *) pNode->GetData(TFS_DATA_USER)
  82. #define SET_RIP_NODEDATA(pNode, pData) \
  83. pNode->SetData(TFS_DATA_USER, (ULONG_PTR) pData)
  84. /*---------------------------------------------------------------------------
  85. Struct: RipListEntry
  86. ---------------------------------------------------------------------------*/
  87. struct RipListEntry
  88. {
  89. SPIInterfaceInfo m_spIf; // ptr to interface
  90. RIP_IF_INFO m_info;
  91. RIP_IF_STATS m_stats;
  92. BOOL m_fClient; // TRUE if client interface
  93. DWORD m_dwIfIndex; // interface index
  94. BOOL m_fFoundIfIndex;
  95. SPITFSNode m_spNode;
  96. BOOL m_fInfoUpdated; // info data has been updated
  97. };
  98. typedef CList<RipListEntry *, RipListEntry *> RipList;
  99. /*---------------------------------------------------------------------------
  100. Class: RipNodeHandler
  101. ---------------------------------------------------------------------------*/
  102. class RipNodeHandler :
  103. public BaseContainerHandler
  104. {
  105. public:
  106. RipNodeHandler(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, RipConfigStream *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 GetRipData(ITFSNode *pThisNode, RipList *pRipList);
  138. HRESULT FillInInterfaceIndex(IPXConnection *pIPXConn, RipList *pRipList);
  139. HRESULT FillClientData(RipListEntry *pRipEntry);
  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. RipConfigStream * m_pConfigStream;
  154. CString m_stTitle;
  155. BOOL m_fProtocolIsRunning; // TRUE if protocol is running
  156. RIPParamsStatistics m_RIPParamsStats;
  157. };
  158. /*---------------------------------------------------------------------------
  159. Class: RipInterfaceHandler
  160. This is the handler for the interface nodes that appear in the Rip
  161. node.
  162. ---------------------------------------------------------------------------*/
  163. class RipInterfaceHandler : public BaseIPXResultHandler
  164. {
  165. public:
  166. RipInterfaceHandler(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 *pRouterInfo, 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 _RIPVIEW_H