📄 u_statistics.pas
字号:
(*
* One Way Network Sniffer (OWNS)
* Copyright (C) 2001-2002 OWNS
*
* http://owns.sourceforge.net/
* http://www.owns.st
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)
(*
* $Id: u_Statistics.pas,v 1.7 2002/11/23 21:49:50 owns Exp $
* Statistics about the capture
*
*)
unit u_Statistics;
interface
uses idglobal,
SyncObjs,
u_EthernetFrame,u_TCPPacket,u_utils;
// g_Statistics is a singleton
// 3 threads use this class
// - main thread
// - capture thread
// - files creation thread
// So all properties are synchronized with a critical section
type
TStatistics = class
private
FNbFilesCreated : LongInt;
FNbTotalConnectionsTCP : LongInt;
FNbConnectionsDamaged : LongInt;
FNbConnectionsEnCours : LongInt;
FBytesReceived : Int64;
FBytesSaved : Int64;
FCurrentFilePath : String;
FCriticalSection : TCriticalSection;
FStartTickCount : Cardinal;
FtempDebug : Int64;
FPacketsTCP : Cardinal;
FPacketsNonTCP : Cardinal;
FPacketsWww : Cardinal;
FPacketsPop3 : Cardinal;
FPacketsNntp : Cardinal;
FBytesTCP : Int64;
FBytesNonTCP : Int64;
function getNbConnectionsEnCours : LongInt;
function getNbTotalConnectionsTCP : LongInt;
function getNbFilesCreated : LongInt;
procedure setNbFilesCreated(p_NbFilesCreated : longint);
function getBytesReceived : Int64;
function getBytesSaved : Int64;
procedure setBytesSaved(p_BytesSaved : Int64);
procedure setNbDamagedConnections(p_NbDamagedConnections : LongInt);
function getNbDamagedConnections : LongInt;
procedure Init;
function getTimeElapsed : Cardinal;
procedure setCurrentFilePath(p_FilePath : String);
function getCurrentFilePath : String;
function getTempDebug : Int64;
procedure setTempDebug(p_tempDebug : Int64);
function getPacketsTCP : Cardinal;
function getPacketsNonTCP : Cardinal;
function getPacketsPop3 : Cardinal;
function getPacketsNntp : Cardinal;
function getPacketsWww : Cardinal;
function getBytesNonTCP : int64;
function getBytesTCP : int64;
public
constructor create;
destructor destroy; override;
procedure StartStatistiques;
procedure StopStatistiques;
procedure packetReceived(p_Packet : TEthernetFrame;p_PacketLength : Word);
procedure nouvelleConnection;
procedure supprimerConnection;
property NbFilescreated : Longint read getNbFilesCreated write setNbFilesCreated;
property NbTotalConnectionsTCP : Longint read getNbTotalConnectionsTCP;
property BytesReceived : Int64 read getBytesReceived;
property BytesSaved : Int64 read getBytesSaved write setBytesSaved;
property startTickCount : Cardinal read FStartTickCount;
property NbDamagedConnections : LongInt read getNbDamagedConnections write setNbDamagedConnections;
property NBConnectionsEnCours : Longint read getNbConnectionsEnCours;
property timeElapsed : Cardinal read getTimeElapsed;
property currentFilePath : String read getCurrentFilePath write setCurrentFilePath;
property tempDebug : Int64 read getTempDebug write setTempDebug;
property PacketsTCP : Cardinal read getPacketsTCP;
property PacketsNonTCP : Cardinal read getPacketsNonTCP;
property PacketsWww : Cardinal read getPacketsWww;
property PacketsNntp : Cardinal read getPacketsNntp;
property PacketsPop3 : Cardinal read getPacketsPop3;
property BytesTCP : Int64 read getBytesTCP;
property BytesNonTCP : Int64 read getBytesNonTCP;
end;
var
g_Statistics : TStatistics;
g_CurrentProc : String;
implementation
constructor TStatistics.create;
begin
Init;
FCriticalSection := TCriticalSection.Create;
end;
destructor TStatistics.destroy;
begin
FCriticalSection.free;
inherited;
end;
//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -