Packet Sniffer SDK DLL Edition

HNLBAdapter :: Methods :: LbAdpGetProcessCount

 Previous Next

Returns the number of the packets transferred to the application.

Syntax:

DWORD __stdcall LbAdpGetProcessCount(HANDLE hLbAdp, DWORD *HiValue);

Parameters:

hLbAdp

[in] HNLBAdapter object handle.

HiValue

[out] The pointer to the variable, in which the high DWORD of the result will be stored. May be set to NULL, if the application does not need these data.

Return values:

If the function succeeds, the return value will be the low-order doubleword of the number of packets transferred to the application, and, if HiValue is non-NULL, the function will put the high-order doubleword of this number into the variable pointed to by this parameter.

Description:

Use LbAdpGetProcessCount after opening the loopback adapter and executing the LbAdpUpdateUserStatistics function.

This function returns the value of the HNLBAdapter internal packets counter. This value is set with the PSSDK internal driver packets counter value syncronously after LbAdpUpdateUserStatistics function call. So, to get the latest packets counter value you should call LbAdpGetProcessCount immediately after LbAdpUpdateUserStatistics function call.

This function may be used in the Ethernet emulation mode only (see HNLBAdapter.EthEmulation[Get/Set]).

To get the user's BPF filter statistics synchronously, please do the following:

void GetUserBpfStat()
 {
   ULARGE_INTEGER  Stat;
   // Refresh the user BPF filter statistics synchronously
   LbAdpUpdateUserStatistics(hLbAdp);
   // Display the user BPF filter statistics
   Stat.LowPart = LbAdpGetAcceptCount(hLbAdp,&Stat.HighPart);
   BpfAccept->Caption = Stat.QuadPart;

   Stat.LowPart = LbAdpGetProcessCount(hLbAdp,&Stat.HighPart);
   BpfProcess->Caption = Stat.QuadPart;

   Stat.LowPart = LbAdpGetRecvCount(hLbAdp,&Stat.HighPart);
   BpfReceive->Caption = Stat.QuadPart;

   Stat.LowPart = LbAdpGetRejectCount(hLbAdp,&Stat.HighPart);
   BpfReject->Caption = Stat.QuadPart;
 }
procedure GetUserBpfStat();
var
   Stat : ULARGE_INTEGER;
begin
   // Refresh the user BPF filter statistics synchronously
   LbAdpUpdateUserStatistics(hLbAdp);
   // Display the user BPF filter statistics
   Stat.LowPart := LbAdpGetAcceptCount(hLbAdp,@Stat.HighPart);
   BpfAccept.Caption := IntToStr(Stat.QuadPart);

   Stat.LowPart := LbAdpGetProcessCount(hLbAdp,@Stat.HighPart);
   BpfProcess.Caption := IntToStr(Stat.QuadPart);

   Stat.LowPart := LbAdpGetRecvCount(hLbAdp,@Stat.HighPart);
   BpfReceive.Caption := IntToStr(Stat.QuadPart);

   Stat.LowPart := LbAdpGetRejectCount(hLbAdp,@Stat.HighPart);
   BpfReject.Caption := IntToStr(Stat.QuadPart);
end;
See also:HNLBAdapter, LbAdpOpenAdapter, LbAdpUpdateUserStatistics