public EthernetController(DSystem system) { _system = system; _fifo = new Queue <ushort>(); _inputPacket = new Queue <ushort>(); _outputPacket = new Queue <ushort>(); _pendingPackets = new Queue <MemoryStream>(); _crc32 = new CRC32(); // Attach real Ethernet device if user has specified one, otherwise leave unattached; output data // will go into a bit-bucket. try { if (Configuration.HostRawEthernetInterfacesAvailable && !string.IsNullOrWhiteSpace(Configuration.HostPacketInterfaceName)) { _hostInterface = new HostEthernetEncapsulation(Configuration.HostPacketInterfaceName); _hostInterface.RegisterReceiveCallback(OnHostPacketReceived); } } catch (Exception e) { _hostInterface = null; Log.Write(LogComponent.HostEthernet, "Unable to configure network interface. Error {0}", e.Message); } _readerLock = new ReaderWriterLockSlim(); // Start the ethernet reciever poll event, this will run forever. _system.Scheduler.Schedule(_receiverPollInterval, ReceiverPollCallback); Reset(); }
private void AttachHostEthernet() { // Attach real Ethernet device if user has specified one, otherwise leave unattached; output data // will go into a bit-bucket. try { if (Configuration.HostPacketInterfaceName == NethubInterface.NETHUB_NAME) { _hostInterface = new NethubInterface(); _hostInterface.RegisterReceiveCallback(OnHostPacketReceived); } else if (Configuration.HostRawEthernetInterfacesAvailable && !string.IsNullOrWhiteSpace(Configuration.HostPacketInterfaceName)) { _hostInterface = new HostEthernetEncapsulation(Configuration.HostPacketInterfaceName); _hostInterface.RegisterReceiveCallback(OnHostPacketReceived); } } catch (Exception e) { _hostInterface = null; Log.Write(LogType.Error, LogComponent.HostEthernet, "Unable to configure network interface '{0}': Error {1}", Configuration.HostPacketInterfaceName, e.Message); } }