39 lines
844 B
C++
39 lines
844 B
C++
#pragma once
|
|
#include "IVrEthMonitor.h"
|
|
|
|
class CVrEthMonitor : public IVrEthMonitor
|
|
{
|
|
public:
|
|
CVrEthMonitor();
|
|
~CVrEthMonitor();
|
|
|
|
/// @brief
|
|
/// 开始监控
|
|
/// @return 成功返回TRUE
|
|
virtual int StartMonitor(NetNotify func, void* pParam);
|
|
|
|
/// @brief
|
|
/// 停止监控
|
|
virtual void StopMonitor();
|
|
|
|
private:
|
|
void _MonitorTask();
|
|
|
|
void _parse_rtattr(struct rtattr **tb, int max, struct rtattr *attr, int len);
|
|
|
|
///显示连接信息: 当网卡变动的时候触发这个信息,例如插/拔网线,增/减网卡设备,启用/禁用接口等.
|
|
void _ifinfomsg(struct nlmsghdr *nh);
|
|
|
|
///显示地址信息: 当地址变动的时候触发这个信息,例如通过DHCP获取到地址后
|
|
void _ifaddrmsg(struct nlmsghdr *nh);
|
|
|
|
/// 显示路由信息: 当路由变动的时候触发这个信息
|
|
void _rtmsg(struct nlmsghdr *nh);
|
|
|
|
NetNotify m_fNotify;
|
|
void* m_pParam;
|
|
bool m_bRunning;
|
|
|
|
};
|
|
|