Commit 245f83f3 authored by Brickner_cp's avatar Brickner_cp

--no commit message

--no commit message
parent 711226ee
......@@ -91,12 +91,12 @@ namespace PcapDotNet.Core.Test
PacketCommunicatorReceiveResult result;
for (int i = 0; i != 5; ++i)
{
result = communicator.GetPacket(out packet);
result = communicator.ReceivePacket(out packet);
Assert.AreEqual(PacketCommunicatorReceiveResult.Ok, result);
Assert.AreEqual(expectedPacket, packet);
}
result = communicator.GetPacket(out packet);
result = communicator.ReceivePacket(out packet);
Assert.AreEqual(PacketCommunicatorReceiveResult.Timeout, result);
Assert.IsNull(packet);
}
......
......@@ -73,7 +73,7 @@ namespace PcapDotNet.Core.Test
Packet packet;
DateTime startWaiting = DateTime.Now;
PacketCommunicatorReceiveResult result = communicator.GetPacket(out packet);
PacketCommunicatorReceiveResult result = communicator.ReceivePacket(out packet);
DateTime finishedWaiting = DateTime.Now;
Assert.AreEqual(PacketCommunicatorReceiveResult.Timeout, result);
......@@ -89,7 +89,7 @@ namespace PcapDotNet.Core.Test
DateTime endSendingTime = DateTime.Now;
result = communicator.GetPacket(out packet);
result = communicator.ReceivePacket(out packet);
Assert.AreEqual(PacketCommunicatorReceiveResult.Ok, result);
Assert.AreEqual<uint>(NumPacketsToSend, communicator.TotalStatistics.PacketsCaptured);
......@@ -159,7 +159,7 @@ namespace PcapDotNet.Core.Test
Packet sentPacket = MoreRandom.BuildRandomPacket(SourceMac, DestinationMac, PacketSize);
PacketSampleStatistics statistics;
PacketCommunicatorReceiveResult result = communicator.GetNextStatistics(out statistics);
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);
......@@ -168,7 +168,7 @@ namespace PcapDotNet.Core.Test
for (int i = 0; i != NumPacketsToSend; ++i)
communicator.SendPacket(sentPacket);
result = communicator.GetNextStatistics(out statistics);
result = communicator.ReceiveStatistics(out statistics);
Assert.AreEqual(PacketCommunicatorReceiveResult.Ok, result);
MoreAssert.IsInRange(DateTime.Now.AddSeconds(-1), DateTime.Now.AddSeconds(1), statistics.Timestamp);
......@@ -216,7 +216,7 @@ namespace PcapDotNet.Core.Test
using (PacketCommunicator communicator = OpenLiveDevice())
{
PacketSampleStatistics statistics;
communicator.GetNextStatistics(out statistics);
communicator.ReceiveStatistics(out statistics);
}
}
......@@ -228,7 +228,7 @@ namespace PcapDotNet.Core.Test
{
communicator.Mode = PacketCommunicatorMode.Statistics;
Packet packet;
communicator.GetPacket(out packet);
communicator.ReceivePacket(out packet);
}
}
......@@ -265,7 +265,7 @@ namespace PcapDotNet.Core.Test
communicator.SetKernelBufferSize(50);
Packet packet = MoreRandom.BuildRandomPacket(SourceMac, DestinationMac, 100);
communicator.SendPacket(packet);
communicator.GetPacket(out packet);
communicator.ReceivePacket(out packet);
}
}
......@@ -283,7 +283,7 @@ namespace PcapDotNet.Core.Test
Packet packet = MoreRandom.BuildRandomPacket(SourceMac, DestinationMac, 100);
communicator.SendPacket(packet);
int numPacketsGot;
communicator.GetSomePackets(out numPacketsGot, 1, delegate { });
communicator.ReceiveSomePackets(out numPacketsGot, 1, delegate { });
}
}
......@@ -305,7 +305,7 @@ namespace PcapDotNet.Core.Test
{
try
{
communicator.GetPackets(1, delegate { });
communicator.ReceivePackets(1, delegate { });
}
catch (Exception e)
{
......@@ -330,7 +330,7 @@ namespace PcapDotNet.Core.Test
communicator.Mode = PacketCommunicatorMode.Statistics;
communicator.SetKernelBufferSize(50);
PacketSampleStatistics statistics;
communicator.GetNextStatistics(out statistics);
communicator.ReceiveStatistics(out statistics);
}
}
......@@ -342,7 +342,7 @@ namespace PcapDotNet.Core.Test
{
communicator.Mode = PacketCommunicatorMode.Statistics;
communicator.SetKernelBufferSize(50);
communicator.GetStatistics(1, delegate { });
communicator.ReceiveStatistics(1, delegate { });
}
}
......@@ -362,7 +362,7 @@ namespace PcapDotNet.Core.Test
communicator.SendPacket(expectedPacket);
Packet packet;
DateTime start = DateTime.Now;
PacketCommunicatorReceiveResult result = communicator.GetPacket(out packet);
PacketCommunicatorReceiveResult result = communicator.ReceivePacket(out packet);
DateTime end = DateTime.Now;
Assert.AreEqual(PacketCommunicatorReceiveResult.Ok, result);
Assert.AreEqual(expectedPacket, packet);
......@@ -387,7 +387,7 @@ namespace PcapDotNet.Core.Test
communicator.SendPacket(expectedPacket);
Packet packet;
DateTime start = DateTime.Now;
PacketCommunicatorReceiveResult result = communicator.GetPacket(out packet);
PacketCommunicatorReceiveResult result = communicator.ReceivePacket(out packet);
DateTime end = DateTime.Now;
Assert.AreEqual(PacketCommunicatorReceiveResult.Ok, result);
Assert.AreEqual(expectedPacket, packet);
......@@ -416,11 +416,11 @@ namespace PcapDotNet.Core.Test
PacketCommunicatorReceiveResult result;
for (int i = 0; i != 4; ++i)
{
result = communicator.GetPacket(out packet);
result = communicator.ReceivePacket(out packet);
Assert.AreEqual(PacketCommunicatorReceiveResult.Ok, result);
Assert.AreEqual(60 * 5 * (i + 1), packet.Length);
}
result = communicator.GetPacket(out packet);
result = communicator.ReceivePacket(out packet);
Assert.AreEqual(PacketCommunicatorReceiveResult.Timeout, result);
Assert.IsNull(packet);
}
......@@ -450,11 +450,11 @@ namespace PcapDotNet.Core.Test
PacketCommunicatorReceiveResult result;
for (int i = 0; i != 6; ++i)
{
result = communicator.GetPacket(out packet);
result = communicator.ReceivePacket(out packet);
Assert.AreEqual(PacketCommunicatorReceiveResult.Ok, result);
Assert.AreEqual(60 * (i * 2 + 1), packet.Length);
}
result = communicator.GetPacket(out packet);
result = communicator.ReceivePacket(out packet);
Assert.AreEqual(PacketCommunicatorReceiveResult.Timeout, result);
Assert.IsNull(packet);
}
......@@ -522,7 +522,7 @@ namespace PcapDotNet.Core.Test
communicator.Break();
Thread thread = new Thread(delegate()
{
result = communicator.GetStatistics(numStatisticsToGather,
result = communicator.ReceiveStatistics(numStatisticsToGather,
delegate(PacketSampleStatistics statistics)
{
Assert.IsNotNull(statistics.ToString());
......@@ -576,7 +576,7 @@ namespace PcapDotNet.Core.Test
PacketHandler handler = new PacketHandler(packetToSend, communicator, numPacketsToBreakLoop);
DateTime startWaiting = DateTime.Now;
PacketCommunicatorReceiveResult result = communicator.GetSomePackets(out numPacketsGot, numPacketsToGet,
PacketCommunicatorReceiveResult result = communicator.ReceiveSomePackets(out numPacketsGot, numPacketsToGet,
handler.Handle);
DateTime finishedWaiting = DateTime.Now;
......@@ -616,7 +616,7 @@ namespace PcapDotNet.Core.Test
{
if (numPacketsToBreakLoop == 0)
communicator.Break();
result = communicator.GetPackets(numPacketsToWait, handler.Handle);
result = communicator.ReceivePackets(numPacketsToWait, handler.Handle);
});
DateTime startWaiting = DateTime.Now;
......
......@@ -77,14 +77,14 @@ namespace PcapDotNet.Core.Test
Packet actualPacket;
for (int i = 0; i != NumPackets; ++i)
{
result = communicator.GetPacket(out actualPacket);
result = communicator.ReceivePacket(out actualPacket);
Assert.AreEqual(PacketCommunicatorReceiveResult.Ok, result);
Assert.AreEqual(expectedPacket, actualPacket);
MoreAssert.IsInRange(expectedPacket.Timestamp.AddSeconds(-0.05), expectedPacket.Timestamp.AddSeconds(0.05),
actualPacket.Timestamp);
}
result = communicator.GetPacket(out actualPacket);
result = communicator.ReceivePacket(out actualPacket);
Assert.AreEqual(PacketCommunicatorReceiveResult.Eof, result);
Assert.IsNull(actualPacket);
}
......@@ -211,11 +211,11 @@ namespace PcapDotNet.Core.Test
Packet packet;
for (int i = 0; i != 10; ++i)
{
result = communicator.GetPacket(out packet);
result = communicator.ReceivePacket(out packet);
Assert.AreEqual(PacketCommunicatorReceiveResult.Ok, result);
Assert.AreEqual(expectedPacket, packet);
}
result = communicator.GetPacket(out packet);
result = communicator.ReceivePacket(out packet);
Assert.AreEqual(PacketCommunicatorReceiveResult.Eof, result);
Assert.IsNull(packet);
}
......@@ -235,13 +235,13 @@ namespace PcapDotNet.Core.Test
Packet packet;
for (int i = 0; i != 5; ++i)
{
result = communicator.GetPacket(out packet);
result = communicator.ReceivePacket(out packet);
Assert.AreEqual(PacketCommunicatorReceiveResult.Ok, result);
Assert.AreEqual(expectedPacket, packet);
DateTime expectedTimestamp = expectedPacket.Timestamp.AddSeconds(i * 2);
MoreAssert.IsInRange(expectedTimestamp.AddSeconds(-0.01), expectedTimestamp.AddSeconds(0.01), packet.Timestamp);
}
result = communicator.GetPacket(out packet);
result = communicator.ReceivePacket(out packet);
Assert.AreEqual(PacketCommunicatorReceiveResult.Eof, result);
Assert.IsNull(packet);
}
......@@ -268,7 +268,7 @@ namespace PcapDotNet.Core.Test
PacketHandler handler = new PacketHandler(expectedPacket, expectedMinSeconds, expectedMaxSeconds, communicator, numPacketsToBreakLoop);
int numPacketsGot;
PacketCommunicatorReceiveResult result = communicator.GetSomePackets(out numPacketsGot, numPacketsToGet, handler.Handle);
PacketCommunicatorReceiveResult result = communicator.ReceiveSomePackets(out numPacketsGot, numPacketsToGet, handler.Handle);
Assert.AreEqual(expectedResult, result);
Assert.AreEqual(expectedNumPackets, numPacketsGot, "NumPacketsGot. Test: " + TestDescription);
Assert.AreEqual(expectedNumPackets, handler.NumPacketsHandled, "NumPacketsHandled. Test: " + TestDescription);
......@@ -298,7 +298,7 @@ namespace PcapDotNet.Core.Test
PacketCommunicatorReceiveResult result = PacketCommunicatorReceiveResult.None;
Thread thread = new Thread(delegate()
{
result = communicator.GetPackets(numPacketsToGet, handler.Handle);
result = communicator.ReceivePackets(numPacketsToGet, handler.Handle);
});
thread.Start();
......
......@@ -103,7 +103,7 @@ namespace PcapDotNet.Core.Test
int numPacketsHandled = 0;
int numPacketsGot;
PacketCommunicatorReceiveResult result =
communicator.GetSomePackets(out numPacketsGot, numPacketsToSend,
communicator.ReceiveSomePackets(out numPacketsGot, numPacketsToSend,
delegate(Packet packet)
{
Assert.AreEqual(packetsToSend[numPacketsHandled], packet);
......
......@@ -137,7 +137,7 @@ void PacketCommunicator::SetSamplingMethod(SamplingMethod^ method)
pcapSamplingMethod->value = method->Value;
}
PacketCommunicatorReceiveResult PacketCommunicator::GetPacket([Out] Packet^% packet)
PacketCommunicatorReceiveResult PacketCommunicator::ReceivePacket([Out] Packet^% packet)
{
AssertMode(PacketCommunicatorMode::Capture);
......@@ -155,7 +155,7 @@ PacketCommunicatorReceiveResult PacketCommunicator::GetPacket([Out] Packet^% pac
return result;
}
PacketCommunicatorReceiveResult PacketCommunicator::GetSomePackets([Out] int% numPacketsGot, int maxPackets, HandlePacket^ callBack)
PacketCommunicatorReceiveResult PacketCommunicator::ReceiveSomePackets([Out] int% numPacketsGot, int maxPackets, HandlePacket^ callBack)
{
AssertMode(PacketCommunicatorMode::Capture);
......@@ -186,7 +186,7 @@ PacketCommunicatorReceiveResult PacketCommunicator::GetSomePackets([Out] int% nu
return PacketCommunicatorReceiveResult::Ok;
}
PacketCommunicatorReceiveResult PacketCommunicator::GetPackets(int numPackets, HandlePacket^ callBack)
PacketCommunicatorReceiveResult PacketCommunicator::ReceivePackets(int numPackets, HandlePacket^ callBack)
{
AssertMode(PacketCommunicatorMode::Capture);
......@@ -209,7 +209,7 @@ PacketCommunicatorReceiveResult PacketCommunicator::GetPackets(int numPackets, H
return PacketCommunicatorReceiveResult::Ok;
}
PacketCommunicatorReceiveResult PacketCommunicator::GetNextStatistics([Out] PacketSampleStatistics^% statistics)
PacketCommunicatorReceiveResult PacketCommunicator::ReceiveStatistics([Out] PacketSampleStatistics^% statistics)
{
AssertMode(PacketCommunicatorMode::Statistics);
......@@ -228,7 +228,7 @@ PacketCommunicatorReceiveResult PacketCommunicator::GetNextStatistics([Out] Pack
return result;
}
PacketCommunicatorReceiveResult PacketCommunicator::GetStatistics(int numStatistics, HandleStatistics^ callBack)
PacketCommunicatorReceiveResult PacketCommunicator::ReceiveStatistics(int numStatistics, HandleStatistics^ callBack)
{
AssertMode(PacketCommunicatorMode::Statistics);
......
......@@ -72,13 +72,13 @@ namespace PcapDotNet { namespace Core
void SetSamplingMethod(SamplingMethod^ method);
delegate void HandlePacket(Packets::Packet^ packet);
PacketCommunicatorReceiveResult GetPacket([System::Runtime::InteropServices::Out] Packets::Packet^% packet);
PacketCommunicatorReceiveResult GetSomePackets([System::Runtime::InteropServices::Out] int% numPacketsGot, int maxPackets, HandlePacket^ callBack);
PacketCommunicatorReceiveResult GetPackets(int numPackets, HandlePacket^ callBack);
PacketCommunicatorReceiveResult ReceivePacket([System::Runtime::InteropServices::Out] Packets::Packet^% packet);
PacketCommunicatorReceiveResult ReceiveSomePackets([System::Runtime::InteropServices::Out] int% numPacketsGot, int maxPackets, HandlePacket^ callBack);
PacketCommunicatorReceiveResult ReceivePackets(int numPackets, HandlePacket^ callBack);
delegate void HandleStatistics(PacketSampleStatistics^ statistics);
PacketCommunicatorReceiveResult GetNextStatistics([System::Runtime::InteropServices::Out] PacketSampleStatistics^% statistics);
PacketCommunicatorReceiveResult GetStatistics(int numStatistics, HandleStatistics^ callBack);
PacketCommunicatorReceiveResult ReceiveStatistics([System::Runtime::InteropServices::Out] PacketSampleStatistics^% statistics);
PacketCommunicatorReceiveResult ReceiveStatistics(int numStatistics, HandleStatistics^ callBack);
void Break();
......
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