Example #1
0
        /// <summary>
        /// Represents a strongly typed, read-only list of PcapDevices.
        /// </summary>
        private CaptureDeviceList()
            : base(new List <ICaptureDevice>())
        {
            // windows
            if ((Environment.OSVersion.Platform == PlatformID.Win32NT) ||
                (Environment.OSVersion.Platform == PlatformID.Win32Windows))
            {
                winPcapDeviceList = WinPcap.WinPcapDeviceList.Instance;
            }
            else // not windows
            {
                libPcapDeviceList = LibPcap.LibPcapLiveDeviceList.Instance;
            }

            Refresh();
        }
        /// <summary>
        /// Retrieve the local devices
        /// </summary>
        /// <returns></returns>
        private static List <WinPcapDevice> GetDevices()
        {
            var rpcapLocalDeviceAddress = "rpcap://";

            return(WinPcapDeviceList.Devices(rpcapLocalDeviceAddress, null));
        }