Cosmos/source2/Users/SSchocke/SSchockeTest/NetworkStack.cs
sschocke_cp 0bbab9e1e6 Added SSchocke Playground - Contains porting effort for AMD PCNetII Driver
Fixed PCIDevice so that Command and Status are dynamic properties. Also added Claimed to mark a Device as handled by a driver
Also added an EnableDevice call to PCIDeviceNormal that enables the PCI Device on the bus
2012-02-01 19:38:29 +00:00

49 lines
1.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
namespace SSchockeTest
{
public static class NetworkStack
{
private static Dictionary<IPAddress, NetworkDevice> addressMap;
private static List<IPAddress> ipConfigs;
public static void Init()
{
ipConfigs = new List<IPAddress>();
}
public static void ConfigIP(NetworkDevice nic, IPAddress config)
{
ipConfigs.Add(config);
nic.DataReceived = HandlePacket;
}
internal static void HandlePacket(byte[] packetData)
{
Console.Write("Received Packet Length=");
Console.WriteLine(packetData.Length);
Console.WriteLine(BitConverter.ToString(packetData));
UInt16 etherType = (UInt16)((packetData[12] << 8) | packetData[13]);
switch (etherType)
{
case 0x0806:
Console.WriteLine("Received ARP Packet");
//ARPHandler(packetData);
break;
//case 0x0800:
// IPv4Handler(packetData);
// break;
}
}
internal static void Update()
{
}
}
}