Leaked source code of windows server 2003
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.

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