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.

295 lines
7.8 KiB

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