Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pcap-Net
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Pcap-Net
Commits
f6c14322
Commit
f6c14322
authored
Feb 20, 2015
by
Brickner_cp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix PacketSampleStatistics to use uin64 instead of uint32.
parent
84b36379
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
17 deletions
+17
-17
LivePacketDeviceTests.cs
PcapDotNet/src/PcapDotNet.Core.Test/LivePacketDeviceTests.cs
+7
-7
PacketSampleStatistics.cpp
PcapDotNet/src/PcapDotNet.Core/PacketSampleStatistics.cpp
+4
-4
PacketSampleStatistics.h
PcapDotNet/src/PcapDotNet.Core/PacketSampleStatistics.h
+6
-6
No files found.
PcapDotNet/src/PcapDotNet.Core.Test/LivePacketDeviceTests.cs
View file @
f6c14322
...
...
@@ -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
<
u
int
>(
0
,
statistics
.
AcceptedPackets
);
Assert
.
AreEqual
<
u
int
>(
0
,
statistics
.
AcceptedBytes
);
Assert
.
AreEqual
<
u
long
>(
0
,
statistics
.
AcceptedPackets
);
Assert
.
AreEqual
<
u
long
>(
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
<
u
int
>(
NumPacketsToSend
,
statistics
.
AcceptedPackets
,
"AcceptedPackets"
);
// Todo check byte statistics
// Assert.AreEqual<
uint>((uint)
(sentPacket.Length * NumPacketsToSend), statistics.AcceptedBytes,
Assert
.
AreEqual
<
u
long
>(
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 byte
s statistics
// Assert.AreEqual<ulong>((ulong)(N
umPacketsToSend * sentPacket.Length), totalBytes, "NumBytes");
// Todo check byte
statistics. See http://www.winpcap.org/pipermail/winpcap-users/2015-February/004931.html
// Assert.AreEqual((ulong)(n
umPacketsToSend * sentPacket.Length), totalBytes, "NumBytes");
MoreAssert
.
IsInRange
(
expectedMinSeconds
,
expectedMaxSeconds
,
(
finishedWaiting
-
startWaiting
).
TotalSeconds
);
}
}
...
...
PcapDotNet/src/PcapDotNet.Core/PacketSampleStatistics.cpp
View file @
f6c14322
...
...
@@ -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
PcapDotNet/src/PcapDotNet.Core/PacketSampleStatistics.h
View file @
f6c14322
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment