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.

99 lines
2.3 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (C) 1999-2001 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // SAQueryNetInfo.h
  7. //
  8. // Implementation Files:
  9. // SAQueryNetInfo.cpp
  10. //
  11. // Description:
  12. // Declare the class CSANetEvent
  13. //
  14. // History:
  15. // 1. lustar.li (Guogang Li), creation date in 7-DEC-2000
  16. //
  17. // Notes:
  18. //
  19. //
  20. //////////////////////////////////////////////////////////////////////////////
  21. #ifndef _SAQUERYNETINFO_H_
  22. #define _SAQUERYNETINFO_H_
  23. #define SAWMINAMESPACE L"\\\\.\\root\\WMI"
  24. #define SANETCLASSNAME L"Win32_PerfRawData_Tcpip_NetworkInterface"
  25. #define SANETRECEIVEPACKET L"PacketsReceivedUnicastPersec"
  26. #define SANETSENDPACKET L"PacketsSentUnicastPersec"
  27. #define SAMEDIACLASSNAME L"MSNdis_MediaConnectStatus"
  28. #define SAMEDIACONNECTSTATUS L"NdisMediaConnectStatus"
  29. //////////////////////////////////////////////////////////////////////////////
  30. //++
  31. //
  32. // class CSAQueryNetInfo
  33. //
  34. // Description:
  35. // The class is used to get net info from wmi
  36. //
  37. // History:
  38. // 1. lustar.li (Guogang Li), creation date in 7-DEC-2000
  39. //--
  40. //////////////////////////////////////////////////////////////////////////////
  41. class CSAQueryNetInfo
  42. {
  43. //
  44. // Private member
  45. //
  46. private:
  47. UINT m_uiQueryInterval; // the interval of query
  48. BOOL m_bLinkCable; // have cable?
  49. BOOL m_bFirstQuery; // is first query net information ?
  50. //
  51. // Describe the sent packets
  52. //
  53. UINT m_nPacketsSent;
  54. UINT m_nPacketsCurrentSent;
  55. //
  56. // Describe the received packets
  57. //
  58. UINT m_nPacketsReceived;
  59. UINT m_nPacketsCurrentReceived;
  60. IWbemServices *m_pNs; // pointer to namespace
  61. IWbemServices *m_pWmiNs; // pointer to \root\wmi namespace
  62. //
  63. // Constructor and destructor
  64. //
  65. public:
  66. CSAQueryNetInfo(
  67. IWbemServices * pNS,
  68. UINT uiInterval = 1000
  69. );
  70. virtual ~CSAQueryNetInfo();
  71. //
  72. // Private methods
  73. //
  74. private:
  75. BOOL GetNetConnection();
  76. BOOL GetNetInfo();
  77. //
  78. // Public methods
  79. //
  80. public:
  81. BOOL Initialize();
  82. UINT GetDisplayInformation();
  83. };
  84. #endif //#ifndef _SAQUERYNETINFO_H_