MFNetTraffic.h
上传用户:fangbo2004
上传日期:2022-05-14
资源大小:2257k
文件大小:1k
源码类别:

网络截获/分析

开发平台:

Visual C++

  1. // MFNetTraffic.h: interface for the MFNetTraffic class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_MFNETTRAFFIC_H__9CA9C41F_F929_4F26_BD1F_2B5827090494__INCLUDED_)
  5. #define AFX_MFNETTRAFFIC_H__9CA9C41F_F929_4F26_BD1F_2B5827090494__INCLUDED_
  6. #if _MSC_VER > 1000
  7. #pragma once
  8. #endif // _MSC_VER > 1000
  9. #include <afxtempl.h>
  10. class MFNetTraffic  
  11. {
  12. public:
  13. enum TrafficType //流量类型
  14. {
  15. AllTraffic = 388,//总的流量
  16. IncomingTraffic = 264,//输入流量
  17. OutGoingTraffic = 506 //输出流量
  18. };
  19. void SetTrafficType(int trafficType); //设置流量类型
  20. DWORD GetInterfaceTotalTraffic(int index); //得到index索引接口的总流量
  21. BOOL GetNetworkInterfaceName(CString *InterfaceName, int index);//得到网络接口名字
  22. int GetNetworkInterfacesCount(); //得到接口的数目
  23. double GetTraffic(int interfaceNumber); //得到流量
  24. DWORD GetInterfaceBandwidth(int index); //得到index索引接口的带宽
  25. MFNetTraffic();
  26. virtual ~MFNetTraffic();
  27. private:
  28. BOOL GetInterfaces();
  29. double lasttraffic;
  30. CStringList Interfaces;
  31. CList < DWORD, DWORD &> Bandwidths; //带宽
  32. CList < DWORD, DWORD &> TotalTraffics;//总的流量
  33. int CurrentInterface;
  34. int CurrentTrafficType;
  35. };
  36. #endif // !defined(AFX_MFNETTRAFFIC_H__9CA9C41F_F929_4F26_BD1F_2B5827090494__INCLUDED_)