/// <summary> /// Initializes networking /// </summary> private static unsafe void initNetworking() { // Networking Network.Init(); Route.Init(); // Networking protocols IPV4.Init(); ICMP.Init(); // Transport protocols UDP.Init(); TCP.Init(); ARP.Init(); DHCP.Init(); // Network drivers E1000.Init(); PCNet2.Init(); RTL8139.Init(); DHCP.Discover(); //Thread packetHandler = new Thread(); //packetHandler.Context.CreateNewContext(Util.MethodToPtr(HttpTest), 0, null, true); //Tasking.KernelTask.AddThread(packetHandler); }
public static void Init() { int NetworkDeviceID = 0; Console.WriteLine("Searching for Ethernet Controllers..."); foreach (PCIDevice device in PCI.Devices) { if ((device.ClassCode == 0x02) && (device.Subclass == 0x00) && // is Ethernet Controller device == PCI.GetDevice(device.bus, device.slot, device.function)) { Console.WriteLine("Found " + PCIDevice.DeviceClass.GetDeviceString(device) + " on PCI " + device.bus + ":" + device.slot + ":" + device.function); #region PCNETII if (device.VendorID == (ushort)VendorID.AMD && device.DeviceID == (ushort)DeviceID.PCNETII) { Console.WriteLine("NIC IRQ: " + device.InterruptLine); var AMDPCNetIIDevice = new AMDPCNetII(device); AMDPCNetIIDevice.NameID = ("eth" + NetworkDeviceID); Console.WriteLine("Registered at " + AMDPCNetIIDevice.NameID + " (" + AMDPCNetIIDevice.MACAddress.ToString() + ")"); AMDPCNetIIDevice.Enable(); NetworkDeviceID++; } #endregion #region RTL8139 if (device.VendorID == 0x10EC && device.DeviceID == 0x8139) { var RTL8139Device = new RTL8139(device); RTL8139Device.NameID = ("eth" + NetworkDeviceID); RTL8139Device.Enable(); NetworkDeviceID++; } #endregion } } if (NetworkDevice.Devices.Count == 0) { Console.WriteLine("No supported network card found!!"); } else { Console.WriteLine("Network initialization done!"); } }