307 lines
8.0 KiB
C
307 lines
8.0 KiB
C
|
//============================================================================
|
||
|
// Copyright (C) Microsoft Corporation, 1997 - 1999
|
||
|
//
|
||
|
// File: srview.h
|
||
|
//
|
||
|
// History:
|
||
|
// 09/05/97 Kenn M. Takara Created.
|
||
|
//
|
||
|
// IPX Static Routes view
|
||
|
//
|
||
|
//============================================================================
|
||
|
|
||
|
|
||
|
#ifndef _SRVIEW_H
|
||
|
#define _SRVIEW_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 SIpxSRNodeMenu;
|
||
|
|
||
|
/*---------------------------------------------------------------------------
|
||
|
This is the list of columns available for the IPX Static Routes
|
||
|
node.
|
||
|
- Interface, "[1] DEC DE500 ..."
|
||
|
- Network number
|
||
|
- Next Hop MAC address
|
||
|
- Tick Count
|
||
|
- Hop Count
|
||
|
---------------------------------------------------------------------------*/
|
||
|
|
||
|
|
||
|
//
|
||
|
// If you ADD any columns to this enum, Be sure to update
|
||
|
// the string ids for the column headers in srview.cpp
|
||
|
//
|
||
|
enum
|
||
|
{
|
||
|
IPX_SR_SI_NAME = 0,
|
||
|
IPX_SR_SI_NETWORK,
|
||
|
IPX_SR_SI_NEXT_HOP,
|
||
|
IPX_SR_SI_TICK_COUNT,
|
||
|
IPX_SR_SI_HOP_COUNT,
|
||
|
IPX_SR_MAX_COLUMNS,
|
||
|
};
|
||
|
|
||
|
|
||
|
/*---------------------------------------------------------------------------
|
||
|
We store a pointer to the IPConnection object in our node data
|
||
|
---------------------------------------------------------------------------*/
|
||
|
|
||
|
#define GET_IPX_SR_NODEDATA(pNode) \
|
||
|
(IPXConnection *) pNode->GetData(TFS_DATA_USER)
|
||
|
#define SET_IPX_SR_NODEDATA(pNode, pData) \
|
||
|
pNode->SetData(TFS_DATA_USER, (LONG_PTR) pData)
|
||
|
|
||
|
|
||
|
|
||
|
/*---------------------------------------------------------------------------
|
||
|
Struct: IpxSRListEntry
|
||
|
|
||
|
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 IpxSRListEntry
|
||
|
{
|
||
|
SPIInterfaceInfo m_spIf;
|
||
|
IPX_STATIC_ROUTE_INFO m_route;
|
||
|
|
||
|
void LoadFrom(BaseIPXResultNodeData *pNodeData);
|
||
|
void SaveTo(BaseIPXResultNodeData *pNodeData);
|
||
|
};
|
||
|
|
||
|
typedef CList<IpxSRListEntry *, IpxSRListEntry *> IpxSRList;
|
||
|
|
||
|
|
||
|
/*---------------------------------------------------------------------------
|
||
|
Class: IpxSRHandler
|
||
|
---------------------------------------------------------------------------*/
|
||
|
|
||
|
|
||
|
class IpxSRHandler :
|
||
|
public BaseContainerHandler
|
||
|
{
|
||
|
public:
|
||
|
IpxSRHandler(ITFSComponentData *pTFSCompData);
|
||
|
~IpxSRHandler();
|
||
|
|
||
|
// 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 GenerateListOfRoutes(ITFSNode *pNode, IpxSRList *pSRList);
|
||
|
|
||
|
|
||
|
// Helper function to add interfaces to the UI
|
||
|
HRESULT AddStaticRouteNode(ITFSNode *pParent, IpxSRListEntry *pRoute);
|
||
|
|
||
|
// Command implementations
|
||
|
HRESULT OnNewRoute(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;
|
||
|
SPIRouterInfo m_spRouterInfo;
|
||
|
IPXAdminConfigStream * m_pConfigStream;
|
||
|
CString m_stTitle;
|
||
|
|
||
|
};
|
||
|
|
||
|
|
||
|
/*---------------------------------------------------------------------------
|
||
|
Class: IpxRouteHandler
|
||
|
|
||
|
This is the handler for the interface nodes that appear in the IPStaticRoutes
|
||
|
node.
|
||
|
---------------------------------------------------------------------------*/
|
||
|
|
||
|
class IpxRouteHandler : public BaseIPXResultHandler
|
||
|
{
|
||
|
public:
|
||
|
IpxRouteHandler(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 OnRemoveStaticRoute(ITFSNode *pNode);
|
||
|
|
||
|
// Route modification apis
|
||
|
HRESULT RemoveStaticRoute(IpxSRListEntry *pSREntry, IInfoBase *pInfo);
|
||
|
HRESULT ModifyRouteInfo(ITFSNode *pNode,
|
||
|
IpxSRListEntry *pSREntry,
|
||
|
IpxSRListEntry *pSREntryOld);
|
||
|
|
||
|
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: CStaticRouteDlg
|
||
|
//
|
||
|
// 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 CStaticRouteDlg : public CBaseDialog
|
||
|
{
|
||
|
public:
|
||
|
|
||
|
CStaticRouteDlg(IpxSRListEntry * pSREntry,
|
||
|
DWORD dwFlags,
|
||
|
IRouterInfo * pRouter,
|
||
|
CWnd* pParent = NULL );
|
||
|
|
||
|
//{{AFX_DATA(CStaticRouteDlg)
|
||
|
CComboBox m_cbInterfaces;
|
||
|
CSpinButtonCtrl m_spinTickCount;
|
||
|
CSpinButtonCtrl m_spinHopCount;
|
||
|
//}}AFX_DATA
|
||
|
|
||
|
|
||
|
//{{AFX_VIRTUAL(CStaticRouteDlg)
|
||
|
protected:
|
||
|
virtual void DoDataExchange(CDataExchange* pDX);
|
||
|
//}}AFX_VIRTUAL
|
||
|
|
||
|
protected:
|
||
|
static DWORD m_dwHelpMap[];
|
||
|
|
||
|
CStringList m_ifidList;
|
||
|
|
||
|
DWORD m_dwFlags;
|
||
|
SPIRouterInfo m_spRouterInfo;
|
||
|
IpxSRListEntry *m_pSREntry;
|
||
|
|
||
|
//{{AFX_MSG(CStaticRouteDlg)
|
||
|
virtual void OnOK();
|
||
|
virtual BOOL OnInitDialog();
|
||
|
//}}AFX_MSG
|
||
|
|
||
|
DECLARE_MESSAGE_MAP()
|
||
|
};
|
||
|
|
||
|
HRESULT SetRouteData(BaseIPXResultNodeData *pData,
|
||
|
IpxSRListEntry *pRoute);
|
||
|
HRESULT AddStaticRoute(IpxSRListEntry *pSREntry,
|
||
|
IInfoBase *InfoBase,
|
||
|
InfoBlock *pBlock);
|
||
|
BOOL FAreTwoRoutesEqual(IPX_STATIC_ROUTE_INFO *pRoute1,
|
||
|
IPX_STATIC_ROUTE_INFO *pRoute2);
|
||
|
#endif _SRVIEW_H
|