Commit e5640be4 authored by Brickner_cp's avatar Brickner_cp

--no commit message

--no commit message
parent 7346c0b6
......@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("0.1.0.*")]
[assembly: AssemblyFileVersion("0.1.0.*")]
......@@ -10,11 +10,31 @@ namespace PcapDotNet { namespace Core
public ref class LivePacketCommunicator : PacketCommunicator
{
public:
/// <summary>
/// Statistics on current capture.
/// The values represent packet statistics from the start of the run to the time of the call.
/// </summary>
/// <exception cref="System::InvalidOperationException">Thrown if there is an error or the underlying packet capture doesn't support packet statistics.</exception>
virtual property PacketTotalStatistics^ TotalStatistics
{
PacketTotalStatistics^ get() override;
}
/// <summary>
/// Send a buffer of packets to the network.
/// This function transmits the content of a queue to the wire.
/// <seealso cref="SendPacket"/>
/// <seealso cref="PacketSendBuffer"/>
/// </summary>
/// <param name="sendBuffer">Contains the packets to send.</param>
/// <param name="isSync">Determines if the send operation must be synchronized: if it is true, the packets are sent respecting the timestamps, otherwise they are sent as fast as possible.</param>
/// <exception cref="System::InvalidOperationException">An error occurred during the send. The error can be caused by a driver/adapter problem or by an inconsistent/bogus send buffer..</exception>
/// <remarks>
/// <list type="bullet">
/// <item>Using this function is more efficient than issuing a series of SendPacket(), because the packets are buffered in the kernel driver, so the number of context switches is reduced. Therefore, expect a better throughput when using Transmit().</item>
/// <item>When isSync is true, the packets are synchronized in the kernel with a high precision timestamp. This requires a non-negligible amount of CPU, but allows normally to send the packets with a precision of some microseconds (depending on the accuracy of the performance counter of the machine). Such a precision cannot be reached sending the packets with SendPacket().</item>
/// </list>
/// </remarks>
virtual void Transmit(PacketSendBuffer^ sendBuffer, bool isSync) override;
internal:
......
......@@ -8,12 +8,12 @@ PacketTotalStatistics^ OfflinePacketCommunicator::TotalStatistics::get()
throw gcnew InvalidOperationException("Can't get TotalStatistics for offline devices");
}
OfflinePacketCommunicator::OfflinePacketCommunicator(const char* source, int snapshotLength, PacketDeviceOpenAttributes attributes, int readTimeout, pcap_rmtauth* auth)
: PacketCommunicator(source, snapshotLength, attributes, readTimeout, auth, nullptr)
void OfflinePacketCommunicator::Transmit(PacketSendBuffer^ sendBuffer, bool isSync)
{
throw gcnew InvalidOperationException("Can't transmit queue to an offline device");
}
void OfflinePacketCommunicator::Transmit(PacketSendBuffer^ sendBuffer, bool isSync)
OfflinePacketCommunicator::OfflinePacketCommunicator(const char* source, int snapshotLength, PacketDeviceOpenAttributes attributes, int readTimeout, pcap_rmtauth* auth)
: PacketCommunicator(source, snapshotLength, attributes, readTimeout, auth, nullptr)
{
throw gcnew InvalidOperationException("Can't transmit queue to an offline device");
}
......@@ -8,11 +8,19 @@ namespace PcapDotNet { namespace Core
public ref class OfflinePacketCommunicator : PacketCommunicator
{
public:
/// <summary>
/// TotalStatistics is not supported on offline captures.
/// </summary>
/// <exception cref="System::InvalidOperationException">Thrown always.</exception>
virtual property PacketTotalStatistics^ TotalStatistics
{
PacketTotalStatistics^ get() override;
}
/// <summary>
/// Transmit is not supported on offline captures.
/// </summary>
/// <exception cref="System::InvalidOperationException">Thrown always.</exception>
virtual void Transmit(PacketSendBuffer^ sendBuffer, bool isSync) override;
internal:
......
......@@ -76,7 +76,7 @@ namespace PcapDotNet { namespace Core
}
/// <summary>
/// Return statistics on current capture.
/// Statistics on current capture.
/// The values represent packet statistics from the start of the run to the time of the call.
/// Supported only on live captures, not on offline. No statistics are stored in offline, so no statistics are available when reading from an offline device.
/// </summary>
......@@ -297,7 +297,7 @@ namespace PcapDotNet { namespace Core
/// </summary>
/// <param name="sendBuffer">Contains the packets to send.</param>
/// <param name="isSync">Determines if the send operation must be synchronized: if it is true, the packets are sent respecting the timestamps, otherwise they are sent as fast as possible.</param>
/// <exception cref="System::InvalidOperationException">An error occurred during the send. The error can be caused by a driver/adapter problem or by an inconsistent/bogus send buffer..</exception>
/// <exception cref="System::InvalidOperationException">Trying to transmit to an offline device or an error occurred during the send. The error can be caused by a driver/adapter problem or by an inconsistent/bogus send buffer.</exception>
/// <remarks>
/// <list type="bullet">
/// <item>Using this function is more efficient than issuing a series of SendPacket(), because the packets are buffered in the kernel driver, so the number of context switches is reduced. Therefore, expect a better throughput when using Transmit().</item>
......
......@@ -2,11 +2,21 @@
namespace PcapDotNet { namespace Core
{
/// <summary>
/// Working modes for packet communicator.
/// </summary>
public enum class PacketCommunicatorMode : int
{
Capture = 0x0, // Capture working mode.
Statistics = 0x1, // Statistical working mode.
KernelMonitor = 0x2, // Kernel monitoring mode.
KernelDump = 0x10 // Kernel dump working mode.
/// <summary>Capture working mode.</summary>
Capture = 0x0,
/// <summary>Statistical working mode.</summary>
Statistics = 0x1,
/// <summary>Kernel monitoring mode. </summary>
KernelMonitor = 0x2,
/// <summary>Kernel dump working mode.</summary>
KernelDump = 0x10
};
}}
\ No newline at end of file
......@@ -2,12 +2,24 @@
namespace PcapDotNet { namespace Core
{
/// <summary>
/// The different return values when receiving from a packet communicator.
/// </summary>
public enum class PacketCommunicatorReceiveResult : int
{
Ok, // if the packet has been read without problems
Timeout, // if the timeout set with Open() has elapsed.
Eof, // if EOF was reached reading from an offline capture
BreakLoop, //
/// <summary>The packets/statistics have been read without problems.</summary>
Ok,
/// <summary>The timeout set with Open() has elapsed when trying to read packets.</summary>
Timeout,
/// <summary>EOF was reached reading from an offline capture.</summary>
Eof,
/// <summary>The loop has been broken by a call to Break() before all the requested packets could be read.</summary>
BreakLoop,
/// <summary>This return value should never be returned</summary>
None
};
}}
\ No newline at end of file
......@@ -29,7 +29,7 @@ using namespace System::Security::Permissions;
// You can specify all the value or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly:AssemblyVersionAttribute("1.0.*")];
[assembly:AssemblyVersionAttribute("0.1.0.*")];
[assembly:ComVisible(false)];
......
......@@ -2,6 +2,10 @@
namespace PcapDotNet { namespace Core
{
/// <summary>
/// This is the base sampling method class.
/// Every sampling method is defined by a method and an optional value, both for internal usage.
/// </summary>
public ref class SamplingMethod abstract
{
internal:
......
......@@ -4,10 +4,25 @@
namespace PcapDotNet { namespace Core
{
/// <summary>
/// This sampling method defines that we have to return 1 packet every given time-interval.
/// In other words, if the interval is set to 10 milliseconds, the first packet is returned to the caller; the next returned one will be the first packet that arrives when 10ms have elapsed.
/// </summary>
public ref class SamplingMethodFirstAfterInterval : SamplingMethod
{
public:
/// <summary>
/// Constructs by giving an interval in milliseconds.
/// </summary>
/// <param name="intervalInMs">The number of milliseconds to wait between packets sampled.</param>
/// <exception cref="System::ArgumentOutOfRangeException">The given number of milliseconds is negative.</exception>
SamplingMethodFirstAfterInterval(int intervalInMs);
/// <summary>
/// Constructs by giving an interval as TimeSpan.
/// </summary>
/// <param name="interval">The time to wait between packets sampled.</param>
/// <exception cref="System::ArgumentOutOfRangeException">The interval is negative or larger than 2^31 milliseconds.</exception>
SamplingMethodFirstAfterInterval(System::TimeSpan interval);
internal:
......@@ -16,6 +31,10 @@ namespace PcapDotNet { namespace Core
int get() override;
}
/// <summary>
/// Indicates the 'waiting time' in milliseconds before one packet got accepted.
/// In other words, if 'value = 10', the first packet is returned to the caller; the next returned one will be the first packet that arrives when 10ms have elapsed.
/// </summary>
virtual property int Value
{
int get() override;
......
......@@ -4,6 +4,10 @@
namespace PcapDotNet { namespace Core
{
/// <summary>
/// No sampling has to be done on the current capture.
/// In this case, no sampling algorithms are applied to the current capture.
/// </summary>
public ref class SamplingMethodNone : SamplingMethod
{
internal:
......
......@@ -4,9 +4,18 @@
namespace PcapDotNet { namespace Core
{
/// <summary>
/// Defines that only 1 out of count packets must be returned to the user.
/// In other words, if the count is set to 10, the first packet is returned to the caller, while the following 9 are discarded.
/// </summary>
public ref class SamplingMethodOneEveryCount : SamplingMethod
{
public:
/// <summary>
/// Constructs by giving a count.
/// </summary>
/// <param name="count">1 packet out of count packets will be sampled (for each sampled packet, count-1 will be discarded).</param>
/// <exception cref="System::ArgumentOutOfRangeException">The given count is non-positive.</exception>
SamplingMethodOneEveryCount(int count);
internal:
......@@ -15,6 +24,10 @@ namespace PcapDotNet { namespace Core
int get() override;
}
/// <summary>
/// Indicates the number of packets (minus 1) that must be discarded before one packet got accepted.
/// In other words, if 'value = 10', the first packet is returned to the caller, while the following 9 are discarded.
/// </summary>
virtual property int Value
{
int get() override;
......
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