📄 hnadapter.h
字号:
/****************************************************************************
** **
** PSSDK HNAdapter module **
** Copyright (c) 1997 - 2006 microOLAP Technologies LTD, **
** Khalturin A.P., Naumov D.A. **
** Header File **
** **
****************************************************************************/
//---------------------------------------------------------------------------
#ifndef __HN_PSSDK_ADAPTER_H__
#define __HN_PSSDK_ADAPTER_H__
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// Class CHNAdapter
//---------------------------------------------------------------------------
class CHNAdapter
{
private:
HANDLE hAdp;
public:
//###########################################################################
// Create & Destroy
//###########################################################################
//---------------------------------------------------------------------------
// AdpCreate - Creates an HNAdapter object.
CHNAdapter() { hAdp = AdpCreate(); }
//---------------------------------------------------------------------------
// AdpDestroy - Destroys an HNAdapter object.
~CHNAdapter() {AdpDestroy(hAdp); }
public:
//###########################################################################
// Additionals methods
//###########################################################################
BOOL IsValid() { return (BOOL)(hAdp != NULL); }
HANDLE Get_Handle() { return hAdp; }
operator HANDLE() { return hAdp; }
public:
//###########################################################################
// Methods of redirect
//###########################################################################
//---------------------------------------------------------------------------
// AdpOpenAdapter - Opens the network adapter.
DWORD OpenAdapter()
{ return AdpOpenAdapter(hAdp); }
//---------------------------------------------------------------------------
// AdpCloseAdapter - Closes the network adapter.
DWORD CloseAdapter()
{ return AdpCloseAdapter(hAdp);}
//---------------------------------------------------------------------------
// AdpGetOpenTime - Returns last network adapter open time
#ifdef _WIN64
LONGLONG Get_OpenTime()
{ return AdpGetOpenTime(hAdp); }
#else
DWORD Get_OpenTime(DWORD *pHiValue)
{ return AdpGetOpenTime(hAdp,pHiValue); }
#endif //_WIN64
//---------------------------------------------------------------------------
// AdpIsOpened - Shows HNAdapter working status.
BOOL IsOpened()
{ return AdpIsOpened(hAdp); }
//---------------------------------------------------------------------------
// AdpGetConfig - Returns the handle of the HNAdapterConfig object.
HANDLE Get_Config()
{ return AdpGetConfig(hAdp); }
//---------------------------------------------------------------------------
// AdpSetConfig - Sets the handle of the HNAdapterConfig object.
HANDLE Set_Config(HANDLE hCfg)
{ return AdpSetConfig(hAdp,hCfg);}
//---------------------------------------------------------------------------
// AdpGetMacFilter - Returns the MAC filter for the network adapter.
DWORD Get_MacFilter()
{ return AdpGetMacFilter(hAdp); }
//---------------------------------------------------------------------------
// AdpSetMacFilter - Sets the MAC filter for the network adapter.
DWORD Set_MacFilter(DWORD MacFilter)
{ return AdpSetMacFilter(hAdp,MacFilter); }
//---------------------------------------------------------------------------
// AdpGetUserFilter - Returns the handle of the HNUserFilter object.
HANDLE Get_UserFilter()
{ return AdpGetUserFilter(hAdp); }
//---------------------------------------------------------------------------
// AdpSetUserFilter - Sets the handle of the HNUserFilter object.
HANDLE Set_UserFilter(HANDLE hUserFilter)
{ return AdpSetUserFilter(hAdp, hUserFilter); }
//---------------------------------------------------------------------------
// AdpGetUserFilterActive - Returns the status flag of the user-settable packet filter using.
BOOL Get_UserFilterActive()
{ return AdpGetUserFilterActive(hAdp); }
//---------------------------------------------------------------------------
// AdpSetUserFilterActive - Sets the status flag of the user-settable packet filter using.
BOOL Set_UserFilterActive(BOOL bActiveBpf)
{ return AdpSetUserFilterActive(hAdp,bActiveBpf); }
//---------------------------------------------------------------------------
// AdpGetUseFastUserFilter - Returns the status flag of the FastBPF using.
BOOL Get_UseFastUserFilter()
{ return AdpGetUseFastUserFilter(hAdp); }
//---------------------------------------------------------------------------
// AdpSetUseFastUserFilter - Sets the status flag of the FastBPF using.
BOOL Set_UseFastUserFilter(BOOL bUseFastBpf)
{ return AdpSetUseFastUserFilter(hAdp,bUseFastBpf); }
//---------------------------------------------------------------------------
// AdpGetLinkSpeed - Returns the network adapter maximum speed in 100 bps.
DWORD Get_LinkSpeed()
{ return AdpGetLinkSpeed(hAdp); }
//---------------------------------------------------------------------------
// AdpGetConnectStatus - Returns the status of the physical connection with the network.
BOOL Get_ConnectStatus()
{ return AdpGetConnectStatus(hAdp); }
//---------------------------------------------------------------------------
// AdpGetMaxThreadCount - Returns the maximal number of the threads allowed to be created for work with the network adapter.
DWORD Get_MaxThreadCount()
{ return AdpGetMaxThreadCount(hAdp); }
//---------------------------------------------------------------------------
// AdpGetThreadCount - Returns the number of threads created for work with the network adapter.
DWORD Get_ThreadCount()
{ return AdpGetThreadCount(hAdp); }
//---------------------------------------------------------------------------
// AdpSetThreadCount - Sets the number of threads created for work with the network adapter.
DWORD Set_ThreadCount(DWORD ThreadCount)
{ return AdpSetThreadCount(hAdp,ThreadCount); }
//---------------------------------------------------------------------------
// AdpGetRecvCount - Returns the number of the packets received by the Packet Sniffer SDK internal driver from OS.
#ifdef _WIN64
ULONGLONG Get_RecvCount()
{ return AdpGetRecvCount(hAdp); }
#else
DWORD Get_RecvCount(DWORD *pHiValue)
{ return AdpGetRecvCount(hAdp,pHiValue); }
#endif //_WIN64
//---------------------------------------------------------------------------
// AdpGetAcceptCount - Returns the number of the packets passed by the user-settable packet filter.
#ifdef _WIN64
ULONGLONG Get_AcceptCount()
{ return AdpGetAcceptCount(hAdp); }
#else
DWORD Get_AcceptCount(DWORD *pHiValue)
{ return AdpGetAcceptCount(hAdp,pHiValue); }
#endif //_WIN64
//---------------------------------------------------------------------------
// AdpGetRejectCount - Returns the number of packets rejected by the user-settable packet filter.
#ifdef _WIN64
ULONGLONG Get_RejectCount()
{ return AdpGetRejectCount(hAdp); }
#else
DWORD Get_RejectCount(DWORD *pHiValue)
{ return AdpGetRejectCount(hAdp,pHiValue); }
#endif //_WIN64
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -