Commit b291c846 authored by Brickner_cp's avatar Brickner_cp

--no commit message

--no commit message
parent 8926ae19
......@@ -18,13 +18,13 @@ namespace WinPcapDotNet.Console
static void Main(string[] args)
{
System.Console.WriteLine("Start");
IList<PcapLiveDevice> devices = PcapLiveDevice.AllLocalMachine;
IList<LivePacketDevice> devices = LivePacketDevice.AllLocalMachine;
if (devices.Count == 0)
return;
for (int i = 0; i != devices.Count; ++i)
{
PcapLiveDevice device = devices[i];
LivePacketDevice device = devices[i];
System.Console.WriteLine(i+1 + ". " + device.Name);
}
int index;
......@@ -38,7 +38,7 @@ namespace WinPcapDotNet.Console
const string filename = @"c:\tmp.pcap";
const string filter = "port 80";
IPcapDevice chosenDevice = devices[index];
IPacketDevice chosenDevice = devices[index];
System.Console.WriteLine("Start GetNextPackets");
GetNextPackets(chosenDevice, filter);
......@@ -65,9 +65,9 @@ namespace WinPcapDotNet.Console
System.Console.WriteLine("Finished Transmitting packets");
}
private static void GetNextPackets(IPcapDevice device, string filter)
private static void GetNextPackets(IPacketDevice device, string filter)
{
using (PcapDeviceHandler deviceHandler = device.Open(PcapDevice.DefaultSnapshotLength, PcapDeviceOpenFlags.Promiscuous, 10 * 1000))
using (PacketCommunicator deviceHandler = device.Open(PacketDevice.DefaultSnapshotLength, PacketDeviceOpenFlags.Promiscuous, 10 * 1000))
{
System.Console.WriteLine("datalink = " + deviceHandler.DataLink.Name + " description = " + deviceHandler.DataLink.Description);
//foreach (PcapDataLink datalink in deviceHandler.SupportedDataLinks)
......@@ -80,21 +80,21 @@ namespace WinPcapDotNet.Console
" timestamp and " + packet.Length + " size"),
out numPacketsGot);
PcapTotalStatistics statistics = deviceHandler.TotalStatistics;
PacketTotalStatistics statistics = deviceHandler.TotalStatistics;
System.Console.WriteLine(statistics.ToString());
}
}
private static void StatisticsMode(IPcapDevice device, string filter)
private static void StatisticsMode(IPacketDevice device, string filter)
{
using (PcapDeviceHandler deviceHandler = device.Open())
using (PacketCommunicator deviceHandler = device.Open())
{
deviceHandler.SetFilter(filter);
deviceHandler.Mode = DeviceHandlerMode.Statistics;
for (int i = 0; i != 10; ++i)
{
PcapSampleStatistics statistics;
PacketSampleStatistics statistics;
DeviceHandlerResult result = deviceHandler.GetNextStatistics(out statistics);
switch (result)
{
......@@ -111,12 +111,12 @@ namespace WinPcapDotNet.Console
}
}
private static void TransmitPacketsFromFile(string filename, IPcapDevice liveDevice)
private static void TransmitPacketsFromFile(string filename, IPacketDevice liveDevice)
{
IPcapDevice offlineDevice = new PcapOfflineDevice(filename);
using (PcapSendQueue sendQueue = new PcapSendQueue(1024 * 1024))
IPacketDevice offlineDevice = new OfflinePacketDevice(filename);
using (PacketSendQueue sendQueue = new PacketSendQueue(1024 * 1024))
{
using (PcapDeviceHandler offlineHandler = offlineDevice.Open())
using (PacketCommunicator offlineHandler = offlineDevice.Open())
{
for (int i = 0; i != 100; ++i)
{
......@@ -136,19 +136,19 @@ namespace WinPcapDotNet.Console
}
}
using (PcapDeviceHandler liveHandler = liveDevice.Open())
using (PacketCommunicator liveHandler = liveDevice.Open())
{
sendQueue.Transmit(liveHandler, true);
}
}
}
private static void SendPacketsFromFile(string filename, IPcapDevice liveDevice)
private static void SendPacketsFromFile(string filename, IPacketDevice liveDevice)
{
IPcapDevice offlineDevice = new PcapOfflineDevice(filename);
using (PcapDeviceHandler liveHandler = liveDevice.Open())
IPacketDevice offlineDevice = new OfflinePacketDevice(filename);
using (PacketCommunicator liveHandler = liveDevice.Open())
{
using (PcapDeviceHandler offlineHandler = offlineDevice.Open())
using (PacketCommunicator offlineHandler = offlineDevice.Open())
{
for (int i = 0; i != 100; ++i)
{
......@@ -170,12 +170,12 @@ namespace WinPcapDotNet.Console
}
}
private static void CapturePacketsToFile(IPcapDevice device, string filter, string filename)
private static void CapturePacketsToFile(IPacketDevice device, string filter, string filename)
{
using (PcapDeviceHandler liveHandler = device.Open())
using (PacketCommunicator liveHandler = device.Open())
{
liveHandler.SetFilter(filter);
PcapDumpFile dumpFile = liveHandler.OpenDump(filename);
PacketDumpFile dumpFile = liveHandler.OpenDump(filename);
for (int i = 0; i != 100; ++i)
{
Packet packet;
......
......@@ -66,7 +66,7 @@ namespace PcapDotNet.Core.Test
const string DestinationMac = "77:88:99:AA:BB:CC";
const int NumPacketsToSend = 10;
using (PcapDeviceHandler deviceHandler = OpenLiveDevice())
using (PacketCommunicator deviceHandler = OpenLiveDevice())
{
deviceHandler.SetFilter("ether src " + SourceMac + " and ether dst " + DestinationMac);
......@@ -93,17 +93,17 @@ namespace PcapDotNet.Core.Test
}
}
private static PcapDeviceHandler OpenLiveDevice()
private static PacketCommunicator OpenLiveDevice()
{
IList<PcapLiveDevice> devices = PcapLiveDevice.AllLocalMachine;
IList<LivePacketDevice> devices = LivePacketDevice.AllLocalMachine;
MoreAssert.IsBiggerOrEqual(1, devices.Count);
PcapLiveDevice device = devices[0];
LivePacketDevice device = devices[0];
Assert.AreEqual("Network adapter 'Atheros AR8121/AR8113 PCI-E Ethernet Controller (Microsoft's Packet Scheduler) ' on local host", device.Description);
Assert.AreEqual(DeviceFlags.None, device.Flags);
Assert.AreEqual(1, device.Addresses.Count);
PcapAddress address = device.Addresses[0];
DeviceAddress address = device.Addresses[0];
Assert.AreEqual("Address: INET 10.0.0.2 Netmask: INET 255.0.0.0 Broadcast: INET 255.255.255.255", address.ToString());
PcapDeviceHandler deviceHandler = device.Open();
PacketCommunicator deviceHandler = device.Open();
try
{
Assert.AreEqual(DataLinkKind.Ethernet, deviceHandler.DataLink.Kind);
......@@ -112,8 +112,8 @@ namespace PcapDotNet.Core.Test
Assert.IsTrue(deviceHandler.IsFileSystemByteOrder);
Assert.AreEqual(DeviceHandlerMode.Capture, deviceHandler.Mode);
Assert.IsFalse(deviceHandler.NonBlocking);
Assert.AreEqual(PcapDevice.DefaultSnapshotLength, deviceHandler.SnapshotLength);
Assert.AreEqual(new PcapTotalStatistics(0, 0, 0, 0), deviceHandler.TotalStatistics);
Assert.AreEqual(PacketDevice.DefaultSnapshotLength, deviceHandler.SnapshotLength);
Assert.AreEqual(new PacketTotalStatistics(0, 0, 0, 0), deviceHandler.TotalStatistics);
return deviceHandler;
}
catch (Exception)
......
#include "BpfFilter.h"
#include "BerkeleyPacketFilter.h"
#include "Pcap.h"
#include "MarshalingServices.h"
#include "PcapError.h"
......@@ -6,7 +6,7 @@
using namespace System;
using namespace PcapDotNet::Core;
BpfFilter::BpfFilter(pcap_t* pcapDescriptor, String^ filterString, IpV4SocketAddress^ netmask)
BerkeleyPacketFilter::BerkeleyPacketFilter(pcap_t* pcapDescriptor, String^ filterString, IpV4SocketAddress^ netmask)
{
std::string unmanagedFilterString = MarshalingServices::ManagedToUnmanagedString(filterString);
......@@ -30,14 +30,14 @@ BpfFilter::BpfFilter(pcap_t* pcapDescriptor, String^ filterString, IpV4SocketAdd
}
}
void BpfFilter::SetFilter(pcap_t* pcapDescriptor)
void BerkeleyPacketFilter::SetFilter(pcap_t* pcapDescriptor)
{
if (pcap_setfilter(pcapDescriptor, _bpf) != 0)
throw PcapError::BuildInvalidOperation("Failed setting bpf filter", pcapDescriptor);
}
BpfFilter::~BpfFilter()
BerkeleyPacketFilter::~BerkeleyPacketFilter()
{
pcap_freecode(_bpf);
delete _bpf;
......
......@@ -5,14 +5,14 @@
namespace PcapDotNet { namespace Core
{
public ref class BpfFilter : System::IDisposable
public ref class BerkeleyPacketFilter : System::IDisposable
{
public:
BpfFilter(pcap_t* pcapDescriptor, System::String^ filterString, IpV4SocketAddress^ netmask);
BerkeleyPacketFilter(pcap_t* pcapDescriptor, System::String^ filterString, IpV4SocketAddress^ netmask);
void SetFilter(pcap_t* pcapDescriptor);
~BpfFilter(); // IDisposable
~BerkeleyPacketFilter(); // IDisposable
private:
bpf_program* _bpf;
......
#include "PcapAddress.h"
#include "DeviceAddress.h"
#include "IpV4SocketAddress.h"
#include "Pcap.h"
......@@ -6,7 +6,7 @@ using namespace System;
using namespace System::Text;
using namespace PcapDotNet::Core;
PcapAddress::PcapAddress(pcap_addr_t* pcapAddress)
DeviceAddress::DeviceAddress(pcap_addr_t* pcapAddress)
{
SocketAddressFamily family = safe_cast<SocketAddressFamily>(pcapAddress->addr->sa_family);
......@@ -53,27 +53,27 @@ PcapAddress::PcapAddress(pcap_addr_t* pcapAddress)
}
}
SocketAddress^ PcapAddress::Address::get()
SocketAddress^ DeviceAddress::Address::get()
{
return _address;
}
SocketAddress^ PcapAddress::Netmask::get()
SocketAddress^ DeviceAddress::Netmask::get()
{
return _netmask;
}
SocketAddress^ PcapAddress::Broadcast::get()
SocketAddress^ DeviceAddress::Broadcast::get()
{
return _broadcast;
}
SocketAddress^ PcapAddress::Destination::get()
SocketAddress^ DeviceAddress::Destination::get()
{
return _destination;
}
String^ PcapAddress::ToString()
String^ DeviceAddress::ToString()
{
StringBuilder^ result = gcnew StringBuilder();
......@@ -86,7 +86,7 @@ String^ PcapAddress::ToString()
}
// static
void PcapAddress::AppendSocketAddressString(StringBuilder^ stringBuilder, SocketAddress^ socketAddress, String^ title)
void DeviceAddress::AppendSocketAddressString(StringBuilder^ stringBuilder, SocketAddress^ socketAddress, String^ title)
{
if (socketAddress != nullptr)
{
......
......@@ -5,10 +5,10 @@
namespace PcapDotNet { namespace Core
{
public ref class PcapAddress
public ref class DeviceAddress
{
public:
PcapAddress(pcap_addr_t *pcapAddress);
DeviceAddress(pcap_addr_t *pcapAddress);
property SocketAddress^ Address
{
......
#pragma once
#include "PcapAddress.h"
#include "PcapDeviceHandler.h"
#include "DeviceAddress.h"
#include "PacketCommunicator.h"
namespace PcapDotNet { namespace Core
{
......@@ -12,14 +12,14 @@ namespace PcapDotNet { namespace Core
LoopBack = 0x00000001
};
public interface class IPcapDevice
public interface class IPacketDevice
{
property System::String^ Name { System::String^ get(); };
property System::String^ Description { System::String^ get(); };
property DeviceFlags^ Flags { DeviceFlags^ get(); };
property System::Collections::ObjectModel::ReadOnlyCollection<PcapAddress^>^ Addresses
property System::Collections::ObjectModel::ReadOnlyCollection<DeviceAddress^>^ Addresses
{
System::Collections::ObjectModel::ReadOnlyCollection<PcapAddress^>^ get();
System::Collections::ObjectModel::ReadOnlyCollection<DeviceAddress^>^ get();
}
/// <summary>
......@@ -28,12 +28,12 @@ namespace PcapDotNet { namespace Core
/// <param name="snapshotLength">length of the packet that has to be retained. For each packet received by the filter, only the first 'snapshotLength' bytes are stored in the buffer and passed to the user application. For instance, snaplen equal to 100 means that only the first 100 bytes of each packet are stored.</param>
/// <param name="flags">keeps several flags that can be needed for capturing packets.</param>
/// <param name="flags">read timeout in milliseconds. The read timeout is used to arrange that the read not necessarily return immediately when a packet is seen, but that it waits for some amount of time to allow more packets to arrive and to read multiple packets from the OS kernel in one operation. Not all platforms support a read timeout; on platforms that don't, the read timeout is ignored.</param>
PcapDeviceHandler^ Open(int snapshotLength, PcapDeviceOpenFlags flags, int readTimeout);
PacketCommunicator^ Open(int snapshotLength, PacketDeviceOpenFlags flags, int readTimeout);
/// <summary>
/// Open a generic source in order to capture / send (WinPcap only) traffic.
/// Uses maxmimum snapshotLength (65536), promiscuous mode and 1 second read timeout.
/// </summary>
PcapDeviceHandler^ Open();
PacketCommunicator^ Open();
};
}}
\ No newline at end of file
#include "PcapLiveDevice.h"
#include "LivePacketDevice.h"
#include <string>
......@@ -11,7 +11,7 @@ using namespace System::Collections::ObjectModel;
using namespace BPacket;
using namespace PcapDotNet::Core;
ReadOnlyCollection<PcapLiveDevice^>^ PcapLiveDevice::AllLocalMachine::get()
ReadOnlyCollection<LivePacketDevice^>^ LivePacketDevice::AllLocalMachine::get()
{
pcap_if_t *alldevs;
char errbuf[PCAP_ERRBUF_SIZE];
......@@ -26,23 +26,23 @@ ReadOnlyCollection<PcapLiveDevice^>^ PcapLiveDevice::AllLocalMachine::get()
try
{
List<PcapLiveDevice^>^ result = gcnew List<PcapLiveDevice^>();
List<LivePacketDevice^>^ result = gcnew List<LivePacketDevice^>();
for (pcap_if_t *d = alldevs; d != NULL; d = d->next)
{
// IP addresses
List<PcapAddress^>^ addresses = gcnew List<PcapAddress^>();
List<DeviceAddress^>^ addresses = gcnew List<DeviceAddress^>();
for (pcap_addr_t *a = d->addresses; a; a = a->next)
{
PcapAddress^ deviceAddress = gcnew PcapAddress(a);
DeviceAddress^ deviceAddress = gcnew DeviceAddress(a);
addresses->Add(deviceAddress);
}
result->Add(gcnew PcapLiveDevice(gcnew String(d->name),
result->Add(gcnew LivePacketDevice(gcnew String(d->name),
gcnew String(d->description),
safe_cast<DeviceFlags>(d->flags),
gcnew ReadOnlyCollection<PcapAddress^>(addresses)));
gcnew ReadOnlyCollection<DeviceAddress^>(addresses)));
}
return gcnew ReadOnlyCollection<PcapLiveDevice^>(result);
return gcnew ReadOnlyCollection<LivePacketDevice^>(result);
}
finally
{
......@@ -51,27 +51,27 @@ ReadOnlyCollection<PcapLiveDevice^>^ PcapLiveDevice::AllLocalMachine::get()
}
}
String^ PcapLiveDevice::Name::get()
String^ LivePacketDevice::Name::get()
{
return _name;
}
String^ PcapLiveDevice::Description::get()
String^ LivePacketDevice::Description::get()
{
return _description;
}
DeviceFlags^ PcapLiveDevice::Flags::get()
DeviceFlags^ LivePacketDevice::Flags::get()
{
return _flags;
}
ReadOnlyCollection<PcapAddress^>^ PcapLiveDevice::Addresses::get()
ReadOnlyCollection<DeviceAddress^>^ LivePacketDevice::Addresses::get()
{
return gcnew ReadOnlyCollection<PcapAddress^>(_addresses);
return gcnew ReadOnlyCollection<DeviceAddress^>(_addresses);
}
PcapDeviceHandler^ PcapLiveDevice::Open(int snapshotLength, PcapDeviceOpenFlags flags, int readTimeout)
PacketCommunicator^ LivePacketDevice::Open(int snapshotLength, PacketDeviceOpenFlags flags, int readTimeout)
{
std::string deviceName = MarshalingServices::ManagedToUnmanagedString(Name);
......@@ -81,12 +81,12 @@ PcapDeviceHandler^ PcapLiveDevice::Open(int snapshotLength, PcapDeviceOpenFlags
netmask = Addresses[0]->Netmask;
// Open the device
return gcnew PcapDeviceHandler(deviceName.c_str(), snapshotLength, flags, readTimeout, NULL, netmask);
return gcnew PacketCommunicator(deviceName.c_str(), snapshotLength, flags, readTimeout, NULL, netmask);
}
// Private Methods
PcapLiveDevice::PcapLiveDevice(String^ name, String^ description, DeviceFlags^ flags, ReadOnlyCollection<PcapAddress^>^ addresses)
LivePacketDevice::LivePacketDevice(String^ name, String^ description, DeviceFlags^ flags, ReadOnlyCollection<DeviceAddress^>^ addresses)
{
_name = name;
_description = description;
......
#pragma once
#include "PcapDevice.h"
#include "PacketDevice.h"
namespace PcapDotNet { namespace Core
{
public ref class PcapLiveDevice : PcapDevice
public ref class LivePacketDevice : PacketDevice
{
public:
static property System::Collections::ObjectModel::ReadOnlyCollection<PcapLiveDevice^>^ AllLocalMachine
static property System::Collections::ObjectModel::ReadOnlyCollection<LivePacketDevice^>^ AllLocalMachine
{
System::Collections::ObjectModel::ReadOnlyCollection<PcapLiveDevice^>^ get();
System::Collections::ObjectModel::ReadOnlyCollection<LivePacketDevice^>^ get();
}
virtual property System::String^ Name
......@@ -27,9 +27,9 @@ namespace PcapDotNet { namespace Core
DeviceFlags^ get() override;
}
virtual property System::Collections::ObjectModel::ReadOnlyCollection<PcapAddress^>^ Addresses
virtual property System::Collections::ObjectModel::ReadOnlyCollection<DeviceAddress^>^ Addresses
{
System::Collections::ObjectModel::ReadOnlyCollection<PcapAddress^>^ get() override;
System::Collections::ObjectModel::ReadOnlyCollection<DeviceAddress^>^ get() override;
}
/// <summary>
......@@ -38,15 +38,15 @@ namespace PcapDotNet { namespace Core
/// <param name="snapshotLength">length of the packet that has to be retained. For each packet received by the filter, only the first 'snapshotLength' bytes are stored in the buffer and passed to the user application. For instance, snaplen equal to 100 means that only the first 100 bytes of each packet are stored.</param>
/// <param name="flags">keeps several flags that can be needed for capturing packets.</param>
/// <param name="flags">read timeout in milliseconds. The read timeout is used to arrange that the read not necessarily return immediately when a packet is seen, but that it waits for some amount of time to allow more packets to arrive and to read multiple packets from the OS kernel in one operation. Not all platforms support a read timeout; on platforms that don't, the read timeout is ignored.</param>
virtual PcapDeviceHandler^ Open(int snapshotLength, PcapDeviceOpenFlags flags, int readTimeout) override;
virtual PacketCommunicator^ Open(int snapshotLength, PacketDeviceOpenFlags flags, int readTimeout) override;
private:
PcapLiveDevice(System::String^ name, System::String^ description, DeviceFlags^ flags, System::Collections::ObjectModel::ReadOnlyCollection<PcapAddress^>^ addresses);
LivePacketDevice(System::String^ name, System::String^ description, DeviceFlags^ flags, System::Collections::ObjectModel::ReadOnlyCollection<DeviceAddress^>^ addresses);
private:
System::String^ _name;
System::String^ _description;
DeviceFlags^ _flags;
System::Collections::ObjectModel::ReadOnlyCollection<PcapAddress^>^ _addresses;
System::Collections::ObjectModel::ReadOnlyCollection<DeviceAddress^>^ _addresses;
};
}}
\ No newline at end of file
#include "PcapOfflineDevice.h"
#include "OfflinePacketDevice.h"
#include <string>
......@@ -10,32 +10,32 @@ using namespace System::Collections::Generic;
using namespace System::Collections::ObjectModel;
using namespace PcapDotNet::Core;
PcapOfflineDevice::PcapOfflineDevice(System::String^ filename)
OfflinePacketDevice::OfflinePacketDevice(System::String^ filename)
{
_filename = filename;
}
String^ PcapOfflineDevice::Name::get()
String^ OfflinePacketDevice::Name::get()
{
return _filename;
}
String^ PcapOfflineDevice::Description::get()
String^ OfflinePacketDevice::Description::get()
{
return String::Empty;
}
DeviceFlags^ PcapOfflineDevice::Flags::get()
DeviceFlags^ OfflinePacketDevice::Flags::get()
{
return DeviceFlags::None;
}
ReadOnlyCollection<PcapAddress^>^ PcapOfflineDevice::Addresses::get()
ReadOnlyCollection<DeviceAddress^>^ OfflinePacketDevice::Addresses::get()
{
return gcnew ReadOnlyCollection<PcapAddress^>(gcnew List<PcapAddress^>());
return gcnew ReadOnlyCollection<DeviceAddress^>(gcnew List<DeviceAddress^>());
}
PcapDeviceHandler^ PcapOfflineDevice::Open(int snapshotLength, PcapDeviceOpenFlags flags, int readTimeout)
PacketCommunicator^ OfflinePacketDevice::Open(int snapshotLength, PacketDeviceOpenFlags flags, int readTimeout)
{
std::string unamangedFilename = MarshalingServices::ManagedToUnmanagedString(_filename);
......@@ -53,5 +53,5 @@ PcapDeviceHandler^ PcapOfflineDevice::Open(int snapshotLength, PcapDeviceOpenFla
throw gcnew InvalidOperationException("Error creating a source string from filename " + _filename + " Error: " + gcnew String(errbuf));
}
return gcnew PcapDeviceHandler(source, snapshotLength, flags, readTimeout, NULL, nullptr);
return gcnew PacketCommunicator(source, snapshotLength, flags, readTimeout, NULL, nullptr);
}
#pragma once
#include "PcapDevice.h"
#include "PacketDevice.h"
namespace PcapDotNet { namespace Core
{
public ref class PcapOfflineDevice : PcapDevice
public ref class OfflinePacketDevice : PacketDevice
{
public:
PcapOfflineDevice(System::String^ filename);
OfflinePacketDevice(System::String^ filename);
virtual property System::String^ Name
{
......@@ -24,12 +24,12 @@ namespace PcapDotNet { namespace Core
DeviceFlags^ get() override;
}
virtual property System::Collections::ObjectModel::ReadOnlyCollection<PcapAddress^>^ Addresses
virtual property System::Collections::ObjectModel::ReadOnlyCollection<DeviceAddress^>^ Addresses
{
System::Collections::ObjectModel::ReadOnlyCollection<PcapAddress^>^ get() override;
System::Collections::ObjectModel::ReadOnlyCollection<DeviceAddress^>^ get() override;
}
virtual PcapDeviceHandler^ Open(int snapshotLength, PcapDeviceOpenFlags flags, int readTimeout) override;
virtual PacketCommunicator^ Open(int snapshotLength, PacketDeviceOpenFlags flags, int readTimeout) override;
private:
System::String^ _filename;
......
#include "PcapDeviceHandler.h"
#include "PacketCommunicator.h"
#include "MarshalingServices.h"
#include "PcapDumpFile.h"
#include "PacketDumpFile.h"
#include "Timestamp.h"
#include "PcapError.h"
#include "Pcap.h"
......@@ -15,7 +15,7 @@ using namespace PcapDotNet::Core;
void packet_handler(u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data);
PcapDeviceHandler::PcapDeviceHandler(const char* source, int snapshotLength, PcapDeviceOpenFlags flags, int readTimeout, pcap_rmtauth *auth, SocketAddress^ netmask)
PacketCommunicator::PacketCommunicator(const char* source, int snapshotLength, PacketDeviceOpenFlags flags, int readTimeout, pcap_rmtauth *auth, SocketAddress^ netmask)
{
// Open the device
char errbuf[PCAP_ERRBUF_SIZE];
......@@ -36,18 +36,18 @@ PcapDeviceHandler::PcapDeviceHandler(const char* source, int snapshotLength, Pca
_ipV4Netmask = dynamic_cast<IpV4SocketAddress^>(netmask);
}
PcapDataLink PcapDeviceHandler::DataLink::get()
PcapDataLink PacketCommunicator::DataLink::get()
{
return PcapDataLink(pcap_datalink(_pcapDescriptor));
}
void PcapDeviceHandler::DataLink::set(PcapDataLink value)
void PacketCommunicator::DataLink::set(PcapDataLink value)
{
if (pcap_set_datalink(_pcapDescriptor, value.Value) == -1)
throw BuildInvalidOperation("Failed setting datalink " + value.ToString());
}
ReadOnlyCollection<PcapDataLink>^ PcapDeviceHandler::SupportedDataLinks::get()
ReadOnlyCollection<PcapDataLink>^ PacketCommunicator::SupportedDataLinks::get()
{
throw gcnew NotSupportedException("Supported DataLinks is unsupported to avoid winpcap memory leak");
......@@ -71,27 +71,27 @@ ReadOnlyCollection<PcapDataLink>^ PcapDeviceHandler::SupportedDataLinks::get()
}
}
int PcapDeviceHandler::SnapshotLength::get()
int PacketCommunicator::SnapshotLength::get()
{
return pcap_snapshot(_pcapDescriptor);
}
bool PcapDeviceHandler::IsFileSystemByteOrder::get()
bool PacketCommunicator::IsFileSystemByteOrder::get()
{
return (pcap_is_swapped(_pcapDescriptor) == 0);
}
int PcapDeviceHandler::FileMajorVersion::get()
int PacketCommunicator::FileMajorVersion::get()
{
return pcap_major_version(_pcapDescriptor);
}
int PcapDeviceHandler::FileMinorVersion::get()
int PacketCommunicator::FileMinorVersion::get()
{
return pcap_minor_version(_pcapDescriptor);
}
PcapTotalStatistics^ PcapDeviceHandler::TotalStatistics::get()
PacketTotalStatistics^ PacketCommunicator::TotalStatistics::get()
{
int statisticsSize;
pcap_stat* statistics = pcap_stats_ex(_pcapDescriptor, &statisticsSize);
......@@ -104,23 +104,23 @@ PcapTotalStatistics^ PcapDeviceHandler::TotalStatistics::get()
unsigned int packetsCaptured = (statisticsSize >= 16
? *(reinterpret_cast<int*>(statistics) + 3)
: 0);
return gcnew PcapTotalStatistics(packetsReceived, packetsDroppedByDriver, packetsDroppedByInterface, packetsCaptured);
return gcnew PacketTotalStatistics(packetsReceived, packetsDroppedByDriver, packetsDroppedByInterface, packetsCaptured);
}
DeviceHandlerMode PcapDeviceHandler::Mode::get()
DeviceHandlerMode PacketCommunicator::Mode::get()
{
return _mode;
}
void PcapDeviceHandler::Mode::set(DeviceHandlerMode value)
void PacketCommunicator::Mode::set(DeviceHandlerMode value)
{
if (pcap_setmode(_pcapDescriptor, safe_cast<int>(value)) < 0)
throw BuildInvalidOperation("Error setting mode " + value.ToString());
_mode = value;
}
bool PcapDeviceHandler::NonBlocking::get()
bool PacketCommunicator::NonBlocking::get()
{
char errbuf[PCAP_ERRBUF_SIZE];
int nonBlockValue = pcap_getnonblock(_pcapDescriptor, errbuf);
......@@ -129,14 +129,14 @@ bool PcapDeviceHandler::NonBlocking::get()
return nonBlockValue != 0;
}
void PcapDeviceHandler::NonBlocking::set(bool value)
void PacketCommunicator::NonBlocking::set(bool value)
{
char errbuf[PCAP_ERRBUF_SIZE];
if (pcap_setnonblock(_pcapDescriptor, value, errbuf) != 0)
throw gcnew InvalidOperationException("Error setting NonBlocking to " + value.ToString());
}
DeviceHandlerResult PcapDeviceHandler::GetPacket([Out] Packet^% packet)
DeviceHandlerResult PacketCommunicator::GetPacket([Out] Packet^% packet)
{
AssertMode(DeviceHandlerMode::Capture);
......@@ -154,7 +154,7 @@ DeviceHandlerResult PcapDeviceHandler::GetPacket([Out] Packet^% packet)
return result;
}
DeviceHandlerResult PcapDeviceHandler::GetSomePackets(int maxPackets, HandlePacket^ callBack, [Out] int% numPacketsGot)
DeviceHandlerResult PacketCommunicator::GetSomePackets(int maxPackets, HandlePacket^ callBack, [Out] int% numPacketsGot)
{
AssertMode(DeviceHandlerMode::Capture);
......@@ -174,7 +174,7 @@ DeviceHandlerResult PcapDeviceHandler::GetSomePackets(int maxPackets, HandlePack
return DeviceHandlerResult::Ok;
}
DeviceHandlerResult PcapDeviceHandler::GetPackets(int numPackets, HandlePacket^ callBack)
DeviceHandlerResult PacketCommunicator::GetPackets(int numPackets, HandlePacket^ callBack)
{
AssertMode(DeviceHandlerMode::Capture);
......@@ -190,7 +190,7 @@ DeviceHandlerResult PcapDeviceHandler::GetPackets(int numPackets, HandlePacket^
return DeviceHandlerResult::Ok;
}
DeviceHandlerResult PcapDeviceHandler::GetNextStatistics([Out] PcapSampleStatistics^% statistics)
DeviceHandlerResult PacketCommunicator::GetNextStatistics([Out] PacketSampleStatistics^% statistics)
{
AssertMode(DeviceHandlerMode::Statistics);
......@@ -209,7 +209,7 @@ DeviceHandlerResult PcapDeviceHandler::GetNextStatistics([Out] PcapSampleStatist
return result;
}
void PcapDeviceHandler::SendPacket(Packet^ packet)
void PacketCommunicator::SendPacket(Packet^ packet)
{
pin_ptr<Byte> unamangedPacketBytes;
if (packet->Length != 0)
......@@ -219,46 +219,46 @@ void PcapDeviceHandler::SendPacket(Packet^ packet)
}
void PcapDeviceHandler::Transmit(PcapSendQueue^ sendQueue, bool isSync)
void PacketCommunicator::Transmit(PacketSendQueue^ sendQueue, bool isSync)
{
sendQueue->Transmit(_pcapDescriptor, isSync);
}
BpfFilter^ PcapDeviceHandler::CreateFilter(String^ filterString)
BerkeleyPacketFilter^ PacketCommunicator::CreateFilter(String^ filterString)
{
return gcnew BpfFilter(_pcapDescriptor, filterString, _ipV4Netmask);
return gcnew BerkeleyPacketFilter(_pcapDescriptor, filterString, _ipV4Netmask);
}
void PcapDeviceHandler::SetFilter(BpfFilter^ filter)
void PacketCommunicator::SetFilter(BerkeleyPacketFilter^ filter)
{
filter->SetFilter(_pcapDescriptor);
}
void PcapDeviceHandler::SetFilter(String^ filterString)
void PacketCommunicator::SetFilter(String^ filterString)
{
BpfFilter^ filter = CreateFilter(filterString);
BerkeleyPacketFilter^ filter = CreateFilter(filterString);
try
{
SetFilter(filter);
}
finally
{
filter->~BpfFilter();
filter->~BerkeleyPacketFilter();
}
}
PcapDumpFile^ PcapDeviceHandler::OpenDump(System::String^ filename)
PacketDumpFile^ PacketCommunicator::OpenDump(System::String^ filename)
{
return gcnew PcapDumpFile(_pcapDescriptor, filename);
return gcnew PacketDumpFile(_pcapDescriptor, filename);
}
PcapDeviceHandler::~PcapDeviceHandler()
PacketCommunicator::~PacketCommunicator()
{
pcap_close(_pcapDescriptor);
}
// static
Packet^ PcapDeviceHandler::CreatePacket(const pcap_pkthdr& packetHeader, const unsigned char* packetData, IDataLink^ dataLink)
Packet^ PacketCommunicator::CreatePacket(const pcap_pkthdr& packetHeader, const unsigned char* packetData, IDataLink^ dataLink)
{
DateTime timestamp;
Timestamp::PcapTimestampToDateTime(packetHeader.ts, timestamp);
......@@ -268,7 +268,7 @@ Packet^ PcapDeviceHandler::CreatePacket(const pcap_pkthdr& packetHeader, const u
}
// static
PcapSampleStatistics^ PcapDeviceHandler::CreateStatistics(const pcap_pkthdr& packetHeader, const unsigned char* packetData)
PacketSampleStatistics^ PacketCommunicator::CreateStatistics(const pcap_pkthdr& packetHeader, const unsigned char* packetData)
{
DateTime timestamp;
Timestamp::PcapTimestampToDateTime(packetHeader.ts, timestamp);
......@@ -276,10 +276,10 @@ PcapSampleStatistics^ PcapDeviceHandler::CreateStatistics(const pcap_pkthdr& pac
unsigned long acceptedPackets = *reinterpret_cast<const unsigned long*>(packetData);
unsigned long acceptedBytes = *reinterpret_cast<const unsigned long*>(packetData + 8);
return gcnew PcapSampleStatistics(timestamp, acceptedPackets, acceptedBytes);
return gcnew PacketSampleStatistics(timestamp, acceptedPackets, acceptedBytes);
}
DeviceHandlerResult PcapDeviceHandler::RunPcapNextEx(pcap_pkthdr** packetHeader, const unsigned char** packetData)
DeviceHandlerResult PacketCommunicator::RunPcapNextEx(pcap_pkthdr** packetHeader, const unsigned char** packetData)
{
int result = pcap_next_ex(_pcapDescriptor, packetHeader, packetData);
switch (result)
......@@ -297,28 +297,28 @@ DeviceHandlerResult PcapDeviceHandler::RunPcapNextEx(pcap_pkthdr** packetHeader,
}
}
void PcapDeviceHandler::AssertMode(DeviceHandlerMode mode)
void PacketCommunicator::AssertMode(DeviceHandlerMode mode)
{
if (Mode != mode)
throw gcnew InvalidOperationException("Wrong Mode. Must be in mode " + mode.ToString() + " and not in mode " + Mode.ToString());
}
String^ PcapDeviceHandler::ErrorMessage::get()
String^ PacketCommunicator::ErrorMessage::get()
{
return PcapError::GetErrorMessage(_pcapDescriptor);
}
InvalidOperationException^ PcapDeviceHandler::BuildInvalidOperation(System::String^ errorMessage)
InvalidOperationException^ PacketCommunicator::BuildInvalidOperation(System::String^ errorMessage)
{
return PcapError::BuildInvalidOperation(errorMessage, _pcapDescriptor);
}
void PcapDeviceHandler::PacketHandler::Handle(unsigned char *user, const struct pcap_pkthdr *packetHeader, const unsigned char *packetData)
void PacketCommunicator::PacketHandler::Handle(unsigned char *user, const struct pcap_pkthdr *packetHeader, const unsigned char *packetData)
{
_callBack->Invoke(CreatePacket(*packetHeader, packetData, _dataLink));
}
void PcapDeviceHandler::StatisticsHandler::Handle(unsigned char *user, const struct pcap_pkthdr *packetHeader, const unsigned char *packetData)
void PacketCommunicator::StatisticsHandler::Handle(unsigned char *user, const struct pcap_pkthdr *packetHeader, const unsigned char *packetData)
{
_callBack->Invoke(CreateStatistics(*packetHeader, packetData));
}
\ No newline at end of file
#pragma once
#include "PcapAddress.h"
#include "BpfFilter.h"
#include "PcapDumpFile.h"
#include "PcapDeviceOpenFlags.h"
#include "PcapSampleStatistics.h"
#include "PcapTotalStatistics.h"
#include "DeviceAddress.h"
#include "BerkeleyPacketFilter.h"
#include "PacketDumpFile.h"
#include "PacketDeviceOpenFlags.h"
#include "PacketSampleStatistics.h"
#include "PacketTotalStatistics.h"
#include "PcapDataLink.h"
#include "PcapSendQueue.h"
#include "PacketSendQueue.h"
namespace PcapDotNet { namespace Core
{
......@@ -27,10 +27,10 @@ namespace PcapDotNet { namespace Core
KernelDump = 0x10 // Kernel dump working mode.
};
public ref class PcapDeviceHandler : System::IDisposable
public ref class PacketCommunicator : System::IDisposable
{
public:
PcapDeviceHandler(const char* source, int snapshotLength, PcapDeviceOpenFlags flags, int readTimeout, pcap_rmtauth *auth,
PacketCommunicator(const char* source, int snapshotLength, PacketDeviceOpenFlags flags, int readTimeout, pcap_rmtauth *auth,
SocketAddress^ netmask);
property PcapDataLink DataLink
......@@ -64,9 +64,9 @@ namespace PcapDotNet { namespace Core
int get();
}
property PcapTotalStatistics^ TotalStatistics
property PacketTotalStatistics^ TotalStatistics
{
PcapTotalStatistics^ get();
PacketTotalStatistics^ get();
}
property DeviceHandlerMode Mode
......@@ -86,23 +86,23 @@ namespace PcapDotNet { namespace Core
DeviceHandlerResult GetSomePackets(int maxPackets, HandlePacket^ callBack, [System::Runtime::InteropServices::Out] int% numPacketsGot);
DeviceHandlerResult GetPackets(int numPackets, HandlePacket^ callBack);
delegate void HandleStatistics(PcapSampleStatistics^ statistics);
DeviceHandlerResult GetNextStatistics([System::Runtime::InteropServices::Out] PcapSampleStatistics^% statistics);
delegate void HandleStatistics(PacketSampleStatistics^ statistics);
DeviceHandlerResult GetNextStatistics([System::Runtime::InteropServices::Out] PacketSampleStatistics^% statistics);
void SendPacket(BPacket::Packet^ packet);
void Transmit(PcapSendQueue^ sendQueue, bool isSync);
void Transmit(PacketSendQueue^ sendQueue, bool isSync);
BpfFilter^ CreateFilter(System::String^ filterString);
void SetFilter(BpfFilter^ filter);
BerkeleyPacketFilter^ CreateFilter(System::String^ filterString);
void SetFilter(BerkeleyPacketFilter^ filter);
void SetFilter(System::String^ filterString);
PcapDumpFile^ OpenDump(System::String^ filename);
PacketDumpFile^ OpenDump(System::String^ filename);
~PcapDeviceHandler();
~PacketCommunicator();
private:
static BPacket::Packet^ CreatePacket(const pcap_pkthdr& packetHeader, const unsigned char* packetData, BPacket::IDataLink^ dataLink);
static PcapSampleStatistics^ PcapDeviceHandler::CreateStatistics(const pcap_pkthdr& packetHeader, const unsigned char* packetData);
static PacketSampleStatistics^ PacketCommunicator::CreateStatistics(const pcap_pkthdr& packetHeader, const unsigned char* packetData);
DeviceHandlerResult RunPcapNextEx(pcap_pkthdr** packetHeader, const unsigned char** packetData);
......
#include "PacketDevice.h"
using namespace PcapDotNet::Core;
PacketCommunicator^ PacketDevice::Open()
{
return Open(DefaultSnapshotLength, PacketDeviceOpenFlags::Promiscuous, 1000);
}
#pragma once
#include "IPcapDevice.h"
#include "IPacketDevice.h"
namespace PcapDotNet { namespace Core
{
public ref class PcapDevice abstract : IPcapDevice
public ref class PacketDevice abstract : IPacketDevice
{
public:
static const int DefaultSnapshotLength = 65536;
......@@ -24,13 +24,13 @@ namespace PcapDotNet { namespace Core
DeviceFlags^ get() = 0;
}
virtual property System::Collections::ObjectModel::ReadOnlyCollection<PcapAddress^>^ Addresses
virtual property System::Collections::ObjectModel::ReadOnlyCollection<DeviceAddress^>^ Addresses
{
System::Collections::ObjectModel::ReadOnlyCollection<PcapAddress^>^ get() = 0;
System::Collections::ObjectModel::ReadOnlyCollection<DeviceAddress^>^ get() = 0;
}
virtual PcapDeviceHandler^ Open(int snapshotLength, PcapDeviceOpenFlags flags, int readTimeout) = 0;
virtual PacketCommunicator^ Open(int snapshotLength, PacketDeviceOpenFlags flags, int readTimeout) = 0;
virtual PcapDeviceHandler^ Open();
virtual PacketCommunicator^ Open();
};
}}
\ No newline at end of file
......@@ -3,7 +3,7 @@
namespace PcapDotNet { namespace Core
{
[System::Flags]
public enum class PcapDeviceOpenFlags : System::Int32
public enum class PacketDeviceOpenFlags : System::Int32
{
None = 0,
Promiscuous = 1, // Defines if the adapter has to go in promiscuous mode.
......
#include "PcapDumpFile.h"
#include "PacketDumpFile.h"
#include "Timestamp.h"
#include "PacketHeader.h"
#include "MarshalingServices.h"
......@@ -9,7 +9,7 @@ using namespace System;
using namespace PcapDotNet::Core;
using namespace BPacket;
void PcapDumpFile::Dump(Packet^ packet)
void PacketDumpFile::Dump(Packet^ packet)
{
pcap_pkthdr header;
PacketHeader::GetPcapHeader(header, packet);
......@@ -19,13 +19,13 @@ void PcapDumpFile::Dump(Packet^ packet)
pcap_dump(reinterpret_cast<unsigned char*>(_pcapDumper), &header, unamangedPacketBytes);
}
void PcapDumpFile::Flush()
void PacketDumpFile::Flush()
{
if (pcap_dump_flush(_pcapDumper) != 0)
throw gcnew InvalidOperationException("Failed flusing to file " + _filename);
}
long PcapDumpFile::Position::get()
long PacketDumpFile::Position::get()
{
long position = pcap_dump_ftell(_pcapDumper);
if (position == -1)
......@@ -33,14 +33,14 @@ long PcapDumpFile::Position::get()
return position;
}
PcapDumpFile::~PcapDumpFile()
PacketDumpFile::~PacketDumpFile()
{
pcap_dump_close(_pcapDumper);
}
// internal
PcapDumpFile::PcapDumpFile(pcap_t* pcapDescriptor, System::String^ filename)
PacketDumpFile::PacketDumpFile(pcap_t* pcapDescriptor, System::String^ filename)
{
_filename = filename;
std::string unmanagedString = MarshalingServices::ManagedToUnmanagedString(_filename);
......
......@@ -4,7 +4,7 @@
namespace PcapDotNet { namespace Core
{
public ref class PcapDumpFile : System::IDisposable
public ref class PacketDumpFile : System::IDisposable
{
public:
void Dump(BPacket::Packet^ packet);
......@@ -16,10 +16,10 @@ namespace PcapDotNet { namespace Core
long get();
}
~PcapDumpFile();
~PacketDumpFile();
internal:
PcapDumpFile(pcap_t* pcapDescriptor, System::String^ filename);
PacketDumpFile(pcap_t* pcapDescriptor, System::String^ filename);
private:
pcap_dumper_t* _pcapDumper;
......
#include "PcapSampleStatistics.h"
#include "PacketSampleStatistics.h"
using namespace System;
using namespace PcapDotNet::Core;
PcapSampleStatistics::PcapSampleStatistics(DateTime timestamp, unsigned long acceptedPackets, unsigned long acceptedBytes)
PacketSampleStatistics::PacketSampleStatistics(DateTime timestamp, unsigned long acceptedPackets, unsigned long acceptedBytes)
{
_timestamp = timestamp;
_acceptedPackets = acceptedPackets;
_acceptedBytes = acceptedBytes;
}
DateTime PcapSampleStatistics::Timestamp::get()
DateTime PacketSampleStatistics::Timestamp::get()
{
return _timestamp;
}
unsigned long PcapSampleStatistics::AcceptedPackets::get()
unsigned long PacketSampleStatistics::AcceptedPackets::get()
{
return _acceptedPackets;
}
unsigned long PcapSampleStatistics::AcceptedBytes::get()
unsigned long PacketSampleStatistics::AcceptedBytes::get()
{
return _acceptedBytes;
}
System::String^ PcapSampleStatistics::ToString()
System::String^ PacketSampleStatistics::ToString()
{
return _timestamp + ": " + AcceptedPackets + " packets. " + AcceptedBytes + " bytes.";
}
\ No newline at end of file
......@@ -2,10 +2,10 @@
namespace PcapDotNet { namespace Core
{
public ref class PcapSampleStatistics
public ref class PacketSampleStatistics
{
public:
PcapSampleStatistics(System::DateTime timestamp, unsigned long acceptedPackets, unsigned long acceptedBytes);
PacketSampleStatistics(System::DateTime timestamp, unsigned long acceptedPackets, unsigned long acceptedBytes);
property System::DateTime Timestamp
{
......
#include "PcapSendQueue.h"
#include "PacketSendQueue.h"
#include "PacketHeader.h"
#include "PcapError.h"
#include "Pcap.h"
......@@ -7,12 +7,12 @@ using namespace System;
using namespace PcapDotNet::Core;
using namespace BPacket;
PcapSendQueue::PcapSendQueue(unsigned int capacity)
PacketSendQueue::PacketSendQueue(unsigned int capacity)
{
_pcapSendQueue = pcap_sendqueue_alloc(capacity);
}
void PcapSendQueue::Enqueue(Packet^ packet)
void PacketSendQueue::Enqueue(Packet^ packet)
{
pcap_pkthdr pcapHeader;
PacketHeader::GetPcapHeader(pcapHeader, packet);
......@@ -21,12 +21,12 @@ void PcapSendQueue::Enqueue(Packet^ packet)
throw gcnew InvalidOperationException("Failed enqueueing to SendQueue");
}
PcapSendQueue::~PcapSendQueue()
PacketSendQueue::~PacketSendQueue()
{
pcap_sendqueue_destroy(_pcapSendQueue);
}
void PcapSendQueue::Transmit(pcap_t* pcapDescriptor, bool isSync)
void PacketSendQueue::Transmit(pcap_t* pcapDescriptor, bool isSync)
{
unsigned int numBytesTransmitted = pcap_sendqueue_transmit(pcapDescriptor, _pcapSendQueue, isSync);
if (numBytesTransmitted < _pcapSendQueue->len)
......
......@@ -4,14 +4,14 @@
namespace PcapDotNet { namespace Core
{
public ref class PcapSendQueue : System::IDisposable
public ref class PacketSendQueue : System::IDisposable
{
public:
PcapSendQueue(unsigned int capacity);
PacketSendQueue(unsigned int capacity);
void Enqueue(BPacket::Packet^ packet);
~PcapSendQueue();
~PacketSendQueue();
internal:
void Transmit(pcap_t* pcapDescriptor, bool isSync);
......
#include "PcapTotalStatistics.h"
#include "PacketTotalStatistics.h"
using namespace PcapDotNet::Core;
PcapTotalStatistics::PcapTotalStatistics(unsigned int packetsReceived, unsigned int packetsDroppedByDriver, unsigned int packetsDroppedByInterface, unsigned int packetsCaptured)
PacketTotalStatistics::PacketTotalStatistics(unsigned int packetsReceived, unsigned int packetsDroppedByDriver, unsigned int packetsDroppedByInterface, unsigned int packetsCaptured)
{
_packetsReceived = packetsReceived;
_packetsDroppedByDriver = packetsDroppedByDriver;
......@@ -10,27 +10,27 @@ PcapTotalStatistics::PcapTotalStatistics(unsigned int packetsReceived, unsigned
_packetsCaptured = packetsCaptured;
}
unsigned int PcapTotalStatistics::PacketsReceived::get()
unsigned int PacketTotalStatistics::PacketsReceived::get()
{
return _packetsReceived;
}
unsigned int PcapTotalStatistics::PacketsDroppedByDriver::get()
unsigned int PacketTotalStatistics::PacketsDroppedByDriver::get()
{
return _packetsDroppedByDriver;
}
unsigned int PcapTotalStatistics::PacketsDroppedByInterface::get()
unsigned int PacketTotalStatistics::PacketsDroppedByInterface::get()
{
return _packetsDroppedByInterface;
}
unsigned int PcapTotalStatistics::PacketsCaptured::get()
unsigned int PacketTotalStatistics::PacketsCaptured::get()
{
return _packetsCaptured;
}
bool PcapTotalStatistics::Equals(PcapTotalStatistics^ other)
bool PacketTotalStatistics::Equals(PacketTotalStatistics^ other)
{
if (other == nullptr)
return false;
......@@ -41,7 +41,7 @@ bool PcapTotalStatistics::Equals(PcapTotalStatistics^ other)
PacketsCaptured == other->PacketsCaptured);
}
bool PcapTotalStatistics::Equals(Object^ other)
bool PacketTotalStatistics::Equals(Object^ other)
{
return Equals(dynamic_cast<PcapTotalStatistics^>(other));
return Equals(dynamic_cast<PacketTotalStatistics^>(other));
}
......@@ -2,10 +2,10 @@
namespace PcapDotNet { namespace Core
{
public ref class PcapTotalStatistics
public ref class PacketTotalStatistics
{
public:
PcapTotalStatistics(unsigned int packetsReceived, unsigned int packetsDroppedByDriver, unsigned int packetsDroppedByInterface, unsigned int packetsCaptured);
PacketTotalStatistics(unsigned int packetsReceived, unsigned int packetsDroppedByDriver, unsigned int packetsDroppedByInterface, unsigned int packetsCaptured);
property unsigned int PacketsReceived
{
......@@ -27,7 +27,7 @@ namespace PcapDotNet { namespace Core
unsigned int get();
}
bool Equals(PcapTotalStatistics^ other);
bool Equals(PacketTotalStatistics^ other);
virtual bool Equals(System::Object^ other) override;
private:
......
#include "PcapDevice.h"
using namespace PcapDotNet::Core;
PcapDeviceHandler^ PcapDevice::Open()
{
return Open(DefaultSnapshotLength, PcapDeviceOpenFlags::Promiscuous, 1000);
}
......@@ -200,151 +200,151 @@
</File>
</Filter>
<File
RelativePath=".\BpfFilter.cpp"
RelativePath=".\BerkeleyPacketFilter.cpp"
>
</File>
<File
RelativePath=".\BpfFilter.h"
RelativePath=".\BerkeleyPacketFilter.h"
>
</File>
<File
RelativePath=".\IPcapDevice.h"
RelativePath=".\DeviceAddress.cpp"
>
</File>
<File
RelativePath=".\IpV4SocketAddress.cpp"
RelativePath=".\DeviceAddress.h"
>
</File>
<File
RelativePath=".\IpV4SocketAddress.h"
RelativePath=".\IPacketDevice.h"
>
</File>
<File
RelativePath=".\MarshalingServices.cpp"
RelativePath=".\IpV4SocketAddress.cpp"
>
</File>
<File
RelativePath=".\MarshalingServices.h"
RelativePath=".\IpV4SocketAddress.h"
>
</File>
<File
RelativePath=".\PacketHeader.cpp"
RelativePath=".\LivePacketDevice.cpp"
>
</File>
<File
RelativePath=".\PacketHeader.h"
RelativePath=".\LivePacketDevice.h"
>
</File>
<File
RelativePath=".\Pcap.h"
RelativePath=".\MarshalingServices.cpp"
>
</File>
<File
RelativePath=".\PcapAddress.cpp"
RelativePath=".\MarshalingServices.h"
>
</File>
<File
RelativePath=".\PcapAddress.h"
RelativePath=".\OfflinePacketDevice.cpp"
>
</File>
<File
RelativePath=".\PcapDataLink.cpp"
RelativePath=".\OfflinePacketDevice.h"
>
</File>
<File
RelativePath=".\PcapDataLink.h"
RelativePath=".\PacketCommunicator.cpp"
>
</File>
<File
RelativePath=".\PcapDeclarations.cpp"
RelativePath=".\PacketCommunicator.h"
>
</File>
<File
RelativePath=".\PcapDeclarations.h"
RelativePath=".\PacketDevice.cpp"
>
</File>
<File
RelativePath=".\PcapDevice.cpp"
RelativePath=".\PacketDevice.h"
>
</File>
<File
RelativePath=".\PcapDevice.h"
RelativePath=".\PacketDeviceOpenFlags.h"
>
</File>
<File
RelativePath=".\PcapDeviceHandler.cpp"
RelativePath=".\PacketDumpFile.cpp"
>
</File>
<File
RelativePath=".\PcapDeviceHandler.h"
RelativePath=".\PacketDumpFile.h"
>
</File>
<File
RelativePath=".\PcapDeviceOpenFlags.h"
RelativePath=".\PacketHeader.cpp"
>
</File>
<File
RelativePath=".\PcapDumpFile.cpp"
RelativePath=".\PacketHeader.h"
>
</File>
<File
RelativePath=".\PcapDumpFile.h"
RelativePath=".\PacketSampleStatistics.cpp"
>
</File>
<File
RelativePath=".\PcapError.cpp"
RelativePath=".\PacketSampleStatistics.h"
>
</File>
<File
RelativePath=".\PcapError.h"
RelativePath=".\PacketSendQueue.cpp"
>
</File>
<File
RelativePath=".\PcapLibrary.cpp"
RelativePath=".\PacketSendQueue.h"
>
</File>
<File
RelativePath=".\PcapLibrary.h"
RelativePath=".\PacketTotalStatistics.cpp"
>
</File>
<File
RelativePath=".\PcapLiveDevice.cpp"
RelativePath=".\PacketTotalStatistics.h"
>
</File>
<File
RelativePath=".\PcapLiveDevice.h"
RelativePath=".\Pcap.h"
>
</File>
<File
RelativePath=".\PcapOfflineDevice.cpp"
RelativePath=".\PcapDataLink.cpp"
>
</File>
<File
RelativePath=".\PcapOfflineDevice.h"
RelativePath=".\PcapDataLink.h"
>
</File>
<File
RelativePath=".\PcapSampleStatistics.cpp"
RelativePath=".\PcapDeclarations.cpp"
>
</File>
<File
RelativePath=".\PcapSampleStatistics.h"
RelativePath=".\PcapDeclarations.h"
>
</File>
<File
RelativePath=".\PcapSendQueue.cpp"
RelativePath=".\PcapError.cpp"
>
</File>
<File
RelativePath=".\PcapSendQueue.h"
RelativePath=".\PcapError.h"
>
</File>
<File
RelativePath=".\PcapTotalStatistics.cpp"
RelativePath=".\PcapLibrary.cpp"
>
</File>
<File
RelativePath=".\PcapTotalStatistics.h"
RelativePath=".\PcapLibrary.h"
>
</File>
<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