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.

260 lines
7.1 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997 - 1999 **/
  4. /**********************************************************************/
  5. /*
  6. dialin.h
  7. Interface administration
  8. FILE HISTORY:
  9. */
  10. #ifndef _DIALIN_H
  11. #define _DIALIN_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 _RTRUTIL_H_
  28. #include "rtrutil.h"
  29. #endif
  30. #include "rasdlg.h"
  31. #define MPR_INTERFACE_NOT_LOADED 0x00010000
  32. // forward declarations
  33. class RouterAdminConfigStream;
  34. interface IRouterInfo;
  35. struct ColumnData;
  36. struct SDialInNodeMenu;
  37. /*---------------------------------------------------------------------------
  38. Struct: DialInNodeData
  39. This is information related to the set of interfaces (not per-interface),
  40. this is intended for SHARED data.
  41. Put data in here that needs to be accessed by the child nodes. All other
  42. private data should go in the handler.
  43. ---------------------------------------------------------------------------*/
  44. struct DialInNodeData
  45. {
  46. DialInNodeData();
  47. ~DialInNodeData();
  48. #ifdef DEBUG
  49. char m_szDebug[32]; // for iding structures
  50. #endif
  51. static HRESULT InitAdminNodeData(ITFSNode *pNode, RouterAdminConfigStream *pConfigStream);
  52. static HRESULT FreeAdminNodeData(ITFSNode *pNode);
  53. HRESULT LoadHandle(LPCTSTR pszMachineName);
  54. HANDLE GetHandle();
  55. void ReleaseHandles();
  56. CString m_stMachineName;
  57. protected:
  58. SPMprServerHandle m_sphDdmHandle;
  59. };
  60. #define GET_DIALINNODEDATA(pNode) \
  61. ((DialInNodeData *) pNode->GetData(TFS_DATA_USER))
  62. #define SET_DIALINNODEDATA(pNode, pData) \
  63. pNode->SetData(TFS_DATA_USER, (LONG_PTR) pData)
  64. /*---------------------------------------------------------------------------
  65. This is the list of columns available for the Interfaces node
  66. - User name, "foo"
  67. - Duration "01:44:22"
  68. - Number of ports
  69. ---------------------------------------------------------------------------*/
  70. enum
  71. {
  72. DIALIN_SI_USERNAME = 0,
  73. DIALIN_SI_DURATION = 1,
  74. DIALIN_SI_NUMBEROFPORTS = 2,
  75. DIALIN_MAX_COLUMNS,
  76. // Entries after this are not visible to the end-user
  77. DIALIN_SI_DOMAIN = DIALIN_MAX_COLUMNS,
  78. DIALIN_SI_CONNECTION,
  79. DIALIN_SI_MAX,
  80. };
  81. /*---------------------------------------------------------------------------
  82. Struct: DialinListEntry
  83. ---------------------------------------------------------------------------*/
  84. struct DialInListEntry
  85. {
  86. RAS_CONNECTION_0 m_rc0;
  87. DWORD m_cPorts;
  88. };
  89. typedef CList<DialInListEntry, DialInListEntry &> DialInList;
  90. /*---------------------------------------------------------------------------
  91. Class: DialInNodeHandler
  92. ---------------------------------------------------------------------------*/
  93. class DialInNodeHandler :
  94. public BaseContainerHandler
  95. {
  96. public:
  97. DialInNodeHandler(ITFSComponentData *pCompData);
  98. HRESULT Init(IRouterInfo *pInfo, RouterAdminConfigStream *pConfigStream);
  99. // Override QI to handle embedded interface
  100. STDMETHOD(QueryInterface)(REFIID iid, LPVOID *ppv);
  101. DeclareEmbeddedInterface(IRtrAdviseSink, IUnknown)
  102. // base handler functionality we override
  103. OVERRIDE_NodeHandler_DestroyHandler();
  104. OVERRIDE_NodeHandler_GetString();
  105. OVERRIDE_NodeHandler_HasPropertyPages();
  106. OVERRIDE_NodeHandler_OnAddMenuItems();
  107. OVERRIDE_NodeHandler_OnCommand();
  108. OVERRIDE_NodeHandler_OnCreateDataObject();
  109. OVERRIDE_ResultHandler_CompareItems();
  110. OVERRIDE_ResultHandler_AddMenuItems();
  111. OVERRIDE_ResultHandler_Command();
  112. // override handler notifications
  113. OVERRIDE_BaseHandlerNotify_OnExpand();
  114. OVERRIDE_BaseResultHandlerNotify_OnResultShow();
  115. // Initializes the node
  116. HRESULT ConstructNode(ITFSNode *pNode);
  117. // User-initiated commands
  118. // Helper function to add interfaces to the UI
  119. HRESULT AddDialInUserNode(ITFSNode *pParent, const DialInListEntry &dialinEntry);
  120. // Causes a sync action (synchronizes data not the structure)
  121. HRESULT SynchronizeNodeData(ITFSNode *pNode);
  122. HRESULT PartialSynchronizeNodeData(ITFSNode *pNode);
  123. HRESULT UnmarkAllNodes(ITFSNode *pNode, ITFSNodeEnum *pEnum);
  124. HRESULT RemoveAllUnmarkedNodes(ITFSNode *pNode, ITFSNodeEnum *pEnum);
  125. HRESULT GenerateListOfUsers(ITFSNode *pNode, DialInList *pList, DWORD *pdwCount);
  126. HRESULT SetUserData(ITFSNode *pNode, const DialInListEntry& dialin);
  127. // Structure used to pass data to callbacks - used as a way of
  128. // avoiding recomputation
  129. struct SMenuData
  130. {
  131. SPITFSNode m_spNode;
  132. };
  133. static ULONG GetSendAllMenuFlags(const SRouterNodeMenu *pMenuData,
  134. INT_PTR pUserData);
  135. protected:
  136. SPIDataObject m_spDataObject; // cachecd data object
  137. CString m_stTitle; // holds the title of the node
  138. LONG_PTR m_ulConnId; // notification id for router info
  139. LONG_PTR m_ulRefreshConnId; // id for refresh notifications
  140. LONG_PTR m_ulPartialRefreshConnId; // id for partial refresh notifications
  141. BOOL m_bExpanded; // is the node expanded?
  142. MMC_COOKIE m_cookie; // cookie for the node
  143. RouterAdminConfigStream * m_pConfigStream;
  144. };
  145. /*---------------------------------------------------------------------------
  146. Class: DialInUserHandler
  147. ---------------------------------------------------------------------------*/
  148. class DialInUserHandler :
  149. public BaseRouterHandler
  150. {
  151. public:
  152. DialInUserHandler(ITFSComponentData *pCompData);
  153. ~DialInUserHandler()
  154. { DEBUG_DECREMENT_INSTANCE_COUNTER(DialInUserHandler); }
  155. HRESULT Init(IRouterInfo *pInfo, ITFSNode *pParent);
  156. // Override QI to handle embedded interface
  157. DeclareIUnknownMembers(IMPL)
  158. // STDMETHOD(QueryInterface)(REFIID iid, LPVOID *ppv);
  159. OVERRIDE_ResultHandler_GetString();
  160. OVERRIDE_ResultHandler_HasPropertyPages();
  161. OVERRIDE_ResultHandler_CompareItems();
  162. OVERRIDE_ResultHandler_AddMenuItems();
  163. OVERRIDE_ResultHandler_Command();
  164. OVERRIDE_ResultHandler_OnCreateDataObject();
  165. OVERRIDE_ResultHandler_DestroyResultHandler();
  166. OVERRIDE_BaseResultHandlerNotify_OnResultItemClkOrDblClk();
  167. // Initializes the node
  168. HRESULT ConstructNode(ITFSNode *pNode,
  169. IInterfaceInfo *pIfInfo,
  170. const DialInListEntry *pEntry);
  171. // Refresh the data for this node
  172. void RefreshInterface(MMC_COOKIE cookie);
  173. public:
  174. // Structure used to pass data to callbacks - used as a way of
  175. // avoiding recomputation
  176. struct SMenuData
  177. {
  178. SPITFSNode m_spNode;
  179. DialInUserHandler * m_pDialin; // non-AddRef'd
  180. };
  181. static ULONG GetSendMsgMenuFlags(const SRouterNodeMenu *, INT_PTR);
  182. protected:
  183. CString m_stTitle; // holds the title of the node
  184. DWORD m_ulConnId;
  185. DialInListEntry m_entry;
  186. // It is assumed that this will be valid for the lifetime of this node!
  187. DeclareEmbeddedInterface(IRtrAdviseSink, IUnknown)
  188. };
  189. #endif _DIALIN_H