예제 #1
0
        NetAdapter GetNetAdapter()
        {
            NetAdapter na = null;
            //TODO Make this use EthType
            switch (DEV9Header.config.EthType)
            {
                case Config.EthAPI.Null:
                    return null;
                case Config.EthAPI.Winsock:
                    na = new Winsock.Winsock(dev9, DEV9Header.config.Eth);
                    break;
                case Config.EthAPI.Tap:
                    na = new Tap.TAPAdapter(dev9, DEV9Header.config.Eth);
                    break;
                case Config.EthAPI.WinPcapBridged:
                    na = new WinPcap.WinPcapAdapter(dev9, DEV9Header.config.Eth, false);
                    break;
                case Config.EthAPI.WinPcapSwitched:
                    na = new WinPcap.WinPcapAdapter(dev9, DEV9Header.config.Eth, true);
                    break;
                default:
                    return null;
            }

            if (!na.IsInitialised())
            {
                na.Dispose();
                return null;
            }
            return na;
        }
예제 #2
0
        NetAdapter GetNetAdapter()
        {
            NetAdapter na = null;

            //LOG.WriteLine(TraceEventType.Information, (int)DEV9LogSources.NetAdapter, DEV9Header.config.EthType.ToString());
            switch (DEV9Header.config.EthType)
            {
            case ConfigFile.EthAPI.Null:
                return(null);

            case ConfigFile.EthAPI.Winsock:
                na = new Winsock.Winsock(dev9, DEV9Header.config.Eth);
                break;

            case ConfigFile.EthAPI.Tap:
                na = new Tap.TAPAdapter(dev9, DEV9Header.config.Eth);
                break;

            case ConfigFile.EthAPI.WinPcapBridged:
                na = new WinPcap.WinPcapAdapter(dev9, DEV9Header.config.Eth, false);
                break;

            case ConfigFile.EthAPI.WinPcapSwitched:
                na = new WinPcap.WinPcapAdapter(dev9, DEV9Header.config.Eth, true);
                break;

            default:
                return(null);
            }

            if (!na.IsInitialised())
            {
                na.Dispose();
                return(null);
            }
            return(na);
        }