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.

306 lines
8.0 KiB

  1. //============================================================================
  2. // Copyright (C) Microsoft Corporation, 1997 - 1999
  3. //
  4. // File: ssview.h
  5. //
  6. // History:
  7. // 09/05/97 Kenn M. Takara Created.
  8. //
  9. // IPX Static Routes view
  10. //
  11. //============================================================================
  12. #ifndef _SSVIEW_H
  13. #define _SSVIEW_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. #include "ipxstats.h" // IPX statistics dialogs
  42. // forward declarations
  43. class IPXAdminConfigStream;
  44. struct SIpxSSNodeMenu;
  45. /*---------------------------------------------------------------------------
  46. This is the list of columns available for the IPX Static Routes
  47. node.
  48. - Name, "[1] DEC DE500 ..."
  49. - Service Type, 1231
  50. - Service Name, "foobar"
  51. - Service Address, "111.111.11"
  52. - Hop Count
  53. ---------------------------------------------------------------------------*/
  54. //
  55. // If you ADD any columns to this enum, Be sure to update
  56. // the string ids for the column headers in ssview.cpp
  57. //
  58. enum
  59. {
  60. IPX_SS_SI_NAME = 0,
  61. IPX_SS_SI_SERVICE_TYPE,
  62. IPX_SS_SI_SERVICE_NAME,
  63. IPX_SS_SI_SERVICE_ADDRESS,
  64. IPX_SS_SI_HOP_COUNT,
  65. IPX_SS_MAX_COLUMNS,
  66. };
  67. /*---------------------------------------------------------------------------
  68. We store a pointer to the IPConnection object in our node data
  69. ---------------------------------------------------------------------------*/
  70. #define GET_IPX_SS_NODEDATA(pNode) \
  71. (IPXConnection *) pNode->GetData(TFS_DATA_USER)
  72. #define SET_IPX_SS_NODEDATA(pNode, pData) \
  73. pNode->SetData(TFS_DATA_USER, (LONG_PTR) pData)
  74. /*---------------------------------------------------------------------------
  75. Struct: IpxSSListEntry
  76. This is an intermediate data structure. Our data-gathering routines
  77. will generate a list of these data items. We will then use this list
  78. to populate result pane. This will (eventually) be generated by the
  79. Refresh mechanism. This separation of data gathering and UI code will
  80. allow us to easily move the data gathering to a background thread.
  81. ---------------------------------------------------------------------------*/
  82. struct IpxSSListEntry
  83. {
  84. SPIInterfaceInfo m_spIf;
  85. IPX_STATIC_SERVICE_INFO m_service;
  86. void LoadFrom(BaseIPXResultNodeData *pNodeData);
  87. void SaveTo(BaseIPXResultNodeData *pNodeData);
  88. };
  89. typedef CList<IpxSSListEntry *, IpxSSListEntry *> IpxSSList;
  90. /*---------------------------------------------------------------------------
  91. Class: IpxSSHandler
  92. ---------------------------------------------------------------------------*/
  93. class IpxSSHandler :
  94. public BaseContainerHandler
  95. {
  96. public:
  97. IpxSSHandler(ITFSComponentData *pTFSCompData);
  98. ~IpxSSHandler();
  99. // Override QI to handle embedded interface
  100. STDMETHOD(QueryInterface)(REFIID iid, LPVOID *ppv);
  101. DeclareEmbeddedInterface(IRtrAdviseSink, IUnknown)
  102. // base handler functionality we override
  103. OVERRIDE_NodeHandler_HasPropertyPages();
  104. OVERRIDE_NodeHandler_GetString();
  105. OVERRIDE_NodeHandler_OnCreateDataObject();
  106. OVERRIDE_NodeHandler_OnAddMenuItems();
  107. OVERRIDE_NodeHandler_OnCommand();
  108. OVERRIDE_NodeHandler_DestroyHandler();
  109. OVERRIDE_BaseHandlerNotify_OnExpand();
  110. OVERRIDE_ResultHandler_AddMenuItems();
  111. OVERRIDE_ResultHandler_Command();
  112. OVERRIDE_ResultHandler_CompareItems();
  113. OVERRIDE_BaseResultHandlerNotify_OnResultShow();
  114. OVERRIDE_BaseResultHandlerNotify_OnResultRefresh();
  115. // Initializes the handler
  116. HRESULT Init(IRtrMgrInfo *pRtrMgrInfo, IPXAdminConfigStream *pConfigStream);
  117. // Initializes the node
  118. HRESULT ConstructNode(ITFSNode *pNode, LPCTSTR szName,
  119. IPXConnection *pIPXConn);
  120. public:
  121. // Structure used to pass data to callbacks - used as a way of
  122. // avoiding recomputation
  123. struct SMenuData
  124. {
  125. SPITFSNode m_spNode;
  126. };
  127. // Function callbacks for menu enabling/disabling
  128. protected:
  129. // Refresh the data for these nodes
  130. HRESULT SynchronizeNodeData(ITFSNode *pThisNode);
  131. HRESULT MarkAllNodes(ITFSNode *pNode, ITFSNodeEnum *pEnum);
  132. HRESULT RemoveAllUnmarkedNodes(ITFSNode *pNode, ITFSNodeEnum *pEnum);
  133. HRESULT GenerateListOfServices(ITFSNode *pNode, IpxSSList *pSSList);
  134. // Helper function to add interfaces to the UI
  135. HRESULT AddStaticServiceNode(ITFSNode *pParent, IpxSSListEntry *pRoute);
  136. // Command implementations
  137. HRESULT OnNewService(ITFSNode *pNode);
  138. LONG_PTR m_ulConnId; // notification id for router info
  139. LONG_PTR m_ulRefreshConnId; // notification id for router refresh
  140. MMC_COOKIE m_cookie; // cookie for the node
  141. SPIRtrMgrInfo m_spRtrMgrInfo;
  142. IPXAdminConfigStream * m_pConfigStream;
  143. CString m_stTitle;
  144. };
  145. /*---------------------------------------------------------------------------
  146. Class: IpxServiceHandler
  147. This is the handler for the interface nodes that appear in the IPStaticServices
  148. node.
  149. ---------------------------------------------------------------------------*/
  150. class IpxServiceHandler : public BaseIPXResultHandler
  151. {
  152. public:
  153. IpxServiceHandler(ITFSComponentData *pCompData);
  154. OVERRIDE_NodeHandler_HasPropertyPages();
  155. OVERRIDE_NodeHandler_CreatePropertyPages();
  156. OVERRIDE_NodeHandler_OnCreateDataObject();
  157. OVERRIDE_ResultHandler_AddMenuItems();
  158. OVERRIDE_ResultHandler_Command();
  159. OVERRIDE_ResultHandler_OnCreateDataObject();
  160. OVERRIDE_ResultHandler_DestroyResultHandler();
  161. OVERRIDE_ResultHandler_HasPropertyPages();
  162. OVERRIDE_ResultHandler_CreatePropertyPages();
  163. OVERRIDE_BaseResultHandlerNotify_OnResultDelete();
  164. // Initializes the node
  165. HRESULT ConstructNode(ITFSNode *pNode, IInterfaceInfo *pIfInfo,
  166. IPXConnection *pIPXConn);
  167. HRESULT Init(IInterfaceInfo *pInfo, ITFSNode *pParent);
  168. // Refreshes all routes
  169. HRESULT ParentRefresh(ITFSNode *pNode);
  170. // Removes the static route
  171. HRESULT OnRemoveStaticService(ITFSNode *pNode);
  172. // Route modification apis
  173. HRESULT RemoveStaticService(IpxSSListEntry *pSSEntry, IInfoBase *pInfo);
  174. HRESULT ModifyRouteInfo(ITFSNode *pNode,
  175. IpxSSListEntry *pSSEntry,
  176. IpxSSListEntry *pSSEntryOld);
  177. public:
  178. // Structure used to pass data to callbacks - used as a way of
  179. // avoiding recomputation
  180. struct SMenuData
  181. {
  182. ULONG m_ulMenuId;
  183. SPITFSNode m_spNode;
  184. };
  185. ULONG GetSeparatorFlags(SMenuData *pData);
  186. protected:
  187. LONG_PTR m_ulConnId;
  188. SPIInterfaceInfo m_spInterfaceInfo;
  189. };
  190. //----------------------------------------------------------------------------
  191. // Class: CStaticServiceDlg
  192. //
  193. // Controls the 'Add/Edit Static Route' dialog.
  194. //----------------------------------------------------------------------------
  195. // Set if we are modifying an exising entry (the only change this does
  196. // is that we will fill in the controls with the data in the structure).
  197. #define SR_DLG_MODIFY 0x00000001
  198. class CStaticServiceDlg : public CBaseDialog
  199. {
  200. public:
  201. CStaticServiceDlg(IpxSSListEntry * pSSEntry,
  202. DWORD dwFlags,
  203. IRouterInfo * pRouter,
  204. CWnd* pParent = NULL );
  205. //{{AFX_DATA(CStaticServiceDlg)
  206. CComboBox m_cbInterfaces;
  207. CSpinButtonCtrl m_spinHopCount;
  208. //}}AFX_DATA
  209. //{{AFX_VIRTUAL(CStaticServiceDlg)
  210. protected:
  211. virtual void DoDataExchange(CDataExchange* pDX);
  212. //}}AFX_VIRTUAL
  213. protected:
  214. static DWORD m_dwHelpMap[];
  215. CStringList m_ifidList;
  216. DWORD m_dwFlags;
  217. SPIRouterInfo m_spRouterInfo;
  218. IpxSSListEntry *m_pSSEntry;
  219. //{{AFX_MSG(CStaticServiceDlg)
  220. virtual void OnOK();
  221. virtual BOOL OnInitDialog();
  222. //}}AFX_MSG
  223. DECLARE_MESSAGE_MAP()
  224. };
  225. HRESULT SetServiceData(BaseIPXResultNodeData *pData,
  226. IpxSSListEntry *pService);
  227. HRESULT AddStaticService(IpxSSListEntry *pSSEntry,
  228. IInfoBase *InfoBase,
  229. InfoBlock *pBlock);
  230. BOOL FAreTwoServicesEqual(IPX_STATIC_SERVICE_INFO *pService1,
  231. IPX_STATIC_SERVICE_INFO *pService2);
  232. #endif _SSVIEW_H