Commit 711226ee authored by Brickner_cp's avatar Brickner_cp

--no commit message

--no commit message
parent b3fe733f
...@@ -13,61 +13,6 @@ using namespace System::Collections::Generic; ...@@ -13,61 +13,6 @@ using namespace System::Collections::Generic;
using namespace Packets; using namespace Packets;
using namespace PcapDotNet::Core; using namespace PcapDotNet::Core;
int SamplingMethodNone::Method::get()
{
return PCAP_SAMP_NOSAMP;
}
int SamplingMethodNone::Value::get()
{
return 0;
}
SamplingMethodOneEveryN::SamplingMethodOneEveryN(int n)
{
if (n <= 0)
throw gcnew ArgumentOutOfRangeException("n", n, "Must be positive");
_n = n;
}
int SamplingMethodOneEveryN::Method::get()
{
return PCAP_SAMP_1_EVERY_N;
}
int SamplingMethodOneEveryN::Value::get()
{
return _n;
}
SamplingMethodFirstAfterInterval::SamplingMethodFirstAfterInterval(int intervalInMs)
{
if (intervalInMs < 0)
throw gcnew ArgumentOutOfRangeException("intervalInMs", intervalInMs, "Must be non negative");
_intervalInMs = intervalInMs;
}
SamplingMethodFirstAfterInterval::SamplingMethodFirstAfterInterval(TimeSpan interval)
{
double intervalInMs = interval.TotalMilliseconds;
if (intervalInMs > Int32::MaxValue)
throw gcnew ArgumentOutOfRangeException("interval", interval, "Must be smaller than " + TimeSpan::FromMilliseconds(Int32::MaxValue).ToString());
if (intervalInMs < 0)
throw gcnew ArgumentOutOfRangeException("interval", interval, "Must be non negative");
_intervalInMs = (int)intervalInMs;
}
int SamplingMethodFirstAfterInterval::Method::get()
{
return PCAP_SAMP_FIRST_AFTER_N_MS;
}
int SamplingMethodFirstAfterInterval::Value::get()
{
return _intervalInMs;
}
PacketCommunicator::PacketCommunicator(const char* source, int snapshotLength, PacketDeviceOpenFlags 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 // Open the device
......
...@@ -10,78 +10,10 @@ ...@@ -10,78 +10,10 @@
#include "PacketSendQueue.h" #include "PacketSendQueue.h"
#include "PacketCommunicatorMode.h" #include "PacketCommunicatorMode.h"
#include "PacketCommunicatorReceiveResult.h" #include "PacketCommunicatorReceiveResult.h"
#include "SamplingMethod.h"
namespace PcapDotNet { namespace Core namespace PcapDotNet { namespace Core
{ {
public ref class SamplingMethod abstract
{
internal:
virtual property int Method
{
int get() = 0;
}
virtual property int Value
{
int get() = 0;
}
};
public ref class SamplingMethodNone : SamplingMethod
{
internal:
virtual property int Method
{
int get() override;
}
virtual property int Value
{
int get() override;
}
};
public ref class SamplingMethodOneEveryN : SamplingMethod
{
public:
SamplingMethodOneEveryN(int n);
internal:
virtual property int Method
{
int get() override;
}
virtual property int Value
{
int get() override;
}
private:
int _n;
};
public ref class SamplingMethodFirstAfterInterval : SamplingMethod
{
public:
SamplingMethodFirstAfterInterval(int intervalInMs);
SamplingMethodFirstAfterInterval(System::TimeSpan interval);
internal:
virtual property int Method
{
int get() override;
}
virtual property int Value
{
int get() override;
}
private:
int _intervalInMs;
};
public ref class PacketCommunicator abstract : System::IDisposable public ref class PacketCommunicator abstract : System::IDisposable
{ {
public: public:
......
#pragma once
namespace PcapDotNet { namespace Core
{
public ref class SamplingMethod abstract
{
internal:
virtual property int Method
{
int get() = 0;
}
virtual property int Value
{
int get() = 0;
}
};
}}
\ No newline at end of file
#include "SamplingMethodFirstAfterInterval.h"
#include "Pcap.h"
using namespace System;
using namespace PcapDotNet::Core;
SamplingMethodFirstAfterInterval::SamplingMethodFirstAfterInterval(int intervalInMs)
{
if (intervalInMs < 0)
throw gcnew ArgumentOutOfRangeException("intervalInMs", intervalInMs, "Must be non negative");
_intervalInMs = intervalInMs;
}
SamplingMethodFirstAfterInterval::SamplingMethodFirstAfterInterval(TimeSpan interval)
{
double intervalInMs = interval.TotalMilliseconds;
if (intervalInMs > Int32::MaxValue)
throw gcnew ArgumentOutOfRangeException("interval", interval, "Must be smaller than " + TimeSpan::FromMilliseconds(Int32::MaxValue).ToString());
if (intervalInMs < 0)
throw gcnew ArgumentOutOfRangeException("interval", interval, "Must be non negative");
_intervalInMs = (int)intervalInMs;
}
int SamplingMethodFirstAfterInterval::Method::get()
{
return PCAP_SAMP_FIRST_AFTER_N_MS;
}
int SamplingMethodFirstAfterInterval::Value::get()
{
return _intervalInMs;
}
#pragma once
#include "SamplingMethod.h"
namespace PcapDotNet { namespace Core
{
public ref class SamplingMethodFirstAfterInterval : SamplingMethod
{
public:
SamplingMethodFirstAfterInterval(int intervalInMs);
SamplingMethodFirstAfterInterval(System::TimeSpan interval);
internal:
virtual property int Method
{
int get() override;
}
virtual property int Value
{
int get() override;
}
private:
int _intervalInMs;
};
}}
\ No newline at end of file
#include "SamplingMethodNone.h"
#include "Pcap.h"
using namespace PcapDotNet::Core;
int SamplingMethodNone::Method::get()
{
return PCAP_SAMP_NOSAMP;
}
int SamplingMethodNone::Value::get()
{
return 0;
}
#pragma once
#include "SamplingMethod.h"
namespace PcapDotNet { namespace Core
{
public ref class SamplingMethodNone : SamplingMethod
{
internal:
virtual property int Method
{
int get() override;
}
virtual property int Value
{
int get() override;
}
};
}}
\ No newline at end of file
#include "SamplingMethodOneEveryN.h"
#include "Pcap.h"
using namespace System;
using namespace PcapDotNet::Core;
SamplingMethodOneEveryN::SamplingMethodOneEveryN(int n)
{
if (n <= 0)
throw gcnew ArgumentOutOfRangeException("n", n, "Must be positive");
_n = n;
}
int SamplingMethodOneEveryN::Method::get()
{
return PCAP_SAMP_1_EVERY_N;
}
int SamplingMethodOneEveryN::Value::get()
{
return _n;
}
#pragma once
#include "SamplingMethod.h"
namespace PcapDotNet { namespace Core
{
public ref class SamplingMethodOneEveryN : SamplingMethod
{
public:
SamplingMethodOneEveryN(int n);
internal:
virtual property int Method
{
int get() override;
}
virtual property int Value
{
int get() override;
}
private:
int _n;
};
}}
\ No newline at end of file
...@@ -298,6 +298,34 @@ ...@@ -298,6 +298,34 @@
RelativePath=".\PacketCommunicatorReceiveResult.h" RelativePath=".\PacketCommunicatorReceiveResult.h"
> >
</File> </File>
<File
RelativePath=".\SamplingMethod.h"
>
</File>
<File
RelativePath=".\SamplingMethodFirstAfterInterval.cpp"
>
</File>
<File
RelativePath=".\SamplingMethodFirstAfterInterval.h"
>
</File>
<File
RelativePath=".\SamplingMethodNone.cpp"
>
</File>
<File
RelativePath=".\SamplingMethodNone.h"
>
</File>
<File
RelativePath=".\SamplingMethodOneEveryN.cpp"
>
</File>
<File
RelativePath=".\SamplingMethodOneEveryN.h"
>
</File>
</Filter> </Filter>
<Filter <Filter
Name="Marshaling" Name="Marshaling"
......
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