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.

183 lines
5.4 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1998.
  5. //
  6. // File: S M C E N T . H
  7. //
  8. // Contents: The central object that controls statistic engines.
  9. //
  10. // Notes:
  11. //
  12. // Author: CWill 11 Dec 1997
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. #ifndef _SMCENT_H
  17. #define _SMCENT_H
  18. #include "cfpidl.h"
  19. #include "netshell.h"
  20. #include "ras.h"
  21. typedef struct tagSM_TOOL_FLAGS
  22. {
  23. DWORD dwValue;
  24. WCHAR* pszFlag;
  25. } SM_TOOL_FLAGS;
  26. // The flag bits
  27. //
  28. typedef enum tagSM_CMD_LINE_FLAGS
  29. {
  30. SCLF_CONNECTION = 0x00000001,
  31. SCLF_ADAPTER = 0x00000002,
  32. } SM_CMD_LINE_FLAGS;
  33. // *** The index and the flags have to be in sync *** //
  34. //
  35. typedef enum tagSM_TOOL_FLAG_INDEX
  36. {
  37. STFI_CONNECTION = 0,
  38. STFI_ADAPTER,
  39. STFI_MAX,
  40. } SM_TOOL_FLAG_INDEX;
  41. //////////////////////////////////////////////////////////////////////////////
  42. // //
  43. // CStatMonToolEntry //
  44. // //
  45. // This class is used to keep tack of any tool entries that are found in //
  46. // registry to be shown in the tools page. //
  47. // //
  48. //////////////////////////////////////////////////////////////////////////////
  49. class CStatMonToolEntry
  50. {
  51. public:
  52. CStatMonToolEntry(VOID);
  53. ~CStatMonToolEntry(VOID);
  54. public:
  55. tstring strDisplayName;
  56. tstring strDescription;
  57. tstring strCommandLine;
  58. tstring strManufacturer;
  59. list<tstring*> lstpstrComponentID;
  60. list<tstring*> lstpstrConnectionType;
  61. list<tstring*> lstpstrMediaType;
  62. DWORD dwFlags;
  63. };
  64. //////////////////////////////////////////////////////////////////////////////
  65. // //
  66. // CNetStatisticsCentral //
  67. // //
  68. // This global class manages all the engines that have been created. It //
  69. // is also responsible for keeping the statistics flowing by telling the //
  70. // engines to update their statistics and notify their advises. //
  71. // //
  72. //////////////////////////////////////////////////////////////////////////////
  73. typedef DWORD (APIENTRY* PRASGETCONNECTIONSTATISTICS)(HRASCONN, RAS_STATS*);
  74. typedef DWORD (APIENTRY* PRASGETCONNECTSTATUS)(HRASCONN, RASCONNSTATUS*);
  75. typedef class CNetStatisticsEngine CNetStatisticsEngine;
  76. class CStatCentralCriticalSection
  77. {
  78. CRITICAL_SECTION m_csStatCentral;
  79. BOOL bInitialized;
  80. public:
  81. CStatCentralCriticalSection();
  82. ~CStatCentralCriticalSection();
  83. HRESULT Enter();
  84. VOID Leave();
  85. };
  86. class CNetStatisticsCentral :
  87. public IUnknown,
  88. public CComObjectRootEx <CComObjectThreadModel>
  89. {
  90. public:
  91. virtual ~CNetStatisticsCentral();
  92. // Message handlers
  93. public:
  94. static VOID CALLBACK TimerCallback( HWND hwnd, UINT uMsg,
  95. UINT_PTR idEvent, DWORD dwTime);
  96. VOID RefreshStatistics(DWORD dwTime);
  97. VOID UpdateTitle(const GUID * pguidId, PCWSTR pszwNewName);
  98. VOID UpdateRasLinkList(const GUID * pguidId);
  99. VOID CloseStatusMonitor(const GUID * pguidId);
  100. public:
  101. // *** IUnknown methods ***
  102. STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj);
  103. STDMETHOD_(ULONG,AddRef)();
  104. STDMETHOD_(ULONG,Release)();
  105. static
  106. HRESULT
  107. HrGetNetStatisticsCentral(
  108. CNetStatisticsCentral ** ppnsc,
  109. BOOL fCreate);
  110. HRESULT RemoveNetStatisticsEngine(const GUID* pguidId);
  111. HRESULT HrReadTools(VOID);
  112. list<CStatMonToolEntry*>* PlstsmteRegEntries(VOID);
  113. private:
  114. CNetStatisticsCentral();
  115. HRESULT HrCreateNewEngineType(
  116. const CONFOLDENTRY& pccfe,
  117. CNetStatisticsEngine** ppObj);
  118. HRESULT HrCreateStatisticsEngineForEntry(
  119. const CONFOLDENTRY& pccfe,
  120. INetStatisticsEngine** ppNetStatEng);
  121. BOOL FEngineInList( const GUID* pguidId,
  122. INetStatisticsEngine** ppnseRet);
  123. HRESULT HrReadOneTool(HKEY hkeyToolEntry,
  124. CStatMonToolEntry* psmteNew);
  125. HRESULT HrReadToolFlags(HKEY hkeyToolEntry,
  126. CStatMonToolEntry* psmteNew);
  127. VOID InsertNewTool(CStatMonToolEntry* psmteTemp);
  128. private:
  129. ULONG m_cRef; // Object Ref count
  130. BOOL m_fProcessingTimerEvent;
  131. UINT_PTR m_unTimerId;
  132. list<INetStatisticsEngine*> m_pnselst;
  133. list<CStatMonToolEntry*> m_lstpsmte;
  134. static CStatCentralCriticalSection g_csStatCentral;
  135. friend
  136. HRESULT
  137. HrGetStatisticsEngineForEntry (
  138. const CONFOLDENTRY& pccfe,
  139. INetStatisticsEngine** ppnse,
  140. BOOL fCreate);
  141. };
  142. HRESULT
  143. HrGetStatisticsEngineForEntry (
  144. const CONFOLDENTRY& pccfe,
  145. INetStatisticsEngine** ppnse,
  146. BOOL fCreate);
  147. #endif // _SMCENT_H