网页设计与网站建设作品资源网
概述
IPC设备一般都带有网口,支持以有线网络方式接入NVR和其他平台。有线网络的使用比较简单,主要操作有:设置IP地址、子网掩码、网关、DHCP等。在封装有线网络前,我们需要先封装DHCP客户端管理类,用于管理各种网络的DHCP功能。
DHCP客户端管理类
DHCP客户端管理类的头文件如下:
#pragma once#include <string>
#include <map>#include <HP_Base/HP_BaseThread.h>
#include <HP_Base/HP_Mutex.h>typedef void(*CALLBACK_DHCP_IP_ADDR_GOT)(const std::string &strNetName, unsigned int uiIP, void *pContext);typedef struct _TDhcpClientManagerParam
{_TDhcpClientManagerParam(){pCbDhcpIPGot = NULL;pCbContext = NULL;}std::string strScriptFile;CALLBACK_DHCP_IP_ADDR_GOT pCbDhcpIPGot;void *pCbContext;
}TDhcpClientManagerParam;class CDhcpClientManager : public CHP_BaseThread
{
public:static void Open();static CDhcpClientManager *&Singleton();static void Close();int Init(const TDhcpClientMan