/// <summary>
        /// Opens the specified device for sniffing
        /// </summary>
        /// <param name="wpiInterface">The device to open</param>
        /// <param name="pofFlags">Configuration flags for opening</param>
        public void OpenDevice(WinPcapInterface wpiInterface, PcapOpenflags pofFlags)
        {
            if (bRun)
            {
                throw new InvalidOperationException("A capture is currently running");
            }
            CloseDevice();
            string strErrorbuff = "";
            IntPtr ptrDevice    = pcap_open(wpiInterface.Name, 65535, pofFlags, 5, IntPtr.Zero, strErrorbuff);

            if (ptrDevice == IntPtr.Zero)
            {
                throw new Exception("Error when trying to open WinPcap device: " + strErrorbuff);
            }
            iptrOpenDevice          = ptrDevice;
            wpcCurrentOpenInterface = wpiInterface;
            wpfCurrentFilter        = CompileFilter("", true, new Subnetmask());
        }
 private static extern IntPtr pcap_open(string source, int iSnaplen, PcapOpenflags flags, int iReadTimeOut, IntPtr pcapAuth, string strErrorBuffer);