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.

194 lines
5.5 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997 - 1999 **/
  4. /**********************************************************************/
  5. /*
  6. iface.h
  7. Interface administration
  8. FILE HISTORY:
  9. */
  10. #ifndef _IFACE_H
  11. #define _IFACE_H
  12. #ifndef _BASEHAND_H
  13. #include "basehand.h"
  14. #endif
  15. #ifndef _HANDLERS_H
  16. #include "handlers.h"
  17. #endif
  18. #ifndef _BASERTR_H
  19. #include "basertr.h"
  20. #endif
  21. // Forward declarations
  22. struct IfAdminNodeData;
  23. struct _BaseInterfaceData
  24. {
  25. ULONG_PTR m_ulData; // use for additional pointers/handles
  26. DWORD m_dwData;
  27. CString m_stData;
  28. };
  29. #define INTERFACE_MAX_COLUMNS 16
  30. struct InterfaceNodeData
  31. {
  32. InterfaceNodeData();
  33. ~InterfaceNodeData();
  34. #ifdef DEBUG
  35. char m_szDebug[32];
  36. #endif
  37. // We will have an array of CStrings, one for each subitem column
  38. _BaseInterfaceData m_rgData[INTERFACE_MAX_COLUMNS];
  39. DWORD dwUnReachabilityReason;
  40. DWORD dwConnectionState;
  41. BOOL fIsRunning;
  42. DWORD dwLastError;
  43. SPIInterfaceInfo spIf;
  44. DWORD dwMark;
  45. LRESULT lParamPrivate;
  46. static HRESULT Init(ITFSNode *pNode, IInterfaceInfo *pIf);
  47. static HRESULT Free(ITFSNode *pNode);
  48. };
  49. #define GET_INTERFACENODEDATA(pNode) \
  50. ((InterfaceNodeData *) pNode->GetData(TFS_DATA_USER))
  51. #define SET_INTERFACENODEDATA(pNode, pData) \
  52. pNode->SetData(TFS_DATA_USER, (LONG_PTR) pData)
  53. /*---------------------------------------------------------------------------
  54. Class: InterfaceNodeHandler
  55. ---------------------------------------------------------------------------*/
  56. class InterfaceNodeHandler :
  57. public BaseRouterHandler
  58. {
  59. public:
  60. InterfaceNodeHandler(ITFSComponentData *pCompData);
  61. ~InterfaceNodeHandler()
  62. { DEBUG_DECREMENT_INSTANCE_COUNTER(InterfaceNodeHandler); }
  63. HRESULT Init(IInterfaceInfo *pInfo, ITFSNode *pParent);
  64. // Override QI to handle embedded interface
  65. DeclareIUnknownMembers(IMPL)
  66. // STDMETHOD(QueryInterface)(REFIID iid, LPVOID *ppv);
  67. OVERRIDE_ResultHandler_GetString();
  68. OVERRIDE_ResultHandler_CreatePropertyPages();
  69. OVERRIDE_ResultHandler_HasPropertyPages();
  70. OVERRIDE_ResultHandler_CompareItems();
  71. OVERRIDE_ResultHandler_AddMenuItems();
  72. OVERRIDE_ResultHandler_Command();
  73. OVERRIDE_ResultHandler_OnCreateDataObject();
  74. OVERRIDE_ResultHandler_DestroyResultHandler();
  75. // Override the various notifications
  76. OVERRIDE_BaseResultHandlerNotify_OnResultDelete();
  77. // The various commands that this node implements
  78. // HRESULT OnRemoveInterface();
  79. // add new parameter to allow the function retrive information of interface data -- bug 166461
  80. HRESULT OnRemoveInterface(MMC_COOKIE cookie);
  81. HRESULT OnUnreachabilityReason(MMC_COOKIE cookie);
  82. HRESULT OnEnableDisable(MMC_COOKIE cookie, int nCommandID);
  83. HRESULT OnConnectDisconnect(MMC_COOKIE cookie, int nCommandID);
  84. HRESULT OnSetCredentials();
  85. HRESULT OnDemandDialFilters(MMC_COOKIE cookie);
  86. HRESULT OnDialinHours(ITFSComponent *pComponent, MMC_COOKIE cookie);
  87. // if the service is not running, return S_FALSE,
  88. // otherwise, using MprAdminInterfaceSetInfo to notify the service of dialin hours changes
  89. HRESULT LoadDialOutHours(CStringList& strList);
  90. HRESULT SaveDialOutHours(CStringList& strList);
  91. // Initializes the node
  92. HRESULT ConstructNode(ITFSNode *pNode, IInterfaceInfo *pIfInfo);
  93. // Refresh the data for this node
  94. void RefreshInterface(MMC_COOKIE cookie);
  95. public:
  96. // Structure used to pass data to callbacks - used as a way of
  97. // avoiding recomputation
  98. struct SMenuData
  99. {
  100. SPITFSNode m_spNode;
  101. BOOL m_fRouterIsRunning;
  102. };
  103. // Function callbacks for menu enabling/disabling
  104. static ULONG GetRemoveIfMenuFlags(const SRouterNodeMenu *pData, INT_PTR pUser);
  105. static ULONG GetEnableMenuFlags(const SRouterNodeMenu *pData, INT_PTR pUser);
  106. static ULONG GetConnectMenuFlags(const SRouterNodeMenu *pData, INT_PTR pUser);
  107. static ULONG GetUnreachMenuFlags(const SRouterNodeMenu *pData, INT_PTR pUser);
  108. static ULONG GetDDFiltersFlag(const SRouterNodeMenu *pData, INT_PTR pUser);
  109. protected:
  110. SPIInterfaceInfo m_spInterfaceInfo;
  111. CString m_stTitle; // holds the title of the node
  112. LONG_PTR m_ulConnId;
  113. // It is assumed that this will be valid for the lifetime of this node!
  114. IfAdminNodeData * m_pIfAdminData;
  115. DeclareEmbeddedInterface(IRtrAdviseSink, IUnknown)
  116. };
  117. /*---------------------------------------------------------------------------
  118. Class: BaseResultHandler
  119. This is a base class to be used by the interface result items. It
  120. will contain some of the core code needed for basic things (like
  121. display of data). It will not do the specifics (like menus/properties).
  122. ---------------------------------------------------------------------------*/
  123. class BaseResultHandler :
  124. public BaseRouterHandler
  125. {
  126. public:
  127. BaseResultHandler(ITFSComponentData *pCompData, ULONG ulId)
  128. : BaseRouterHandler(pCompData), m_ulColumnId(ulId)
  129. { DEBUG_INCREMENT_INSTANCE_COUNTER(BaseResultHandler); };
  130. ~BaseResultHandler()
  131. { DEBUG_DECREMENT_INSTANCE_COUNTER(BaseResultHandler); }
  132. DeclareIUnknownMembers(IMPL)
  133. OVERRIDE_ResultHandler_GetString();
  134. OVERRIDE_ResultHandler_CompareItems();
  135. OVERRIDE_ResultHandler_DestroyResultHandler();
  136. HRESULT Init(IInterfaceInfo *pInfo, ITFSNode *pParent);
  137. protected:
  138. CString m_stTitle; // holds the title of the node
  139. //
  140. // This is the id of the column set to use. This is used when we
  141. // interact with the ComponentConfigStream.
  142. //
  143. ULONG m_ulColumnId;
  144. DeclareEmbeddedInterface(IRtrAdviseSink, IUnknown)
  145. };
  146. #endif _IFACE_H