static public IReadOnlyList <PcapInterface> GetAllPcapInterfaces(string source, RemoteAuthentication credentials) { var devicePtr = IntPtr.Zero; var errorBuffer = new StringBuilder(Pcap.PCAP_ERRBUF_SIZE); var auth = RemoteAuthentication.CreateAuth(credentials); try { var result = LibPcapSafeNativeMethods.pcap_findalldevs_ex(source, ref auth, ref devicePtr, errorBuffer); if (result < 0) { throw new PcapException(errorBuffer.ToString()); } } catch (TypeLoadException ex) { throw new PlatformNotSupportedException( "Operation is not supported on this platform.", ex ); } var pcapInterfaces = GetAllPcapInterfaces(devicePtr, credentials); // Free unmanaged memory allocation LibPcapSafeNativeMethods.pcap_freealldevs(devicePtr); return(pcapInterfaces); }