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.

242 lines
6.3 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997 - 1998 **/
  4. /**********************************************************************/
  5. /*
  6. ifadmin.h
  7. Interface administration
  8. FILE HISTORY:
  9. */
  10. #ifndef _IFADMIN_H
  11. #define _IFADMIN_H
  12. #ifndef _BASEHAND_H
  13. #include "basehand.h"
  14. #endif
  15. #ifndef _HANDLERS_H_
  16. #include "handlers.h"
  17. #endif
  18. #ifndef _ROUTER_H
  19. #include "router.h"
  20. #endif
  21. #ifndef _INFO_H
  22. #include "info.h"
  23. #endif
  24. #ifndef _BASECON_H
  25. #include "basecon.h"
  26. #endif
  27. #ifndef _DIALOG_H_
  28. #include "dialog.h"
  29. #endif
  30. #ifndef __IPCTRL_H
  31. #include "ipctrl.h"
  32. #endif
  33. #include "rasdlg.h"
  34. #define MPR_INTERFACE_NOT_LOADED 0x00010000
  35. // forward declarations
  36. class RouterAdminConfigStream;
  37. interface IRouterInfo;
  38. struct ColumnData;
  39. /*---------------------------------------------------------------------------
  40. Things needed for the Add Interface command
  41. ---------------------------------------------------------------------------*/
  42. typedef DWORD (APIENTRY * PROUTERENTRYDLG) (LPTSTR, LPTSTR, LPTSTR, LPRASENTRYDLG);
  43. /*---------------------------------------------------------------------------
  44. Struct: IfAdminNodeData
  45. This is information related to the set of interfaces (not per-interface),
  46. this is intended for SHARED data.
  47. Put data in here that needs to be accessed by the child nodes. All other
  48. private data should go in the handler.
  49. ---------------------------------------------------------------------------*/
  50. struct IfAdminNodeData
  51. {
  52. IfAdminNodeData();
  53. ~IfAdminNodeData();
  54. #ifdef DEBUG
  55. char m_szDebug[32]; // for iding structures
  56. #endif
  57. // The following pieces of data are needed for adding/configuring
  58. // an interface. This is a COPY of the data kept in the IfAdminNodeHandler,
  59. // do NOT free these up!
  60. HINSTANCE m_hInstRasDlg;
  61. PROUTERENTRYDLG m_pfnRouterEntryDlg;
  62. static HRESULT InitAdminNodeData(ITFSNode *pNode, RouterAdminConfigStream *pConfigStream);
  63. static HRESULT FreeAdminNodeData(ITFSNode *pNode);
  64. };
  65. #define GET_IFADMINNODEDATA(pNode) \
  66. ((IfAdminNodeData *) pNode->GetData(TFS_DATA_USER))
  67. #define SET_IFADMINNODEDATA(pNode, pData) \
  68. pNode->SetData(TFS_DATA_USER, (LONG_PTR) pData)
  69. /*---------------------------------------------------------------------------
  70. This is the list of columns available for the Interfaces node
  71. - Title, "[1] DEC DE500 Fast Ethernet PCI Adapter" or friendly name
  72. - Device Name, see above
  73. - Type, "Dedicated"
  74. - Status, "Enabled"
  75. - Connection State, "Connected"
  76. ---------------------------------------------------------------------------*/
  77. enum
  78. {
  79. IFADMIN_SUBITEM_TITLE = 0,
  80. IFADMIN_SUBITEM_TYPE = 1,
  81. IFADMIN_SUBITEM_STATUS = 2,
  82. IFADMIN_SUBITEM_CONNECTION_STATE = 3,
  83. IFADMIN_SUBITEM_DEVICE_NAME = 4,
  84. IFADMIN_MAX_COLUMNS = 5,
  85. };
  86. /*---------------------------------------------------------------------------
  87. Class: IfAdminNodeHandler
  88. ---------------------------------------------------------------------------*/
  89. class IfAdminNodeHandler :
  90. public BaseContainerHandler
  91. {
  92. public:
  93. IfAdminNodeHandler(ITFSComponentData *pCompData);
  94. HRESULT Init(IRouterInfo *pInfo, RouterAdminConfigStream *pConfigStream);
  95. // Override QI to handle embedded interface
  96. STDMETHOD(QueryInterface)(REFIID iid, LPVOID *ppv);
  97. DeclareEmbeddedInterface(IRtrAdviseSink, IUnknown)
  98. // base handler functionality we override
  99. OVERRIDE_NodeHandler_DestroyHandler();
  100. OVERRIDE_NodeHandler_GetString();
  101. OVERRIDE_NodeHandler_HasPropertyPages();
  102. OVERRIDE_NodeHandler_OnAddMenuItems();
  103. OVERRIDE_NodeHandler_OnCommand();
  104. OVERRIDE_NodeHandler_OnCreateDataObject();
  105. OVERRIDE_ResultHandler_CompareItems();
  106. OVERRIDE_ResultHandler_AddMenuItems();
  107. OVERRIDE_ResultHandler_Command();
  108. // override handler notifications
  109. OVERRIDE_BaseHandlerNotify_OnExpand();
  110. OVERRIDE_BaseResultHandlerNotify_OnResultShow();
  111. // Initializes the node
  112. HRESULT ConstructNode(ITFSNode *pNode);
  113. // User-initiated commands
  114. HRESULT OnAddInterface();
  115. HRESULT OnNewTunnel();
  116. HRESULT OnUseDemandDialWizard();
  117. // Helper function to add interfaces to the UI
  118. HRESULT AddInterfaceNode(ITFSNode *pParent, IInterfaceInfo *pIf);
  119. // Causes a sync action (synchronizes data not the structure)
  120. HRESULT SynchronizeNodeData(ITFSNode *pNode);
  121. static HRESULT GetPhoneBookPath(LPCTSTR pszMachine, CString* pstPath);
  122. protected:
  123. SPIDataObject m_spDataObject; // cachecd data object
  124. CString m_stTitle; // holds the title of the node
  125. LONG_PTR m_ulConnId; // notification id for router info
  126. LONG_PTR m_ulRefreshConnId; // id for refresh notifications
  127. BOOL m_bExpanded; // is the node expanded?
  128. MMC_COOKIE m_cookie; // cookie for the node
  129. // Necessary for adding interfaces
  130. // Keep these in sync with the values in the IfAdminNodeData!
  131. HINSTANCE m_hInstRasDlg;
  132. PROUTERENTRYDLG m_pfnRouterEntryDlg;
  133. BOOL EnableAddInterface();
  134. // Helper function to add an interface to a router-manager
  135. HRESULT AddRouterManagerToInterface(IInterfaceInfo *pIf,
  136. IRouterInfo *pRouter,
  137. DWORD dwTransportId);
  138. // returns TRUE if there is at least one routing-enabled port
  139. // on the router.
  140. BOOL FLookForRoutingEnabledPorts(LPCTSTR pszMachineName);
  141. RouterAdminConfigStream * m_pConfigStream;
  142. };
  143. HRESULT GetDemandDialWizardRegKey(LPCTSTR szMachine, DWORD *pfWizard);
  144. HRESULT SetDemandDialWizardRegKey(LPCTSTR szMachine, DWORD fEnableWizard);
  145. /*---------------------------------------------------------------------------
  146. Class : TunnelDialog
  147. ---------------------------------------------------------------------------*/
  148. class TunnelDialog : public CBaseDialog
  149. {
  150. public:
  151. TunnelDialog();
  152. ~TunnelDialog();
  153. // Dialog Data
  154. //{{AFX_DATA(TunnelDialog)
  155. enum { IDD = IDD_TUNNEL };
  156. // IPControl m_ipLocal;
  157. // IPControl m_ipRemote;
  158. // CSpinButtonCtrl m_spinTTL;
  159. //}}AFX_DATA
  160. // DWORD m_dwLocal;
  161. // DWORD m_dwRemote;
  162. // BYTE m_byteTTL;
  163. CString m_stName;
  164. // Overrides
  165. // ClassWizard generate virtual function overrides
  166. //{{AFX_VIRTUAL(TunnelDialog)
  167. public:
  168. virtual void OnOK();
  169. protected:
  170. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  171. //}}AFX_VIRTUAL
  172. // Implementation
  173. protected:
  174. // Generated message map functions
  175. //{{AFX_MSG(TunnelDialog)
  176. virtual BOOL OnInitDialog();
  177. //}}AFX_MSG
  178. DECLARE_MESSAGE_MAP()
  179. private:
  180. };
  181. #endif _IFADMIN_H