windows-nt/Source/XPSP1/NT/net/mmc/ipxsnap/ssview.h
2020-09-26 16:20:57 +08:00

307 lines
8 KiB
C++

//============================================================================
// Copyright (C) Microsoft Corporation, 1997 - 1999
//
// File: ssview.h
//
// History:
// 09/05/97 Kenn M. Takara Created.
//
// IPX Static Routes view
//
//============================================================================
#ifndef _SSVIEW_H
#define _SSVIEW_H
#ifndef _BASEHAND_H
#include "basehand.h"
#endif
#ifndef _HANDLERS_H
#include "handlers.h"
#endif
#ifndef _XSTREAM_H
#include "xstream.h" // need for ColumnData
#endif
#ifndef _INFO_H
#include "info.h"
#endif
#ifndef _IPXFACE_H
#include "ipxface.h"
#endif
#ifndef _BASECON_H
#include "basecon.h" // BaseContainerHandler
#endif
#ifndef _IPXSTRM_H
#include "ipxstrm.h"
#endif
#ifndef _RTRSHEET_H
#include "rtrsheet.h"
#endif
#ifndef _IPXCONN_H
#include "ipxconn.h" // IPXConnection
#endif
#include "ipxstats.h" // IPX statistics dialogs
// forward declarations
class IPXAdminConfigStream;
struct SIpxSSNodeMenu;
/*---------------------------------------------------------------------------
This is the list of columns available for the IPX Static Routes
node.
- Name, "[1] DEC DE500 ..."
- Service Type, 1231
- Service Name, "foobar"
- Service Address, "111.111.11"
- Hop Count
---------------------------------------------------------------------------*/
//
// If you ADD any columns to this enum, Be sure to update
// the string ids for the column headers in ssview.cpp
//
enum
{
IPX_SS_SI_NAME = 0,
IPX_SS_SI_SERVICE_TYPE,
IPX_SS_SI_SERVICE_NAME,
IPX_SS_SI_SERVICE_ADDRESS,
IPX_SS_SI_HOP_COUNT,
IPX_SS_MAX_COLUMNS,
};
/*---------------------------------------------------------------------------
We store a pointer to the IPConnection object in our node data
---------------------------------------------------------------------------*/
#define GET_IPX_SS_NODEDATA(pNode) \
(IPXConnection *) pNode->GetData(TFS_DATA_USER)
#define SET_IPX_SS_NODEDATA(pNode, pData) \
pNode->SetData(TFS_DATA_USER, (LONG_PTR) pData)
/*---------------------------------------------------------------------------
Struct: IpxSSListEntry
This is an intermediate data structure. Our data-gathering routines
will generate a list of these data items. We will then use this list
to populate result pane. This will (eventually) be generated by the
Refresh mechanism. This separation of data gathering and UI code will
allow us to easily move the data gathering to a background thread.
---------------------------------------------------------------------------*/
struct IpxSSListEntry
{
SPIInterfaceInfo m_spIf;
IPX_STATIC_SERVICE_INFO m_service;
void LoadFrom(BaseIPXResultNodeData *pNodeData);
void SaveTo(BaseIPXResultNodeData *pNodeData);
};
typedef CList<IpxSSListEntry *, IpxSSListEntry *> IpxSSList;
/*---------------------------------------------------------------------------
Class: IpxSSHandler
---------------------------------------------------------------------------*/
class IpxSSHandler :
public BaseContainerHandler
{
public:
IpxSSHandler(ITFSComponentData *pTFSCompData);
~IpxSSHandler();
// Override QI to handle embedded interface
STDMETHOD(QueryInterface)(REFIID iid, LPVOID *ppv);
DeclareEmbeddedInterface(IRtrAdviseSink, IUnknown)
// base handler functionality we override
OVERRIDE_NodeHandler_HasPropertyPages();
OVERRIDE_NodeHandler_GetString();
OVERRIDE_NodeHandler_OnCreateDataObject();
OVERRIDE_NodeHandler_OnAddMenuItems();
OVERRIDE_NodeHandler_OnCommand();
OVERRIDE_NodeHandler_DestroyHandler();
OVERRIDE_BaseHandlerNotify_OnExpand();
OVERRIDE_ResultHandler_AddMenuItems();
OVERRIDE_ResultHandler_Command();
OVERRIDE_ResultHandler_CompareItems();
OVERRIDE_BaseResultHandlerNotify_OnResultShow();
OVERRIDE_BaseResultHandlerNotify_OnResultRefresh();
// Initializes the handler
HRESULT Init(IRtrMgrInfo *pRtrMgrInfo, IPXAdminConfigStream *pConfigStream);
// Initializes the node
HRESULT ConstructNode(ITFSNode *pNode, LPCTSTR szName,
IPXConnection *pIPXConn);
public:
// Structure used to pass data to callbacks - used as a way of
// avoiding recomputation
struct SMenuData
{
SPITFSNode m_spNode;
};
// Function callbacks for menu enabling/disabling
protected:
// Refresh the data for these nodes
HRESULT SynchronizeNodeData(ITFSNode *pThisNode);
HRESULT MarkAllNodes(ITFSNode *pNode, ITFSNodeEnum *pEnum);
HRESULT RemoveAllUnmarkedNodes(ITFSNode *pNode, ITFSNodeEnum *pEnum);
HRESULT GenerateListOfServices(ITFSNode *pNode, IpxSSList *pSSList);
// Helper function to add interfaces to the UI
HRESULT AddStaticServiceNode(ITFSNode *pParent, IpxSSListEntry *pRoute);
// Command implementations
HRESULT OnNewService(ITFSNode *pNode);
LONG_PTR m_ulConnId; // notification id for router info
LONG_PTR m_ulRefreshConnId; // notification id for router refresh
MMC_COOKIE m_cookie; // cookie for the node
SPIRtrMgrInfo m_spRtrMgrInfo;
IPXAdminConfigStream * m_pConfigStream;
CString m_stTitle;
};
/*---------------------------------------------------------------------------
Class: IpxServiceHandler
This is the handler for the interface nodes that appear in the IPStaticServices
node.
---------------------------------------------------------------------------*/
class IpxServiceHandler : public BaseIPXResultHandler
{
public:
IpxServiceHandler(ITFSComponentData *pCompData);
OVERRIDE_NodeHandler_HasPropertyPages();
OVERRIDE_NodeHandler_CreatePropertyPages();
OVERRIDE_NodeHandler_OnCreateDataObject();
OVERRIDE_ResultHandler_AddMenuItems();
OVERRIDE_ResultHandler_Command();
OVERRIDE_ResultHandler_OnCreateDataObject();
OVERRIDE_ResultHandler_DestroyResultHandler();
OVERRIDE_ResultHandler_HasPropertyPages();
OVERRIDE_ResultHandler_CreatePropertyPages();
OVERRIDE_BaseResultHandlerNotify_OnResultDelete();
// Initializes the node
HRESULT ConstructNode(ITFSNode *pNode, IInterfaceInfo *pIfInfo,
IPXConnection *pIPXConn);
HRESULT Init(IInterfaceInfo *pInfo, ITFSNode *pParent);
// Refreshes all routes
HRESULT ParentRefresh(ITFSNode *pNode);
// Removes the static route
HRESULT OnRemoveStaticService(ITFSNode *pNode);
// Route modification apis
HRESULT RemoveStaticService(IpxSSListEntry *pSSEntry, IInfoBase *pInfo);
HRESULT ModifyRouteInfo(ITFSNode *pNode,
IpxSSListEntry *pSSEntry,
IpxSSListEntry *pSSEntryOld);
public:
// Structure used to pass data to callbacks - used as a way of
// avoiding recomputation
struct SMenuData
{
ULONG m_ulMenuId;
SPITFSNode m_spNode;
};
ULONG GetSeparatorFlags(SMenuData *pData);
protected:
LONG_PTR m_ulConnId;
SPIInterfaceInfo m_spInterfaceInfo;
};
//----------------------------------------------------------------------------
// Class: CStaticServiceDlg
//
// Controls the 'Add/Edit Static Route' dialog.
//----------------------------------------------------------------------------
// Set if we are modifying an exising entry (the only change this does
// is that we will fill in the controls with the data in the structure).
#define SR_DLG_MODIFY 0x00000001
class CStaticServiceDlg : public CBaseDialog
{
public:
CStaticServiceDlg(IpxSSListEntry * pSSEntry,
DWORD dwFlags,
IRouterInfo * pRouter,
CWnd* pParent = NULL );
//{{AFX_DATA(CStaticServiceDlg)
CComboBox m_cbInterfaces;
CSpinButtonCtrl m_spinHopCount;
//}}AFX_DATA
//{{AFX_VIRTUAL(CStaticServiceDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX);
//}}AFX_VIRTUAL
protected:
static DWORD m_dwHelpMap[];
CStringList m_ifidList;
DWORD m_dwFlags;
SPIRouterInfo m_spRouterInfo;
IpxSSListEntry *m_pSSEntry;
//{{AFX_MSG(CStaticServiceDlg)
virtual void OnOK();
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
HRESULT SetServiceData(BaseIPXResultNodeData *pData,
IpxSSListEntry *pService);
HRESULT AddStaticService(IpxSSListEntry *pSSEntry,
IInfoBase *InfoBase,
InfoBlock *pBlock);
BOOL FAreTwoServicesEqual(IPX_STATIC_SERVICE_INFO *pService1,
IPX_STATIC_SERVICE_INFO *pService2);
#endif _SSVIEW_H