1
0
mirror of https://github.com/livingcomputermuseum/ContrAlto.git synced 2026-04-25 19:51:48 +00:00

Switched from PCap.net to SharpPcap for ethernet encapsulation; SharpPcap is cross-platform, this allows raw ethernet encapsulation to work on Linux and OS X.

This commit is contained in:
Josh Dersch
2017-06-13 11:19:25 -07:00
parent aa9a2651ef
commit c671b04ee8
12 changed files with 214 additions and 214 deletions

View File

@@ -16,10 +16,9 @@
*/
using Contralto.IO;
using PcapDotNet.Core;
using PcapDotNet.Core.Extensions;
using SharpPcap;
using SharpPcap.WinPcap;
using System;
using System.Collections.Generic;
using System.IO;
using System.Net.NetworkInformation;
using System.Windows.Forms;
@@ -79,7 +78,7 @@ namespace Contralto.UI
if (!Configuration.HostRawEthernetInterfacesAvailable)
{
// If PCAP isn't installed, the RAW Ethernet option is not available.
// If PCAP isn't installed, the RAW Ethernet option is not available.
RawEthernetRadioButton.Enabled = false;
// Ensure the option isn't set in the configuration.
@@ -102,7 +101,7 @@ namespace Contralto.UI
case PacketInterfaceType.None:
NoEncapsulationRadioButton.Checked = true;
break;
}
}
PopulateNetworkAdapterList(Configuration.HostPacketInterfaceType);
@@ -153,22 +152,21 @@ namespace Contralto.UI
case PacketInterfaceType.EthernetEncapsulation:
if (Configuration.HostRawEthernetInterfacesAvailable)
{
foreach (LivePacketDevice device in LivePacketDevice.AllLocalMachine)
{
EthernetInterfaceListBox.Items.Add(new EthernetInterface(device.GetNetworkInterface().Name, device.GetNetworkInterface().Description));
}
}
foreach (WinPcapDevice device in CaptureDeviceList.Instance)
{
EthernetInterfaceListBox.Items.Add(new EthernetInterface(device.Interface.FriendlyName, device.Interface.Description));
}
}
break;
case PacketInterfaceType.None:
// Add nothing.
break;
}
}
//
// Select the one that is already selected (if any)
//
//
EthernetInterfaceListBox.SelectedIndex = 0;
if (!string.IsNullOrEmpty(Configuration.HostPacketInterfaceName))