Commit 2bb8f28e authored by Brickner_cp's avatar Brickner_cp

Upgrade to WinPcap 4.1.2.

Added support for PacketCommunicator.SupportedDataLinks property.
Added DOCSIS to DataLinkKind enum.
parent b455dfb5
......@@ -869,10 +869,11 @@ namespace PcapDotNet.Core.Test
address.ToString());
}
}
PacketCommunicator communicator = device.Open();
try
{
MoreAssert.AreSequenceEqual(new[] {DataLinkKind.Ethernet, DataLinkKind.Docsis}.Select(kind => new PcapDataLink(kind)), communicator.SupportedDataLinks);
PacketTotalStatistics totalStatistics = communicator.TotalStatistics;
Assert.AreEqual<object>(totalStatistics, totalStatistics);
Assert.AreNotEqual(null, totalStatistics);
......
using System;
using System.IO;
using System.Linq;
using System.Threading;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using PcapDotNet.Packets;
......@@ -356,6 +357,7 @@ namespace PcapDotNet.Core.Test
communicator = device.Open();
try
{
MoreAssert.AreSequenceEqual(new[] {DataLinkKind.Ethernet}.Select(kind => new PcapDataLink(kind)), communicator.SupportedDataLinks);
Assert.AreEqual(DataLinkKind.Ethernet, communicator.DataLink.Kind);
Assert.AreEqual("EN10MB (Ethernet)", communicator.DataLink.ToString());
Assert.AreEqual(communicator.DataLink, new PcapDataLink(communicator.DataLink.Name));
......
......@@ -27,9 +27,6 @@ void PacketCommunicator::DataLink::set(PcapDataLink value)
ReadOnlyCollection<PcapDataLink>^ PacketCommunicator::SupportedDataLinks::get()
{
throw gcnew NotSupportedException("Unsupported property to avoid memory leak");
// pcap_free_datalinks(NULL);
/*
int* dataLinks;
int numDatalinks = pcap_list_datalinks(_pcapDescriptor, &dataLinks);
if (numDatalinks == -1)
......@@ -44,11 +41,8 @@ ReadOnlyCollection<PcapDataLink>^ PacketCommunicator::SupportedDataLinks::get()
}
finally
{
// This doesn't work because of a bug. See http://www.winpcap.org/pipermail/winpcap-users/2008-May/002500.html
// todo look for pcap_free_datalinks()
// free(dataLinks);
pcap_free_datalinks(dataLinks);
}
*/
}
int PacketCommunicator::SnapshotLength::get()
......
......@@ -36,7 +36,11 @@ DataLinkKind PcapDataLink::Kind::get()
{
case 1:
return DataLinkKind::Ethernet;
default:
case 143:
return DataLinkKind::Docsis;
default:
throw gcnew NotSupportedException(PcapDataLink::typeid->Name + " " + Value.ToString(CultureInfo::InvariantCulture) + " - " + ToString() + " is unsupported");
}
}
......@@ -109,7 +113,11 @@ int PcapDataLink::KindToValue(DataLinkKind kind)
{
case DataLinkKind::Ethernet:
return 1;
default:
case DataLinkKind::Docsis:
return 143;
default:
throw gcnew NotSupportedException(PcapDataLink::typeid->Name + " kind " + kind.ToString() + " is unsupported");
}
}
......@@ -8,6 +8,11 @@ namespace PcapDotNet.Packets
/// <summary>
/// Ethernet data link kind.
/// </summary>
Ethernet
Ethernet,
/// <summary>
/// Data Over Cable Service Interface Specification.
/// </summary>
Docsis,
}
}
\ No newline at end of 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