Commit 611dfbbe authored by Brickner_cp's avatar Brickner_cp

--no commit message

--no commit message
parent 4a505ab8
...@@ -24,6 +24,19 @@ namespace Packets ...@@ -24,6 +24,19 @@ namespace Packets
return (ushort)ReadShort(buffer, offset, endianity); return (ushort)ReadShort(buffer, offset, endianity);
} }
public static uint ReadUInt(this byte[] buffer, int offset, Endianity endianity)
{
return (uint)ReadInt(buffer, offset, endianity);
}
public static int ReadInt(this byte[] buffer, int offset, Endianity endianity)
{
int value = ReadInt(buffer, offset);
if (IsWrongEndianity(endianity))
value = IPAddress.HostToNetworkOrder(value);
return value;
}
public static void Write(this byte[] buffer, int offset, short value, Endianity endianity) public static void Write(this byte[] buffer, int offset, short value, Endianity endianity)
{ {
if (IsWrongEndianity(endianity)) if (IsWrongEndianity(endianity))
...@@ -52,6 +65,17 @@ namespace Packets ...@@ -52,6 +65,17 @@ namespace Packets
} }
} }
private static int ReadInt(byte[] buffer, int offset)
{
unsafe
{
fixed (byte* ptr = &buffer[offset])
{
return *((int*)ptr);
}
}
}
private static void Write(byte[] buffer, int offset, short value) private static void Write(byte[] buffer, int offset, short value)
{ {
unsafe unsafe
......
...@@ -57,6 +57,19 @@ namespace Packets ...@@ -57,6 +57,19 @@ namespace Packets
return Equals(obj as Packet); return Equals(obj as Packet);
} }
public override int GetHashCode()
{
int hashCode = 0;
int offset = 0;
for (; offset < _data.Length - 3; offset += 4)
hashCode ^= _data.ReadInt(offset, Endianity.Small);
if (offset < _data.Length - 1)
hashCode ^= _data.ReadShort(offset, Endianity.Small);
if (offset < _data.Length)
hashCode ^= _data[offset] >> 2;
return hashCode;
}
private readonly byte[] _data; private readonly byte[] _data;
private readonly DateTime _timestamp; private readonly DateTime _timestamp;
private readonly IDataLink _dataLink; private readonly IDataLink _dataLink;
......
...@@ -76,7 +76,7 @@ namespace PcapDotNet.Core.Test ...@@ -76,7 +76,7 @@ namespace PcapDotNet.Core.Test
const string DestinationMac = "77:88:99:AA:BB:CC"; const string DestinationMac = "77:88:99:AA:BB:CC";
List<Packet> packetsToSend; List<Packet> packetsToSend;
using (PacketSendQueue queue = BuildQueue(out packetsToSend, 100, 100, SourceMac, DestinationMac, 0.5)) using (PacketSendBuffer queue = BuildQueue(out packetsToSend, 100, 100, SourceMac, DestinationMac, 0.5))
{ {
using (PacketCommunicator communicator = OfflinePacketDeviceTests.OpenOfflineDevice()) using (PacketCommunicator communicator = OfflinePacketDeviceTests.OpenOfflineDevice())
{ {
...@@ -92,7 +92,7 @@ namespace PcapDotNet.Core.Test ...@@ -92,7 +92,7 @@ namespace PcapDotNet.Core.Test
const string DestinationMac = "77:88:99:AA:BB:CC"; const string DestinationMac = "77:88:99:AA:BB:CC";
List<Packet> packetsToSend; List<Packet> packetsToSend;
using (PacketSendQueue queue = BuildQueue(out packetsToSend, numPacketsToSend, packetSize, SourceMac, DestinationMac, secondsBetweenTimestamps)) using (PacketSendBuffer queue = BuildQueue(out packetsToSend, numPacketsToSend, packetSize, SourceMac, DestinationMac, secondsBetweenTimestamps))
{ {
using (PacketCommunicator communicator = LivePacketDeviceTests.OpenLiveDevice()) using (PacketCommunicator communicator = LivePacketDeviceTests.OpenLiveDevice())
{ {
...@@ -137,11 +137,11 @@ namespace PcapDotNet.Core.Test ...@@ -137,11 +137,11 @@ namespace PcapDotNet.Core.Test
} }
} }
private static PacketSendQueue BuildQueue(out List<Packet> packetsToSend, int numPackets, int packetSize, string sourceMac, string destinationMac, double secondsBetweenTimestamps) private static PacketSendBuffer BuildQueue(out List<Packet> packetsToSend, int numPackets, int packetSize, string sourceMac, string destinationMac, double secondsBetweenTimestamps)
{ {
int rawPacketSize = packetSize + 16; // I don't know why 16 int rawPacketSize = packetSize + 16; // I don't know why 16
PacketSendQueue queue = new PacketSendQueue((uint)(numPackets * rawPacketSize)); PacketSendBuffer queue = new PacketSendBuffer((uint)(numPackets * rawPacketSize));
try try
{ {
DateTime timestamp = DateTime.Now.AddSeconds(-100); DateTime timestamp = DateTime.Now.AddSeconds(-100);
......
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<Dictionary> <Dictionary>
<Words> <Words>
<Unrecognized>
<!--Word>cb</Word-->
</Unrecognized>
<Recognized> <Recognized>
<Word>netmask</Word>
<Word>pcap</Word> <Word>pcap</Word>
<Word>eof</Word>
<Word>netmask</Word>
</Recognized> </Recognized>
<Deprecated>
<!--Term PreferredAlternate="EnterpriseServices">complus</Term-->
</Deprecated>
<Compound>
<!--Term CompoundAlternate="DataStore">datastore</Term-->
</Compound>
<DiscreteExceptions>
<!--Term>netmask</Term-->
</DiscreteExceptions>
</Words> </Words>
<Acronyms>
<CasingExceptions>
<!-->Acronym>Eof</Acronym-->
<Acronym>Ip</Acronym>
<Acronym>Ms</Acronym>
</CasingExceptions>
</Acronyms>
</Dictionary> </Dictionary>
\ No newline at end of file
...@@ -25,7 +25,7 @@ PacketTotalStatistics^ LivePacketCommunicator::TotalStatistics::get() ...@@ -25,7 +25,7 @@ PacketTotalStatistics^ LivePacketCommunicator::TotalStatistics::get()
return gcnew PacketTotalStatistics(packetsReceived, packetsDroppedByDriver, packetsDroppedByInterface, packetsCaptured); return gcnew PacketTotalStatistics(packetsReceived, packetsDroppedByDriver, packetsDroppedByInterface, packetsCaptured);
} }
void LivePacketCommunicator::Transmit(PacketSendQueue^ sendQueue, bool isSync) void LivePacketCommunicator::Transmit(PacketSendBuffer^ sendBuffer, bool isSync)
{ {
sendQueue->Transmit(PcapDescriptor, isSync); sendBuffer->Transmit(PcapDescriptor, isSync);
} }
...@@ -15,7 +15,7 @@ namespace PcapDotNet { namespace Core ...@@ -15,7 +15,7 @@ namespace PcapDotNet { namespace Core
PacketTotalStatistics^ get() override; PacketTotalStatistics^ get() override;
} }
virtual void Transmit(PacketSendQueue^ sendQueue, bool isSync) override; virtual void Transmit(PacketSendBuffer^ sendBuffer, bool isSync) override;
internal: internal:
LivePacketCommunicator(const char* source, int snapshotLength, PacketDeviceOpenFlags flags, int readTimeout, pcap_rmtauth* auth, LivePacketCommunicator(const char* source, int snapshotLength, PacketDeviceOpenFlags flags, int readTimeout, pcap_rmtauth* auth,
......
...@@ -13,7 +13,7 @@ OfflinePacketCommunicator::OfflinePacketCommunicator(const char* source, int sna ...@@ -13,7 +13,7 @@ OfflinePacketCommunicator::OfflinePacketCommunicator(const char* source, int sna
{ {
} }
void OfflinePacketCommunicator::Transmit(PacketSendQueue^ sendQueue, bool isSync) void OfflinePacketCommunicator::Transmit(PacketSendBuffer^ sendBuffer, bool isSync)
{ {
throw gcnew InvalidOperationException("Can't transmit queue to an offline device"); throw gcnew InvalidOperationException("Can't transmit queue to an offline device");
} }
...@@ -13,7 +13,7 @@ namespace PcapDotNet { namespace Core ...@@ -13,7 +13,7 @@ namespace PcapDotNet { namespace Core
PacketTotalStatistics^ get() override; PacketTotalStatistics^ get() override;
} }
virtual void Transmit(PacketSendQueue^ sendQueue, bool isSync) override; virtual void Transmit(PacketSendBuffer^ sendBuffer, bool isSync) override;
internal: internal:
OfflinePacketCommunicator(const char* source, int snapshotLength, PacketDeviceOpenFlags flags, int readTimeout, pcap_rmtauth* auth); OfflinePacketCommunicator(const char* source, int snapshotLength, PacketDeviceOpenFlags flags, int readTimeout, pcap_rmtauth* auth);
......
...@@ -122,13 +122,13 @@ void PacketCommunicator::NonBlocking::set(bool value) ...@@ -122,13 +122,13 @@ void PacketCommunicator::NonBlocking::set(bool value)
void PacketCommunicator::SetKernelBufferSize(int size) void PacketCommunicator::SetKernelBufferSize(int size)
{ {
if (pcap_setbuff(_pcapDescriptor, size) != 0) if (pcap_setbuff(_pcapDescriptor, size) != 0)
throw BuildInvalidOperation("Error setting kernel buffer size to " + size.ToString()); throw BuildInvalidOperation("Error setting kernel buffer size to " + size.ToString(CultureInfo::InvariantCulture));
} }
void PacketCommunicator::SetKernelMinimumBytesToCopy(int size) void PacketCommunicator::SetKernelMinimumBytesToCopy(int size)
{ {
if (pcap_setmintocopy(_pcapDescriptor, size) != 0) if (pcap_setmintocopy(_pcapDescriptor, size) != 0)
throw BuildInvalidOperation("Error setting kernel minimum bytes to copy to " + size.ToString()); throw BuildInvalidOperation("Error setting kernel minimum bytes to copy to " + size.ToString(CultureInfo::InvariantCulture));
} }
void PacketCommunicator::SetSamplingMethod(SamplingMethod^ method) void PacketCommunicator::SetSamplingMethod(SamplingMethod^ method)
...@@ -156,7 +156,7 @@ PacketCommunicatorReceiveResult PacketCommunicator::ReceivePacket([Out] Packet^% ...@@ -156,7 +156,7 @@ PacketCommunicatorReceiveResult PacketCommunicator::ReceivePacket([Out] Packet^%
return result; return result;
} }
PacketCommunicatorReceiveResult PacketCommunicator::ReceiveSomePackets([Out] int% numPacketsGot, int maxPackets, HandlePacket^ callBack) PacketCommunicatorReceiveResult PacketCommunicator::ReceiveSomePackets([Out] int% countGot, int maxPackets, HandlePacket^ callBack)
{ {
AssertMode(PacketCommunicatorMode::Capture); AssertMode(PacketCommunicatorMode::Capture);
...@@ -164,22 +164,22 @@ PacketCommunicatorReceiveResult PacketCommunicator::ReceiveSomePackets([Out] int ...@@ -164,22 +164,22 @@ PacketCommunicatorReceiveResult PacketCommunicator::ReceiveSomePackets([Out] int
HandlerDelegate^ packetHandlerDelegate = gcnew HandlerDelegate(packetHandler, &PacketHandler::Handle); HandlerDelegate^ packetHandlerDelegate = gcnew HandlerDelegate(packetHandler, &PacketHandler::Handle);
pcap_handler functionPointer = (pcap_handler)Marshal::GetFunctionPointerForDelegate(packetHandlerDelegate).ToPointer(); pcap_handler functionPointer = (pcap_handler)Marshal::GetFunctionPointerForDelegate(packetHandlerDelegate).ToPointer();
numPacketsGot = pcap_dispatch(_pcapDescriptor, countGot = pcap_dispatch(_pcapDescriptor,
maxPackets, maxPackets,
functionPointer, functionPointer,
NULL); NULL);
switch (numPacketsGot) switch (countGot)
{ {
case -2: case -2:
numPacketsGot = 0; countGot = 0;
return PacketCommunicatorReceiveResult::BreakLoop; return PacketCommunicatorReceiveResult::BreakLoop;
case -1: case -1:
throw BuildInvalidOperation("Failed reading from device"); throw BuildInvalidOperation("Failed reading from device");
case 0: case 0:
if (packetHandler->PacketCounter != 0) if (packetHandler->PacketCounter != 0)
{ {
numPacketsGot = packetHandler->PacketCounter; countGot = packetHandler->PacketCounter;
return PacketCommunicatorReceiveResult::Eof; return PacketCommunicatorReceiveResult::Eof;
} }
} }
......
...@@ -76,7 +76,7 @@ namespace PcapDotNet { namespace Core ...@@ -76,7 +76,7 @@ namespace PcapDotNet { namespace Core
delegate void HandlePacket(Packets::Packet^ packet); delegate void HandlePacket(Packets::Packet^ packet);
PacketCommunicatorReceiveResult ReceivePacket([System::Runtime::InteropServices::Out] Packets::Packet^% packet); PacketCommunicatorReceiveResult ReceivePacket([System::Runtime::InteropServices::Out] Packets::Packet^% packet);
PacketCommunicatorReceiveResult ReceiveSomePackets([System::Runtime::InteropServices::Out] int% numPacketsGot, int maxPackets, HandlePacket^ callback); PacketCommunicatorReceiveResult ReceiveSomePackets([System::Runtime::InteropServices::Out] int% countGot, int maxPackets, HandlePacket^ callback);
PacketCommunicatorReceiveResult ReceivePackets(int count, HandlePacket^ callback); PacketCommunicatorReceiveResult ReceivePackets(int count, HandlePacket^ callback);
delegate void HandleStatistics(PacketSampleStatistics^ statistics); delegate void HandleStatistics(PacketSampleStatistics^ statistics);
...@@ -86,7 +86,7 @@ namespace PcapDotNet { namespace Core ...@@ -86,7 +86,7 @@ namespace PcapDotNet { namespace Core
void Break(); void Break();
void SendPacket(Packets::Packet^ packet); void SendPacket(Packets::Packet^ packet);
virtual void Transmit(PacketSendQueue^ sendQueue, bool isSync) = 0; virtual void Transmit(PacketSendBuffer^ sendBuffer, bool isSync) = 0;
BerkeleyPacketFilter^ CreateFilter(System::String^ filterValue); BerkeleyPacketFilter^ CreateFilter(System::String^ filterValue);
void SetFilter(BerkeleyPacketFilter^ filter); void SetFilter(BerkeleyPacketFilter^ filter);
......
...@@ -32,5 +32,8 @@ namespace PcapDotNet { namespace Core ...@@ -32,5 +32,8 @@ namespace PcapDotNet { namespace Core
virtual PacketCommunicator^ Open(int snapshotLength, PacketDeviceOpenFlags flags, int readTimeout) = 0; virtual PacketCommunicator^ Open(int snapshotLength, PacketDeviceOpenFlags flags, int readTimeout) = 0;
virtual PacketCommunicator^ Open(); virtual PacketCommunicator^ Open();
protected:
PacketDevice(){}
}; };
}} }}
\ No newline at end of file
...@@ -8,5 +8,8 @@ namespace PcapDotNet { namespace Core ...@@ -8,5 +8,8 @@ namespace PcapDotNet { namespace Core
{ {
public: public:
static void GetPcapHeader(pcap_pkthdr &header, Packets::Packet^ packet); static void GetPcapHeader(pcap_pkthdr &header, Packets::Packet^ packet);
private:
PacketHeader(){}
}; };
}} }}
\ No newline at end of file
...@@ -7,12 +7,12 @@ using namespace System; ...@@ -7,12 +7,12 @@ using namespace System;
using namespace PcapDotNet::Core; using namespace PcapDotNet::Core;
using namespace Packets; using namespace Packets;
PacketSendQueue::PacketSendQueue(unsigned int capacity) PacketSendBuffer::PacketSendBuffer(unsigned int capacity)
{ {
_pcapSendQueue = pcap_sendqueue_alloc(capacity); _pcapSendQueue = pcap_sendqueue_alloc(capacity);
} }
void PacketSendQueue::Enqueue(Packet^ packet) void PacketSendBuffer::Enqueue(Packet^ packet)
{ {
pcap_pkthdr pcapHeader; pcap_pkthdr pcapHeader;
PacketHeader::GetPcapHeader(pcapHeader, packet); PacketHeader::GetPcapHeader(pcapHeader, packet);
...@@ -21,12 +21,12 @@ void PacketSendQueue::Enqueue(Packet^ packet) ...@@ -21,12 +21,12 @@ void PacketSendQueue::Enqueue(Packet^ packet)
throw gcnew InvalidOperationException("Failed enqueueing to SendQueue"); throw gcnew InvalidOperationException("Failed enqueueing to SendQueue");
} }
PacketSendQueue::~PacketSendQueue() PacketSendBuffer::~PacketSendBuffer()
{ {
pcap_sendqueue_destroy(_pcapSendQueue); pcap_sendqueue_destroy(_pcapSendQueue);
} }
void PacketSendQueue::Transmit(pcap_t* pcapDescriptor, bool isSync) void PacketSendBuffer::Transmit(pcap_t* pcapDescriptor, bool isSync)
{ {
unsigned int numBytesTransmitted = pcap_sendqueue_transmit(pcapDescriptor, _pcapSendQueue, isSync); unsigned int numBytesTransmitted = pcap_sendqueue_transmit(pcapDescriptor, _pcapSendQueue, isSync);
if (numBytesTransmitted < _pcapSendQueue->len) if (numBytesTransmitted < _pcapSendQueue->len)
......
...@@ -4,14 +4,14 @@ ...@@ -4,14 +4,14 @@
namespace PcapDotNet { namespace Core namespace PcapDotNet { namespace Core
{ {
public ref class PacketSendQueue : System::IDisposable public ref class PacketSendBuffer : System::IDisposable
{ {
public: public:
PacketSendQueue(unsigned int capacity); PacketSendBuffer(unsigned int capacity);
void Enqueue(Packets::Packet^ packet); void Enqueue(Packets::Packet^ packet);
~PacketSendQueue(); ~PacketSendBuffer();
internal: internal:
void Transmit(pcap_t* pcapDescriptor, bool isSync); void Transmit(pcap_t* pcapDescriptor, bool isSync);
......
...@@ -43,9 +43,18 @@ bool PacketTotalStatistics::Equals(PacketTotalStatistics^ other) ...@@ -43,9 +43,18 @@ bool PacketTotalStatistics::Equals(PacketTotalStatistics^ other)
PacketsCaptured == other->PacketsCaptured); PacketsCaptured == other->PacketsCaptured);
} }
bool PacketTotalStatistics::Equals(Object^ other) bool PacketTotalStatistics::Equals(Object^ obj)
{ {
return Equals(dynamic_cast<PacketTotalStatistics^>(other)); return Equals(dynamic_cast<PacketTotalStatistics^>(obj));
}
int PacketTotalStatistics::GetHashCode()
{
return
_packetsReceived ^
_packetsDroppedByDriver ^
_packetsDroppedByInterface ^
_packetsCaptured;
} }
String^ PacketTotalStatistics::ToString() String^ PacketTotalStatistics::ToString()
......
...@@ -28,7 +28,9 @@ namespace PcapDotNet { namespace Core ...@@ -28,7 +28,9 @@ namespace PcapDotNet { namespace Core
} }
virtual bool Equals(PacketTotalStatistics^ other); virtual bool Equals(PacketTotalStatistics^ other);
virtual bool Equals(System::Object^ other) override; virtual bool Equals(System::Object^ obj) override;
virtual int GetHashCode() override;
virtual System::String^ ToString() override; virtual System::String^ ToString() override;
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "Pcap.h" #include "Pcap.h"
using namespace System; using namespace System;
using namespace System::Globalization;
using namespace Packets; using namespace Packets;
using namespace PcapDotNet::Core; using namespace PcapDotNet::Core;
...@@ -36,7 +37,7 @@ DataLinkKind PcapDataLink::Kind::get() ...@@ -36,7 +37,7 @@ DataLinkKind PcapDataLink::Kind::get()
case 1: case 1:
return DataLinkKind::Ethernet; return DataLinkKind::Ethernet;
default: default:
throw gcnew NotSupportedException("PcapDataLink " + Value.ToString() + " - " + ToString() + " is unsupported"); throw gcnew NotSupportedException("PcapDataLink " + Value.ToString(CultureInfo::InvariantCulture) + " - " + ToString() + " is unsupported");
} }
} }
...@@ -50,7 +51,7 @@ String^ PcapDataLink::Name::get() ...@@ -50,7 +51,7 @@ String^ PcapDataLink::Name::get()
{ {
const char* name = pcap_datalink_val_to_name(Value); const char* name = pcap_datalink_val_to_name(Value);
if (name == NULL) if (name == NULL)
throw gcnew ArgumentException("datalink " + Value.ToString() + " has no name", "Value"); throw gcnew InvalidOperationException("datalink " + Value.ToString(CultureInfo::InvariantCulture) + " has no name");
return gcnew String(name); return gcnew String(name);
} }
...@@ -59,18 +60,49 @@ String^ PcapDataLink::Description::get() ...@@ -59,18 +60,49 @@ String^ PcapDataLink::Description::get()
{ {
const char* description = pcap_datalink_val_to_description(Value); const char* description = pcap_datalink_val_to_description(Value);
if (description == NULL) if (description == NULL)
throw gcnew ArgumentException("datalink " + Value.ToString() + " has no description", "Value"); throw gcnew InvalidOperationException("datalink " + Value.ToString(CultureInfo::InvariantCulture) + " has no description");
return gcnew String(description); return gcnew String(description);
} }
String^ PcapDataLink::ToString() String^ PcapDataLink::ToString()
{ {
return Name + " (" + Description + ")"; return Name + " (" + Description + ")";
} }
bool PcapDataLink::Equals(PcapDataLink other)
{
return _value == other._value;
}
bool PcapDataLink::Equals(System::Object^ obj)
{
PcapDataLink^ other = dynamic_cast<PcapDataLink^>(obj);
if (other == nullptr)
return false;
return Equals((PcapDataLink)other);
}
int PcapDataLink::GetHashCode()
{
return Value.GetHashCode();
}
// static
bool PcapDataLink::operator ==(PcapDataLink dataLink1, PcapDataLink dataLink2)
{
return dataLink1.Equals(dataLink2);
}
// static // static
bool PcapDataLink::operator !=(PcapDataLink dataLink1, PcapDataLink dataLink2)
{
return !dataLink1.Equals(dataLink2);
}
// private
int PcapDataLink::KindToValue(DataLinkKind kind) int PcapDataLink::KindToValue(DataLinkKind kind)
{ {
switch (kind) switch (kind)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
namespace PcapDotNet { namespace Core namespace PcapDotNet { namespace Core
{ {
public value class PcapDataLink : Packets::IDataLink public value class PcapDataLink : Packets::IDataLink, System::IEquatable<PcapDataLink>
{ {
public: public:
PcapDataLink(Packets::DataLinkKind kind); PcapDataLink(Packets::DataLinkKind kind);
...@@ -31,6 +31,15 @@ namespace PcapDotNet { namespace Core ...@@ -31,6 +31,15 @@ namespace PcapDotNet { namespace Core
virtual System::String^ ToString() override; virtual System::String^ ToString() override;
virtual bool Equals(PcapDataLink other);
virtual bool Equals(System::Object^ obj) override;
virtual int GetHashCode() override;
static bool operator ==(PcapDataLink dataLink1, PcapDataLink dataLink2);
static bool operator !=(PcapDataLink dataLink1, PcapDataLink dataLink2);
private: private:
static int KindToValue(Packets::DataLinkKind kind); static int KindToValue(Packets::DataLinkKind kind);
......
...@@ -9,5 +9,8 @@ namespace PcapDotNet { namespace Core ...@@ -9,5 +9,8 @@ namespace PcapDotNet { namespace Core
public: public:
static System::String^ GetErrorMessage(pcap_t* pcapDescriptor); static System::String^ GetErrorMessage(pcap_t* pcapDescriptor);
static System::InvalidOperationException^ BuildInvalidOperation(System::String^ errorMessage, pcap_t* pcapDescriptor); static System::InvalidOperationException^ BuildInvalidOperation(System::String^ errorMessage, pcap_t* pcapDescriptor);
private:
PcapError(){}
}; };
}} }}
\ No newline at end of file
...@@ -2,12 +2,15 @@ ...@@ -2,12 +2,15 @@
namespace PcapDotNet { namespace Core namespace PcapDotNet { namespace Core
{ {
public ref class PcapLibrary public ref class PcapLibrary sealed
{ {
public: public:
static property System::String^ Version static property System::String^ Version
{ {
System::String^ get(); System::String^ get();
} }
private:
PcapLibrary(){}
}; };
}} }}
\ No newline at end of file
...@@ -14,5 +14,8 @@ namespace PcapDotNet { namespace Core ...@@ -14,5 +14,8 @@ namespace PcapDotNet { namespace Core
{ {
int get() = 0; int get() = 0;
} }
protected:
SamplingMethod(){}
}; };
}} }}
\ No newline at end of file
...@@ -16,7 +16,8 @@ namespace PcapDotNet { namespace Core ...@@ -16,7 +16,8 @@ namespace PcapDotNet { namespace Core
OSI = ISO, // OSI is ISO OSI = ISO, // OSI is ISO
ECMA = 8, // european computer manufacturers ECMA = 8, // european computer manufacturers
DATAKIT = 9, // datakit protocols DATAKIT = 9, // datakit protocols
CCITT = 10, // CCITT protocols, X.25 etc CCITT = 10,
// CCITT protocols, X.25 etc
SNA = 11, // IBM SNA SNA = 11, // IBM SNA
DECnet = 12, // DECnet DECnet = 12, // DECnet
DLI = 13, // Direct data link interface DLI = 13, // Direct data link interface
......
...@@ -9,5 +9,8 @@ namespace PcapDotNet { namespace Core ...@@ -9,5 +9,8 @@ namespace PcapDotNet { namespace Core
public: public:
static void PcapTimestampToDateTime(const timeval& pcapTimestamp, [System::Runtime::InteropServices::Out] System::DateTime% dateTime); static void PcapTimestampToDateTime(const timeval& pcapTimestamp, [System::Runtime::InteropServices::Out] System::DateTime% dateTime);
static void DateTimeToPcapTimestamp(System::DateTime dateTime, timeval& pcapTimestamp); static void DateTimeToPcapTimestamp(System::DateTime dateTime, timeval& pcapTimestamp);
private:
Timestamp(){}
}; };
}} }}
\ No newline at end of file
...@@ -92,6 +92,7 @@ ...@@ -92,6 +92,7 @@
/> />
<Tool <Tool
Name="VCFxCopTool" Name="VCFxCopTool"
Rules="-Microsoft.Design#CA1021;-Microsoft.Design#CA1028;-Microsoft.Design#CA1027"
EnableFxCop="true" EnableFxCop="true"
Dictionaries="CodeAnalysisDictionary.xml" Dictionaries="CodeAnalysisDictionary.xml"
/> />
......
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