Commit f6c14322 authored by Brickner_cp's avatar Brickner_cp

Fix PacketSampleStatistics to use uin64 instead of uint32.

parent 84b36379
......@@ -286,8 +286,8 @@ namespace PcapDotNet.Core.Test
PacketCommunicatorReceiveResult result = communicator.ReceiveStatistics(out statistics);
Assert.AreEqual(PacketCommunicatorReceiveResult.Ok, result);
MoreAssert.IsInRange(DateTime.Now.AddSeconds(-1), DateTime.Now.AddSeconds(1), statistics.Timestamp);
Assert.AreEqual<uint>(0, statistics.AcceptedPackets);
Assert.AreEqual<uint>(0, statistics.AcceptedBytes);
Assert.AreEqual<ulong>(0, statistics.AcceptedPackets);
Assert.AreEqual<ulong>(0, statistics.AcceptedBytes);
for (int i = 0; i != NumPacketsToSend; ++i)
communicator.SendPacket(sentPacket);
......@@ -296,9 +296,9 @@ namespace PcapDotNet.Core.Test
Assert.AreEqual(PacketCommunicatorReceiveResult.Ok, result);
MoreAssert.IsInRange(DateTime.Now.AddSeconds(-1), DateTime.Now.AddSeconds(1), statistics.Timestamp);
Assert.AreEqual<uint>(NumPacketsToSend, statistics.AcceptedPackets, "AcceptedPackets");
// Todo check byte statistics
// Assert.AreEqual<uint>((uint)(sentPacket.Length * NumPacketsToSend), statistics.AcceptedBytes,
Assert.AreEqual<ulong>(NumPacketsToSend, statistics.AcceptedPackets, "AcceptedPackets");
// Todo check byte statistics. See http://www.winpcap.org/pipermail/winpcap-users/2015-February/004931.html
// Assert.AreEqual<long>((sentPacket.Length * NumPacketsToSend), statistics.AcceptedBytes,
// "AcceptedBytes. Diff Per Packet: " +
// (statistics.AcceptedBytes - sentPacket.Length * NumPacketsToSend) /
// ((double)NumPacketsToSend));
......@@ -705,8 +705,8 @@ namespace PcapDotNet.Core.Test
Assert.AreEqual(expectedResult, result, "Result");
Assert.AreEqual(expectedNumStatistics, numStatisticsGot, "NumStatistics");
Assert.AreEqual((ulong)expectedNumPackets, totalPackets, "NumPackets");
// Todo check bytes statistics
// Assert.AreEqual<ulong>((ulong)(NumPacketsToSend * sentPacket.Length), totalBytes, "NumBytes");
// Todo check byte statistics. See http://www.winpcap.org/pipermail/winpcap-users/2015-February/004931.html
// Assert.AreEqual((ulong)(numPacketsToSend * sentPacket.Length), totalBytes, "NumBytes");
MoreAssert.IsInRange(expectedMinSeconds, expectedMaxSeconds, (finishedWaiting - startWaiting).TotalSeconds);
}
}
......
......@@ -9,12 +9,12 @@ DateTime PacketSampleStatistics::Timestamp::get()
{
return _timestamp;
}
unsigned long PacketSampleStatistics::AcceptedPackets::get()
unsigned __int64 PacketSampleStatistics::AcceptedPackets::get()
{
return _acceptedPackets;
}
unsigned long PacketSampleStatistics::AcceptedBytes::get()
unsigned __int64 PacketSampleStatistics::AcceptedBytes::get()
{
return _acceptedBytes;
}
......@@ -30,6 +30,6 @@ PacketSampleStatistics::PacketSampleStatistics(const pcap_pkthdr& packetHeader,
{
PacketTimestamp::PcapTimestampToDateTime(packetHeader.ts, _timestamp);
_acceptedPackets = *reinterpret_cast<const unsigned long*>(packetData);
_acceptedBytes = *reinterpret_cast<const unsigned long*>(packetData + 8);
_acceptedPackets = *reinterpret_cast<const unsigned __int64*>(packetData);
_acceptedBytes = *reinterpret_cast<const unsigned __int64*>(packetData + 8);
}
\ No newline at end of file
......@@ -21,17 +21,17 @@ namespace PcapDotNet { namespace Core
/// <summary>
/// The number of packets received during the last interval.
/// </summary>
property unsigned long AcceptedPackets
property unsigned __int64 AcceptedPackets
{
unsigned long get();
unsigned __int64 get();
}
/// <summary>
/// The number of bytes received during the last interval.
/// </summary>
property unsigned long AcceptedBytes
property unsigned __int64 AcceptedBytes
{
unsigned long get();
unsigned __int64 get();
}
virtual System::String^ ToString() override;
......@@ -41,7 +41,7 @@ namespace PcapDotNet { namespace Core
private:
System::DateTime _timestamp;
unsigned long _acceptedPackets;
unsigned long _acceptedBytes;
unsigned __int64 _acceptedPackets;
unsigned __int64 _acceptedBytes;
};
}}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment