296 lines
7.8 KiB
C
296 lines
7.8 KiB
C
|
//============================================================================
|
||
|
// Copyright (C) Microsoft Corporation, 1997 - 1999
|
||
|
//
|
||
|
// File: snview.h
|
||
|
//
|
||
|
// History:
|
||
|
// 09/05/97 Kenn M. Takara Created.
|
||
|
//
|
||
|
// IPX Static Names view
|
||
|
//
|
||
|
//============================================================================
|
||
|
|
||
|
|
||
|
#ifndef _SNVIEW_H
|
||
|
#define _SNVIEW_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
|
||
|
#include "IpxStaticnbname.h"
|
||
|
|
||
|
// forward declarations
|
||
|
class IPXAdminConfigStream;
|
||
|
struct SIpxSNNodeMenu;
|
||
|
|
||
|
/*---------------------------------------------------------------------------
|
||
|
This is the list of columns available for the IPX Static Names
|
||
|
node.
|
||
|
- Name, "[1] DEC DE500 ..."
|
||
|
- NetBIOS Name, "stuff"
|
||
|
- NetBIOS Name Type, "fe11"
|
||
|
---------------------------------------------------------------------------*/
|
||
|
|
||
|
|
||
|
//
|
||
|
// If you ADD any columns to this enum, Be sure to update
|
||
|
// the string ids for the column headers in snview.cpp
|
||
|
//
|
||
|
enum
|
||
|
{
|
||
|
IPX_SN_SI_NAME = 0,
|
||
|
IPX_SN_SI_NETBIOS_NAME,
|
||
|
IPX_SN_SI_NETBIOS_TYPE,
|
||
|
IPX_SN_MAX_COLUMNS,
|
||
|
};
|
||
|
|
||
|
|
||
|
/*---------------------------------------------------------------------------
|
||
|
We store a pointer to the IPConnection object in our node data
|
||
|
---------------------------------------------------------------------------*/
|
||
|
|
||
|
#define GET_IPX_SN_NODEDATA(pNode) \
|
||
|
(IPXConnection *) pNode->GetData(TFS_DATA_USER)
|
||
|
#define SET_IPX_SN_NODEDATA(pNode, pData) \
|
||
|
pNode->SetData(TFS_DATA_USER, (LONG_PTR) pData)
|
||
|
|
||
|
|
||
|
|
||
|
/*---------------------------------------------------------------------------
|
||
|
Struct: IpxSNListEntry
|
||
|
|
||
|
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 IpxSNListEntry
|
||
|
{
|
||
|
SPIInterfaceInfo m_spIf;
|
||
|
IPX_STATIC_NETBIOS_NAME_INFO m_name;
|
||
|
|
||
|
void LoadFrom(BaseIPXResultNodeData *pNodeData);
|
||
|
void SaveTo(BaseIPXResultNodeData *pNodeData);
|
||
|
};
|
||
|
|
||
|
typedef CList<IpxSNListEntry *, IpxSNListEntry *> IpxSNList;
|
||
|
|
||
|
|
||
|
/*---------------------------------------------------------------------------
|
||
|
Class: IpxSNHandler
|
||
|
---------------------------------------------------------------------------*/
|
||
|
|
||
|
|
||
|
class IpxSNHandler :
|
||
|
public BaseContainerHandler
|
||
|
{
|
||
|
public:
|
||
|
IpxSNHandler(ITFSComponentData *pTFSCompData);
|
||
|
~IpxSNHandler();
|
||
|
|
||
|
// 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 GenerateListOfNames(ITFSNode *pNode, IpxSNList *pSNList);
|
||
|
|
||
|
|
||
|
// Helper function to add interfaces to the UI
|
||
|
HRESULT AddStaticNetBIOSNameNode(ITFSNode *pParent, IpxSNListEntry *pName);
|
||
|
|
||
|
// Command implementations
|
||
|
HRESULT OnNewName(ITFSNode *pNode);
|
||
|
|
||
|
LONG_PTR m_ulConnId; // notification id for namer 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: IpxStaticNetBIOSNameHandler
|
||
|
|
||
|
This is the handler for the interface nodes that appear in the IPStaticNetBIOSNames
|
||
|
node.
|
||
|
---------------------------------------------------------------------------*/
|
||
|
|
||
|
class IpxStaticNetBIOSNameHandler : public BaseIPXResultHandler
|
||
|
{
|
||
|
public:
|
||
|
IpxStaticNetBIOSNameHandler(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 Names
|
||
|
HRESULT ParentRefresh(ITFSNode *pNode);
|
||
|
|
||
|
// Removes the static name
|
||
|
HRESULT OnRemoveStaticNetBIOSName(ITFSNode *pNode);
|
||
|
|
||
|
// Name modification apis
|
||
|
HRESULT RemoveStaticNetBIOSName(IpxSNListEntry *pSNEntry, IInfoBase *pInfo);
|
||
|
HRESULT ModifyNameInfo(ITFSNode *pNode,
|
||
|
IpxSNListEntry *pSNEntry,
|
||
|
IpxSNListEntry *pSNEntryOld);
|
||
|
|
||
|
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: CStaticNetBIOSNameDlg
|
||
|
//
|
||
|
// Controls the 'Add/Edit Static Name' 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 CStaticNetBIOSNameDlg : public CBaseDialog
|
||
|
{
|
||
|
public:
|
||
|
|
||
|
CStaticNetBIOSNameDlg(IpxSNListEntry * pSNEntry,
|
||
|
DWORD dwFlags,
|
||
|
IRouterInfo * pRouter,
|
||
|
CWnd* pParent = NULL );
|
||
|
|
||
|
//{{AFX_DATA(CStaticNetBIOSNameDlg)
|
||
|
CComboBox m_cbInterfaces;
|
||
|
//}}AFX_DATA
|
||
|
|
||
|
|
||
|
//{{AFX_VIRTUAL(CStaticNetBIOSNameDlg)
|
||
|
protected:
|
||
|
virtual void DoDataExchange(CDataExchange* pDX);
|
||
|
//}}AFX_VIRTUAL
|
||
|
|
||
|
protected:
|
||
|
static DWORD m_dwHelpMap[];
|
||
|
|
||
|
CStringList m_ifidList;
|
||
|
|
||
|
DWORD m_dwFlags;
|
||
|
SPIRouterInfo m_spRouterInfo;
|
||
|
IpxSNListEntry *m_pSNEntry;
|
||
|
|
||
|
//{{AFX_MSG(CStaticNetBIOSNameDlg)
|
||
|
virtual void OnOK();
|
||
|
virtual BOOL OnInitDialog();
|
||
|
//}}AFX_MSG
|
||
|
|
||
|
DECLARE_MESSAGE_MAP()
|
||
|
};
|
||
|
|
||
|
BOOL FAreTwoNamesEqual(IPX_STATIC_NETBIOS_NAME_INFO *pName1,
|
||
|
IPX_STATIC_NETBIOS_NAME_INFO *pName2);
|
||
|
#endif _SNVIEW_H
|