mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-21 13:28:41 +00:00
Added network support. ARP and ICMP echo(ping) is working. Couple of major changes here, so please re-run install.bat
This commit is contained in:
parent
718c5de784
commit
24c27d23ef
27 changed files with 1437 additions and 111 deletions
|
|
@ -51,7 +51,6 @@ serial0.pipe.endPoint = "client"
|
|||
serial0.tryNoRxLoss = "TRUE"
|
||||
sound.present = "TRUE"
|
||||
ethernet0.present = "TRUE"
|
||||
ethernet0.connectionType = "nat"
|
||||
ethernet0.wakeOnPcktRcv = "FALSE"
|
||||
ethernet0.addressType = "generated"
|
||||
usb.present = "TRUE"
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ namespace Cosmos.Debug.Common
|
|||
|
||||
xExec.SqlStatements.Add(
|
||||
"CREATE TABLE Label ("
|
||||
+ " LABELNAME VARCHAR(255) NOT NULL"
|
||||
+ " LABELNAME VARCHAR(4000) NOT NULL"
|
||||
+ ", ADDRESS BIGINT NOT NULL"
|
||||
+ ");");
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace SSchockeTest
|
||||
namespace Cosmos.Common.Extensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains various helpermethods to make bitfiddling easier.
|
||||
|
|
@ -72,6 +72,7 @@
|
|||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BinaryHelper.cs" />
|
||||
<Compile Include="ByteConverter.cs" />
|
||||
<Compile Include="ToHexString.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
|
|
|
|||
|
|
@ -78,6 +78,17 @@
|
|||
<Compile Include="Filesystem\Listing\File.cs" />
|
||||
<Compile Include="Global.cs" />
|
||||
<Compile Include="Kernel.cs" />
|
||||
<Compile Include="Network\ARP\ARPCache.cs" />
|
||||
<Compile Include="Network\ARP\ARPPacket.cs" />
|
||||
<Compile Include="Network\EthernetPacket.cs" />
|
||||
<Compile Include="Network\IPv4\Address.cs" />
|
||||
<Compile Include="Network\IPv4\ARPPacket_Ethernet.cs" />
|
||||
<Compile Include="Network\IPv4\Config.cs" />
|
||||
<Compile Include="Network\IPv4\ICMPPacket.cs" />
|
||||
<Compile Include="Network\IPv4\IPPacket.cs" />
|
||||
<Compile Include="Network\IPv4\OutgoingBuffer.cs" />
|
||||
<Compile Include="Network\NetworkStack.cs" />
|
||||
<Compile Include="Network\TempDictionary.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
@ -93,6 +104,10 @@
|
|||
<Project>{61607F1E-58F9-41CF-972F-128384F3E115}</Project>
|
||||
<Name>Cosmos.Debug.Kernel</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Hardware\Core\Cosmos.Core\Cosmos.Core.csproj">
|
||||
<Project>{5AC4773C-CB4E-4CD9-8D50-02E10A07DEE6}</Project>
|
||||
<Name>Cosmos.Core</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Hardware\Cosmos.Hardware\Cosmos.Hardware.csproj">
|
||||
<Project>{6A991D03-1435-4005-9809-B8BACDF3B021}</Project>
|
||||
<Name>Cosmos.Hardware</Name>
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ namespace Cosmos.System {
|
|||
Console = new Console();
|
||||
|
||||
Cosmos.Hardware.Global.Init();
|
||||
Network.NetworkStack.Init();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Cosmos.Hardware;
|
||||
|
||||
namespace Cosmos.System {
|
||||
// MtW: if the fullname (namespace + name) of this class changes, please also change IL2CPU msbuild task
|
||||
|
|
@ -36,7 +32,8 @@ namespace Cosmos.System {
|
|||
|
||||
BeforeRun();
|
||||
while (!mStopped) {
|
||||
Run();
|
||||
Network.NetworkStack.Update();
|
||||
Run();
|
||||
}
|
||||
AfterRun();
|
||||
bool xTest = 1 != 3;
|
||||
|
|
|
|||
54
source2/Kernel/System/Cosmos.System/Network/ARP/ARPCache.cs
Normal file
54
source2/Kernel/System/Cosmos.System/Network/ARP/ARPCache.cs
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
using System;
|
||||
using Cosmos.Core.Network;
|
||||
|
||||
namespace Cosmos.System.Network.ARP
|
||||
{
|
||||
internal static class ARPCache
|
||||
{
|
||||
private static TempDictionary<MACAddress> cache;
|
||||
|
||||
private static void ensureCacheExists()
|
||||
{
|
||||
if (cache == null)
|
||||
{
|
||||
cache = new TempDictionary<MACAddress>();
|
||||
}
|
||||
}
|
||||
|
||||
internal static bool Contains(IPv4.Address ipAddress)
|
||||
{
|
||||
ensureCacheExists();
|
||||
return cache.ContainsKey(ipAddress.Hash);
|
||||
}
|
||||
|
||||
internal static void Update(IPv4.Address ipAddress, MACAddress macAddress)
|
||||
{
|
||||
ensureCacheExists();
|
||||
UInt32 ip_hash = ipAddress.Hash;
|
||||
if (ip_hash == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (cache.ContainsKey(ip_hash) == false)
|
||||
{
|
||||
cache.Add(ip_hash, macAddress);
|
||||
}
|
||||
else
|
||||
{
|
||||
cache[ip_hash] = macAddress;
|
||||
}
|
||||
}
|
||||
|
||||
internal static MACAddress Resolve(IPv4.Address ipAddress)
|
||||
{
|
||||
ensureCacheExists();
|
||||
if (cache.ContainsKey(ipAddress.Hash) == false)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return cache[ipAddress.Hash];
|
||||
}
|
||||
}
|
||||
}
|
||||
102
source2/Kernel/System/Cosmos.System/Network/ARP/ARPPacket.cs
Normal file
102
source2/Kernel/System/Cosmos.System/Network/ARP/ARPPacket.cs
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
using System;
|
||||
using Sys = System;
|
||||
using Cosmos.Core.Network;
|
||||
using Cosmos.Hardware;
|
||||
|
||||
namespace Cosmos.System.Network.ARP
|
||||
{
|
||||
internal class ARPPacket : EthernetPacket
|
||||
{
|
||||
protected UInt16 aHardwareType;
|
||||
protected UInt16 aProtocolType;
|
||||
protected byte aHardwareLen;
|
||||
protected byte aProtocolLen;
|
||||
protected UInt16 aOperation;
|
||||
|
||||
internal static void ARPHandler(byte[] packetData)
|
||||
{
|
||||
ARPPacket arp_packet = new ARPPacket(packetData);
|
||||
//Sys.Console.WriteLine("Received ARP Packet");
|
||||
//Sys.Console.WriteLine(arp_packet.ToString());
|
||||
if (arp_packet.Operation == 0x01)
|
||||
{
|
||||
if ((arp_packet.HardwareType == 1) && (arp_packet.ProtocolType == 0x0800))
|
||||
{
|
||||
IPv4.ARPRequest_Ethernet arp_request = new IPv4.ARPRequest_Ethernet(packetData);
|
||||
ARPCache.Update(arp_request.SenderIP, arp_request.SenderMAC);
|
||||
|
||||
if (NetworkStack.AddressMap.ContainsKey(arp_request.TargetIP.Hash) == true)
|
||||
{
|
||||
Sys.Console.WriteLine("ARP Request Recvd from " + arp_request.SenderIP.ToString());
|
||||
NetworkDevice nic = NetworkStack.AddressMap[arp_request.TargetIP.Hash];
|
||||
|
||||
IPv4.ARPReply_Ethernet reply =
|
||||
new IPv4.ARPReply_Ethernet(nic.MACAddress, arp_request.TargetIP, arp_request.SenderMAC, arp_request.SenderIP);
|
||||
|
||||
nic.QueueBytes(reply.RawData);
|
||||
}
|
||||
}
|
||||
}
|
||||
//else if (arp_packet.Operation == 0x02)
|
||||
//{
|
||||
// if ((arp_packet.HardwareType == 1) && (arp_packet.ProtocolType == 0x0800))
|
||||
// {
|
||||
// ARP.IPv4.ARPReply_Ethernet arp_reply = new ARP.IPv4.ARPReply_Ethernet(packetData);
|
||||
// ARP.ARPCache.Update(arp_reply.SenderIP, arp_reply.SenderMAC);
|
||||
|
||||
// //Sys.Console.WriteLine("ARP Reply Recvd for IP=" + arp_reply.SenderIP.ToString());
|
||||
// TCPIP.IPv4.OutgoingBuffer.ARPCache_Update(arp_reply);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
internal ARPPacket(byte[] rawData)
|
||||
: base(rawData)
|
||||
{ }
|
||||
|
||||
protected override void initFields()
|
||||
{
|
||||
base.initFields();
|
||||
aHardwareType = (UInt16)((mRawData[14] << 8) | mRawData[15]);
|
||||
aProtocolType = (UInt16)((mRawData[16] << 8) | mRawData[17]);
|
||||
aHardwareLen = mRawData[18];
|
||||
aProtocolLen = mRawData[19];
|
||||
aOperation = (UInt16)((mRawData[20] << 8) | mRawData[21]);
|
||||
}
|
||||
|
||||
protected ARPPacket(MACAddress dest, MACAddress src, UInt16 hwType, UInt16 protoType,
|
||||
byte hwLen, byte protoLen, UInt16 operation, int packet_size)
|
||||
: base(dest, src, 0x0806, packet_size)
|
||||
{
|
||||
mRawData[14] = (byte)(hwType >> 8);
|
||||
mRawData[15] = (byte)(hwType >> 0);
|
||||
mRawData[16] = (byte)(protoType >> 8);
|
||||
mRawData[17] = (byte)(protoType >> 0);
|
||||
mRawData[18] = hwLen;
|
||||
mRawData[19] = protoLen;
|
||||
mRawData[20] = (byte)(operation >> 8);
|
||||
mRawData[21] = (byte)(operation >> 0);
|
||||
|
||||
initFields();
|
||||
}
|
||||
|
||||
internal UInt16 Operation
|
||||
{
|
||||
get { return this.aOperation; }
|
||||
}
|
||||
internal UInt16 HardwareType
|
||||
{
|
||||
get { return this.aHardwareType; }
|
||||
}
|
||||
internal UInt16 ProtocolType
|
||||
{
|
||||
get { return this.aProtocolType; }
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "ARP Packet Src=" + srcMAC + ", Dest=" + destMAC + ", HWType=" + aHardwareType + ", Protocol=" + aProtocolType +
|
||||
", Operation=" + Operation;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
using System;
|
||||
using Cosmos.Core.Network;
|
||||
|
||||
namespace Cosmos.System.Network
|
||||
{
|
||||
internal class EthernetPacket
|
||||
{
|
||||
protected byte[] mRawData;
|
||||
protected MACAddress srcMAC;
|
||||
protected MACAddress destMAC;
|
||||
protected UInt16 aEtherType;
|
||||
|
||||
protected EthernetPacket(byte[] rawData)
|
||||
{
|
||||
mRawData = rawData;
|
||||
initFields();
|
||||
}
|
||||
|
||||
protected virtual void initFields()
|
||||
{
|
||||
destMAC = new MACAddress(mRawData, 0);
|
||||
srcMAC = new MACAddress(mRawData, 6);
|
||||
aEtherType = (UInt16)((mRawData[12] << 8) | mRawData[13]);
|
||||
}
|
||||
|
||||
protected EthernetPacket(UInt16 type, int packet_size)
|
||||
: this(MACAddress.None, MACAddress.None, type, packet_size)
|
||||
{
|
||||
}
|
||||
|
||||
protected EthernetPacket(MACAddress dest, MACAddress src, UInt16 type, int packet_size)
|
||||
{
|
||||
mRawData = new byte[packet_size];
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
mRawData[i] = dest.bytes[i];
|
||||
mRawData[6 + i] = src.bytes[i];
|
||||
}
|
||||
|
||||
mRawData[12] = (byte)(type >> 8);
|
||||
mRawData[13] = (byte)(type >> 0);
|
||||
initFields();
|
||||
}
|
||||
|
||||
internal MACAddress SourceMAC
|
||||
{
|
||||
get { return this.srcMAC; }
|
||||
set
|
||||
{
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
mRawData[6 + i] = value.bytes[i];
|
||||
}
|
||||
initFields();
|
||||
}
|
||||
}
|
||||
internal MACAddress DestinationMAC
|
||||
{
|
||||
get { return this.destMAC; }
|
||||
set
|
||||
{
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
mRawData[i] = value.bytes[i];
|
||||
}
|
||||
initFields();
|
||||
}
|
||||
}
|
||||
internal UInt16 EthernetType
|
||||
{
|
||||
get { return this.aEtherType; }
|
||||
}
|
||||
|
||||
internal byte[] GetBytes()
|
||||
{
|
||||
return this.mRawData;
|
||||
}
|
||||
|
||||
internal byte[] RawData
|
||||
{
|
||||
get { return this.mRawData; }
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "Ethernet Packet : Src=" + srcMAC + ", Dest=" + destMAC + ", Type=" + aEtherType;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
using System;
|
||||
using Cosmos.Core.Network;
|
||||
using Cosmos.System.Network.ARP;
|
||||
|
||||
namespace Cosmos.System.Network.IPv4
|
||||
{
|
||||
internal abstract class ARPPacket_Ethernet : ARPPacket
|
||||
{
|
||||
protected MACAddress mSenderMAC;
|
||||
protected MACAddress mTargetMAC;
|
||||
protected Address mSenderIP;
|
||||
protected Address mTargetIP;
|
||||
|
||||
internal ARPPacket_Ethernet(byte[] rawData)
|
||||
: base(rawData)
|
||||
{ }
|
||||
|
||||
protected override void initFields()
|
||||
{
|
||||
base.initFields();
|
||||
mSenderMAC = new MACAddress(mRawData, 22);
|
||||
mSenderIP = new Address(mRawData, 28);
|
||||
mTargetMAC = new MACAddress(mRawData, 32);
|
||||
mTargetIP = new Address(mRawData, 38);
|
||||
}
|
||||
|
||||
protected ARPPacket_Ethernet(UInt16 operation, MACAddress senderMAC, Address senderIP,
|
||||
MACAddress targetMAC, Address targetIP, int packet_size)
|
||||
: base(targetMAC, senderMAC, 1, 0x0800, 6, 4, operation, packet_size)
|
||||
{
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
mRawData[22 + i] = senderMAC.bytes[i];
|
||||
mRawData[32 + i] = targetMAC.bytes[i];
|
||||
}
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
mRawData[28 + i] = senderIP.address[i];
|
||||
mRawData[38 + i] = targetIP.address[i];
|
||||
}
|
||||
|
||||
initFields();
|
||||
}
|
||||
|
||||
internal MACAddress SenderMAC
|
||||
{
|
||||
get { return this.mSenderMAC; }
|
||||
}
|
||||
internal MACAddress TargetMAC
|
||||
{
|
||||
get { return this.mTargetMAC; }
|
||||
}
|
||||
internal Address SenderIP
|
||||
{
|
||||
get { return this.mSenderIP; }
|
||||
}
|
||||
internal Address TargetIP
|
||||
{
|
||||
get { return this.mTargetIP; }
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "IPv4 Ethernet ARP Packet SenderMAC=" + mSenderMAC + ", TargetMAC=" + mTargetMAC + ", SenderIP=" + mSenderIP +
|
||||
", TargetIP=" + mTargetIP + ", Operation=" + aOperation;
|
||||
}
|
||||
}
|
||||
|
||||
internal class ARPReply_Ethernet : ARPPacket_Ethernet
|
||||
{
|
||||
internal ARPReply_Ethernet(byte[] rawData)
|
||||
: base(rawData)
|
||||
{ }
|
||||
|
||||
internal ARPReply_Ethernet(MACAddress ourMAC, Address ourIP, MACAddress targetMAC, Address targetIP)
|
||||
: base(2, ourMAC, ourIP, targetMAC, targetIP, 42)
|
||||
{ }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "ARP Reply Src=" + srcMAC + ", Dest=" + destMAC + ", Sender=" + mSenderIP + ", Target=" + mTargetIP;
|
||||
}
|
||||
}
|
||||
internal class ARPRequest_Ethernet : ARPPacket_Ethernet
|
||||
{
|
||||
internal ARPRequest_Ethernet(byte[] rawData)
|
||||
: base(rawData)
|
||||
{ }
|
||||
|
||||
internal ARPRequest_Ethernet(MACAddress ourMAC, Address ourIP, MACAddress targetMAC, Address targetIP)
|
||||
: base(1, ourMAC, ourIP, targetMAC, targetIP, 42)
|
||||
{ }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "ARP Request Src=" + srcMAC + ", Dest=" + destMAC + ", Sender=" + mSenderIP + ", Target=" + mTargetIP;
|
||||
}
|
||||
}
|
||||
}
|
||||
151
source2/Kernel/System/Cosmos.System/Network/IPv4/Address.cs
Normal file
151
source2/Kernel/System/Cosmos.System/Network/IPv4/Address.cs
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
using System;
|
||||
|
||||
namespace Cosmos.System.Network.IPv4
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines a IPv4 Address
|
||||
/// <remarks>Should actually be using System.Net.IPAddress, but gives problems</remarks>
|
||||
/// </summary>
|
||||
public class Address : IComparable
|
||||
{
|
||||
/// <summary>
|
||||
/// Predefined 0.0.0.0 address
|
||||
/// </summary>
|
||||
public static Address Zero = new Address(0, 0, 0, 0);
|
||||
|
||||
internal byte[] address = new byte[4];
|
||||
|
||||
public Address(byte aFirst, byte aSecond, byte aThird, byte aFourth)
|
||||
{
|
||||
address[0] = aFirst;
|
||||
address[1] = aSecond;
|
||||
address[2] = aThird;
|
||||
address[3] = aFourth;
|
||||
}
|
||||
|
||||
public Address(byte[] buffer, int offset)
|
||||
{
|
||||
if (buffer == null || buffer.Length < (offset + 4))
|
||||
throw new ArgumentException("buffer does not contain enough data starting at offset", "buffer");
|
||||
|
||||
address[0] = buffer[offset];
|
||||
address[1] = buffer[offset + 1];
|
||||
address[2] = buffer[offset + 2];
|
||||
address[3] = buffer[offset + 3];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parse a IP Address in string representation
|
||||
/// </summary>
|
||||
/// <param name="adr">IP Address as string</param>
|
||||
/// <returns></returns>
|
||||
public static Address Parse(string adr)
|
||||
{
|
||||
string[] fragments = adr.Split('.');
|
||||
if (fragments.Length == 4)
|
||||
{
|
||||
byte first = byte.Parse(fragments[0]);
|
||||
byte second = byte.Parse(fragments[1]);
|
||||
byte third = byte.Parse(fragments[2]);
|
||||
byte fourth = byte.Parse(fragments[3]);
|
||||
|
||||
return new Address(first, second, third, fourth);
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsLoopbackAddress()
|
||||
{
|
||||
if (address[0] == 127)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool IsBroadcastAddress()
|
||||
{
|
||||
if (address[0] == 255)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts IP Address to String
|
||||
/// </summary>
|
||||
/// <returns>String with IP Address in dotted notation</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return
|
||||
address[0] +
|
||||
"." +
|
||||
address[1] +
|
||||
"." +
|
||||
address[2] +
|
||||
"." +
|
||||
address[3];
|
||||
}
|
||||
|
||||
public byte[] ToByteArray()
|
||||
{
|
||||
return address;
|
||||
}
|
||||
|
||||
private UInt32 to32BitNumber()
|
||||
{
|
||||
return (UInt32)((address[0] << 24) | (address[1] << 16) | (address[2] << 8) | (address[3] << 0));
|
||||
}
|
||||
|
||||
private UInt32 hash;
|
||||
/// <summary>
|
||||
/// Hash value for this IP. Used to uniquely identify each IP
|
||||
/// </summary>
|
||||
public UInt32 Hash
|
||||
{
|
||||
get
|
||||
{
|
||||
if (hash == 0)
|
||||
{
|
||||
hash = to32BitNumber();
|
||||
}
|
||||
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
||||
#region IComparable Members
|
||||
|
||||
/// <summary>
|
||||
/// Compare 2 IP Address objects for equality
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
/// <returns>0 if equal, or non-zero otherwise</returns>
|
||||
public int CompareTo(object obj)
|
||||
{
|
||||
if (obj is Address)
|
||||
{
|
||||
Address other = (Address)obj;
|
||||
int i = 0;
|
||||
i = address[0].CompareTo(other.address[0]);
|
||||
if (i != 0) return i;
|
||||
i = address[1].CompareTo(other.address[1]);
|
||||
if (i != 0) return i;
|
||||
i = address[2].CompareTo(other.address[2]);
|
||||
if (i != 0) return i;
|
||||
i = address[3].CompareTo(other.address[3]);
|
||||
if (i != 0) return i;
|
||||
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
throw new ArgumentException("obj is not a IPv4Address", "obj");
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
115
source2/Kernel/System/Cosmos.System/Network/IPv4/Config.cs
Normal file
115
source2/Kernel/System/Cosmos.System/Network/IPv4/Config.cs
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
using System.Collections.Generic;
|
||||
using Cosmos.Hardware;
|
||||
using System;
|
||||
|
||||
namespace Cosmos.System.Network.IPv4
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains a IPv4 configuration
|
||||
/// </summary>
|
||||
public class Config
|
||||
{
|
||||
internal static List<Config> ipConfigs;
|
||||
|
||||
static Config()
|
||||
{
|
||||
ipConfigs = new List<Config>();
|
||||
}
|
||||
|
||||
internal static void Add(Config config)
|
||||
{
|
||||
ipConfigs.Add(config);
|
||||
}
|
||||
|
||||
internal static Address FindNetwork(Address destIP)
|
||||
{
|
||||
Address default_gw = null;
|
||||
|
||||
for (int c = 0; c < ipConfigs.Count; c++)
|
||||
{
|
||||
if ((ipConfigs[c].IPAddress.Hash & ipConfigs[c].SubnetMask.Hash) ==
|
||||
(destIP.Hash & ipConfigs[c].SubnetMask.Hash))
|
||||
{
|
||||
return ipConfigs[c].IPAddress;
|
||||
}
|
||||
if ((default_gw == null) && (ipConfigs[c].DefaultGateway.CompareTo(Address.Zero) != 0))
|
||||
{
|
||||
default_gw = ipConfigs[c].IPAddress;
|
||||
}
|
||||
}
|
||||
|
||||
return default_gw;
|
||||
}
|
||||
|
||||
internal static bool IsLocalAddress(Address destIP)
|
||||
{
|
||||
for (int c = 0; c < ipConfigs.Count; c++)
|
||||
{
|
||||
if ((ipConfigs[c].IPAddress.Hash & ipConfigs[c].SubnetMask.Hash) ==
|
||||
(destIP.Hash & ipConfigs[c].SubnetMask.Hash))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
internal static NetworkDevice FindInterface(Address sourceIP)
|
||||
{
|
||||
return NetworkStack.AddressMap[sourceIP.Hash];
|
||||
}
|
||||
|
||||
internal static Address FindRoute(Address destIP)
|
||||
{
|
||||
for (int c = 0; c < ipConfigs.Count; c++)
|
||||
{
|
||||
if (ipConfigs[c].DefaultGateway.CompareTo(Address.Zero) != 0)
|
||||
{
|
||||
return ipConfigs[c].DefaultGateway;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected Address address;
|
||||
protected Address defaultGateway;
|
||||
protected Address subnetMask;
|
||||
|
||||
/// <summary>
|
||||
/// Create a IPv4 Configuration with no default gateway
|
||||
/// </summary>
|
||||
/// <param name="ip">IP Address</param>
|
||||
/// <param name="subnet">Subnet Mask</param>
|
||||
public Config(Address ip, Address subnet)
|
||||
: this(ip, subnet, Address.Zero)
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Create a IPv4 Configuration
|
||||
/// </summary>
|
||||
/// <param name="ip">IP Address</param>
|
||||
/// <param name="subnet">Subnet Mask</param>
|
||||
/// <param name="gw">Default gateway</param>
|
||||
public Config(Address ip, Address subnet, Address gw)
|
||||
{
|
||||
this.address = ip;
|
||||
this.subnetMask = subnet;
|
||||
this.defaultGateway = gw;
|
||||
}
|
||||
|
||||
public Address IPAddress
|
||||
{
|
||||
get { return this.address; }
|
||||
}
|
||||
public Address SubnetMask
|
||||
{
|
||||
get { return this.subnetMask; }
|
||||
}
|
||||
public Address DefaultGateway
|
||||
{
|
||||
get { return this.defaultGateway; }
|
||||
}
|
||||
}
|
||||
}
|
||||
224
source2/Kernel/System/Cosmos.System/Network/IPv4/ICMPPacket.cs
Normal file
224
source2/Kernel/System/Cosmos.System/Network/IPv4/ICMPPacket.cs
Normal file
|
|
@ -0,0 +1,224 @@
|
|||
using System;
|
||||
using Sys = System;
|
||||
|
||||
namespace Cosmos.System.Network.IPv4
|
||||
{
|
||||
internal class ICMPPacket : IPPacket
|
||||
{
|
||||
protected byte icmpType;
|
||||
protected byte icmpCode;
|
||||
protected UInt16 icmpCRC;
|
||||
|
||||
internal static void ICMPHandler(byte[] packetData)
|
||||
{
|
||||
ICMPPacket icmp_packet = new ICMPPacket(packetData);
|
||||
icmp_packet.initICMPFields();
|
||||
//Sys.Console.WriteLine("Received " + icmp_packet.ToString());
|
||||
switch (icmp_packet.ICMP_Type)
|
||||
{
|
||||
case 0:
|
||||
ICMPEchoReply recvd_reply = new ICMPEchoReply(packetData);
|
||||
recvd_reply.initICMPEchoFields();
|
||||
Sys.Console.WriteLine("Received ICMP Echo reply from " + recvd_reply.SourceIP.ToString());
|
||||
break;
|
||||
case 8:
|
||||
ICMPEchoRequest request = new ICMPEchoRequest(packetData);
|
||||
request.initICMPEchoFields();
|
||||
Sys.Console.WriteLine("Received " + request.ToString());
|
||||
ICMPEchoReply reply = new ICMPEchoReply(request);
|
||||
Sys.Console.WriteLine("Sending ICMP Echo reply to " + reply.DestinationIP.ToString());
|
||||
OutgoingBuffer.AddPacket(reply);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public ICMPPacket(byte[] rawData)
|
||||
: base(rawData)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void initFields()
|
||||
{
|
||||
Sys.Console.WriteLine("ICMPPacket.initFields() called;");
|
||||
base.initFields();
|
||||
icmpType = mRawData[this.dataOffset];
|
||||
icmpCode = mRawData[this.dataOffset + 1];
|
||||
icmpCRC = (UInt16)((mRawData[this.dataOffset + 2] << 8) | mRawData[this.dataOffset + 3]);
|
||||
}
|
||||
|
||||
// TODO: Temporary until we have a fix for the VMT Scan issue
|
||||
internal void initICMPFields()
|
||||
{
|
||||
icmpType = mRawData[this.dataOffset];
|
||||
icmpCode = mRawData[this.dataOffset + 1];
|
||||
icmpCRC = (UInt16)((mRawData[this.dataOffset + 2] << 8) | mRawData[this.dataOffset + 3]);
|
||||
}
|
||||
|
||||
internal ICMPPacket(Address source, Address dest, byte type, byte code, UInt16 id, UInt16 seq, UInt16 icmpDataSize)
|
||||
: base(icmpDataSize, 1, source, dest)
|
||||
{
|
||||
mRawData[this.dataOffset] = type;
|
||||
mRawData[this.dataOffset + 1] = code;
|
||||
mRawData[this.dataOffset + 2] = 0x00;
|
||||
mRawData[this.dataOffset + 3] = 0x00;
|
||||
mRawData[this.dataOffset + 4] = (byte)((id >> 8) & 0xFF);
|
||||
mRawData[this.dataOffset + 5] = (byte)((id >> 0) & 0xFF);
|
||||
mRawData[this.dataOffset + 6] = (byte)((seq >> 8) & 0xFF);
|
||||
mRawData[this.dataOffset + 7] = (byte)((seq >> 0) & 0xFF);
|
||||
|
||||
icmpCRC = CalcICMPCRC((UInt16)(icmpDataSize + 8));
|
||||
mRawData[this.dataOffset + 2] = (byte)((icmpCRC >> 8) & 0xFF);
|
||||
mRawData[this.dataOffset + 3] = (byte)((icmpCRC >> 0) & 0xFF);
|
||||
initFields();
|
||||
}
|
||||
|
||||
protected UInt16 CalcICMPCRC(UInt16 length)
|
||||
{
|
||||
return CalcOcCRC(this.dataOffset, length);
|
||||
}
|
||||
|
||||
internal byte ICMP_Type
|
||||
{
|
||||
get { return this.icmpType; }
|
||||
}
|
||||
internal byte ICMP_Code
|
||||
{
|
||||
get { return this.icmpCode; }
|
||||
}
|
||||
internal UInt16 ICMP_CRC
|
||||
{
|
||||
get { return this.icmpCRC; }
|
||||
}
|
||||
internal UInt16 ICMP_DataLength
|
||||
{
|
||||
get { return (UInt16)(this.DataLength - 8); }
|
||||
}
|
||||
|
||||
internal byte[] GetICMPData()
|
||||
{
|
||||
byte[] data = new byte[ICMP_DataLength];
|
||||
|
||||
for (int b = 0; b < ICMP_DataLength; b++)
|
||||
{
|
||||
data[b] = mRawData[this.dataOffset + 8 + b];
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "ICMP Packet Src=" + sourceIP + ", Dest=" + destIP + ", Type=" + icmpType + ", Code=" + icmpCode;
|
||||
}
|
||||
}
|
||||
|
||||
internal class ICMPEchoRequest : ICMPPacket
|
||||
{
|
||||
protected UInt16 icmpID;
|
||||
protected UInt16 icmpSequence;
|
||||
|
||||
internal ICMPEchoRequest(byte[] rawData)
|
||||
: base(rawData)
|
||||
{
|
||||
}
|
||||
|
||||
internal ICMPEchoRequest(Address source, Address dest, UInt16 id, UInt16 sequence)
|
||||
: base(source, dest, 8, 0, id, sequence, 40)
|
||||
{
|
||||
for (byte b = 8; b < this.ICMP_DataLength; b++)
|
||||
{
|
||||
mRawData[this.dataOffset + b] = b;
|
||||
}
|
||||
|
||||
mRawData[this.dataOffset + 2] = 0x00;
|
||||
mRawData[this.dataOffset + 3] = 0x00;
|
||||
icmpCRC = CalcICMPCRC((UInt16)(this.ICMP_DataLength + 8));
|
||||
mRawData[this.dataOffset + 2] = (byte)((icmpCRC >> 8) & 0xFF);
|
||||
mRawData[this.dataOffset + 3] = (byte)((icmpCRC >> 0) & 0xFF);
|
||||
}
|
||||
|
||||
protected override void initFields()
|
||||
{
|
||||
base.initFields();
|
||||
icmpID = (UInt16)((mRawData[this.dataOffset + 4] << 8) | mRawData[this.dataOffset + 5]);
|
||||
icmpSequence = (UInt16)((mRawData[this.dataOffset + 6] << 8) | mRawData[this.dataOffset + 7]);
|
||||
}
|
||||
|
||||
// TODO: Temporary until we have a fix for the VMT Scan issue
|
||||
internal void initICMPEchoFields()
|
||||
{
|
||||
base.initICMPFields();
|
||||
icmpID = (UInt16)((mRawData[this.dataOffset + 4] << 8) | mRawData[this.dataOffset + 5]);
|
||||
icmpSequence = (UInt16)((mRawData[this.dataOffset + 6] << 8) | mRawData[this.dataOffset + 7]);
|
||||
}
|
||||
|
||||
internal UInt16 ICMP_ID
|
||||
{
|
||||
get { return this.icmpID; }
|
||||
}
|
||||
internal UInt16 ICMP_Sequence
|
||||
{
|
||||
get { return this.icmpSequence; }
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "ICMP Echo Request Src=" + sourceIP + ", Dest=" + destIP + ", ID=" + icmpID + ", Sequence=" + icmpSequence;
|
||||
}
|
||||
}
|
||||
internal class ICMPEchoReply : ICMPPacket
|
||||
{
|
||||
protected UInt16 icmpID;
|
||||
protected UInt16 icmpSequence;
|
||||
|
||||
internal ICMPEchoReply(byte[] rawData)
|
||||
: base(rawData)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void initFields()
|
||||
{
|
||||
base.initFields();
|
||||
icmpID = (UInt16)((mRawData[this.dataOffset + 4] << 8) | mRawData[this.dataOffset + 5]);
|
||||
icmpSequence = (UInt16)((mRawData[this.dataOffset + 6] << 8) | mRawData[this.dataOffset + 7]);
|
||||
}
|
||||
|
||||
// TODO: Temporary until we have a fix for the VMT Scan issue
|
||||
internal void initICMPEchoFields()
|
||||
{
|
||||
base.initICMPFields();
|
||||
icmpID = (UInt16)((mRawData[this.dataOffset + 4] << 8) | mRawData[this.dataOffset + 5]);
|
||||
icmpSequence = (UInt16)((mRawData[this.dataOffset + 6] << 8) | mRawData[this.dataOffset + 7]);
|
||||
}
|
||||
|
||||
internal ICMPEchoReply(ICMPEchoRequest request)
|
||||
: base(request.DestinationIP, request.SourceIP, 0, 0,
|
||||
request.ICMP_ID, request.ICMP_Sequence, (UInt16)(request.ICMP_DataLength + 8))
|
||||
{
|
||||
for (int b = 0; b < this.ICMP_DataLength; b++)
|
||||
{
|
||||
mRawData[this.dataOffset + 8 + b] = request.RawData[this.dataOffset + 8 + b];
|
||||
}
|
||||
|
||||
mRawData[this.dataOffset + 2] = 0x00;
|
||||
mRawData[this.dataOffset + 3] = 0x00;
|
||||
icmpCRC = CalcICMPCRC((UInt16)(this.ICMP_DataLength + 8));
|
||||
mRawData[this.dataOffset + 2] = (byte)((icmpCRC >> 8) & 0xFF);
|
||||
mRawData[this.dataOffset + 3] = (byte)((icmpCRC >> 0) & 0xFF);
|
||||
}
|
||||
|
||||
internal UInt16 ICMP_ID
|
||||
{
|
||||
get { return this.icmpID; }
|
||||
}
|
||||
internal UInt16 ICMP_Sequence
|
||||
{
|
||||
get { return this.icmpSequence; }
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "ICMP Echo Reply Src=" + sourceIP + ", Dest=" + destIP + ", ID=" + icmpID + ", Sequence=" + icmpSequence;
|
||||
}
|
||||
}
|
||||
}
|
||||
200
source2/Kernel/System/Cosmos.System/Network/IPv4/IPPacket.cs
Normal file
200
source2/Kernel/System/Cosmos.System/Network/IPv4/IPPacket.cs
Normal file
|
|
@ -0,0 +1,200 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Cosmos.Core.Network;
|
||||
using Cosmos.System.Network.ARP;
|
||||
|
||||
namespace Cosmos.System.Network.IPv4
|
||||
{
|
||||
internal class IPPacket : EthernetPacket
|
||||
{
|
||||
protected byte ipVersion;
|
||||
protected byte ipHeaderLength;
|
||||
protected byte tos;
|
||||
protected UInt16 ipLength;
|
||||
protected UInt16 fragmentID;
|
||||
protected UInt16 fragmentOffset;
|
||||
protected byte flags;
|
||||
protected byte ttl;
|
||||
protected byte proto;
|
||||
protected UInt16 ipCRC;
|
||||
protected Address sourceIP;
|
||||
protected Address destIP;
|
||||
protected UInt16 dataOffset;
|
||||
|
||||
private static UInt16 sNextFragmentID;
|
||||
|
||||
internal static void IPv4Handler(byte[] packetData)
|
||||
{
|
||||
IPPacket ip_packet = new IPPacket(packetData);
|
||||
//Sys.Console.WriteLine("Received IP Packet");
|
||||
//Sys.Console.WriteLine(ip_packet.ToString());
|
||||
ARPCache.Update(ip_packet.SourceIP, ip_packet.SourceMAC);
|
||||
|
||||
if ((NetworkStack.AddressMap.ContainsKey(ip_packet.DestinationIP.Hash) == true) ||
|
||||
(ip_packet.DestinationIP.address[3] == 255))
|
||||
{
|
||||
switch (ip_packet.Protocol)
|
||||
{
|
||||
case 1:
|
||||
ICMPPacket.ICMPHandler(packetData);
|
||||
break;
|
||||
//case 6:
|
||||
// IPv4_TCPHandler(packetData);
|
||||
// break;
|
||||
//case 17:
|
||||
// IPv4_UDPHandler(packetData);
|
||||
// break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static UInt16 NextIPFragmentID
|
||||
{
|
||||
get
|
||||
{
|
||||
return sNextFragmentID++;
|
||||
}
|
||||
}
|
||||
|
||||
internal IPPacket(byte[] rawData)
|
||||
: base(rawData)
|
||||
{ }
|
||||
|
||||
protected override void initFields()
|
||||
{
|
||||
base.initFields();
|
||||
ipVersion = (byte)((mRawData[14] & 0xF0) >> 4);
|
||||
ipHeaderLength = (byte)(mRawData[14] & 0x0F);
|
||||
tos = mRawData[15];
|
||||
ipLength = (UInt16)((mRawData[16] << 8) | mRawData[17]);
|
||||
fragmentID = (UInt16)((mRawData[18] << 8) | mRawData[19]);
|
||||
flags = (byte)((mRawData[20] & 0xE0) >> 5);
|
||||
fragmentOffset = (UInt16)(((mRawData[20] & 0x1F) << 8) | mRawData[21]);
|
||||
ttl = mRawData[22];
|
||||
proto = mRawData[23];
|
||||
ipCRC = (UInt16)((mRawData[24] << 8) | mRawData[25]);
|
||||
sourceIP = new Address(mRawData, 26);
|
||||
destIP = new Address(mRawData, 30);
|
||||
dataOffset = (UInt16)(14 + HeaderLength);
|
||||
}
|
||||
|
||||
protected IPPacket(UInt16 dataLength, byte protocol, Address source, Address dest)
|
||||
: this(MACAddress.None, MACAddress.None, dataLength, protocol, source, dest)
|
||||
{ }
|
||||
|
||||
private IPPacket(MACAddress srcMAC, MACAddress destMAC, UInt16 dataLength, byte protocol,
|
||||
Address source, Address dest)
|
||||
: base(destMAC, srcMAC, 0x0800, dataLength + 14 + 20)
|
||||
{
|
||||
mRawData[14] = 0x45;
|
||||
mRawData[15] = 0;
|
||||
ipLength = (UInt16)(dataLength + 20);
|
||||
ipHeaderLength = 5;
|
||||
mRawData[16] = (byte)((ipLength >> 8) & 0xFF);
|
||||
mRawData[17] = (byte)((ipLength >> 0) & 0xFF);
|
||||
fragmentID = NextIPFragmentID;
|
||||
mRawData[18] = (byte)((fragmentID >> 8) & 0xFF);
|
||||
mRawData[19] = (byte)((fragmentID >> 0) & 0xFF);
|
||||
mRawData[20] = 0x00;
|
||||
mRawData[21] = 0x00;
|
||||
mRawData[22] = 0x80;
|
||||
mRawData[23] = protocol;
|
||||
mRawData[24] = 0x00;
|
||||
mRawData[25] = 0x00;
|
||||
for (int b = 0; b < 4; b++)
|
||||
{
|
||||
mRawData[26 + b] = source.address[b];
|
||||
mRawData[30 + b] = dest.address[b];
|
||||
}
|
||||
ipCRC = CalcIPCRC(20);
|
||||
mRawData[24] = (byte)((ipCRC >> 8) & 0xFF);
|
||||
mRawData[25] = (byte)((ipCRC >> 0) & 0xFF);
|
||||
|
||||
initFields();
|
||||
}
|
||||
|
||||
protected UInt16 CalcOcCRC(UInt16 offset, UInt16 length)
|
||||
{
|
||||
return IPPacket.CalcOcCRC(this.RawData, offset, length);
|
||||
}
|
||||
|
||||
protected static UInt16 CalcOcCRC(byte[] buffer, UInt16 offset, int length)
|
||||
{
|
||||
UInt32 crc = 0;
|
||||
|
||||
for (UInt16 w = offset; w < offset + length; w += 2)
|
||||
{
|
||||
crc += (UInt16)((buffer[w] << 8) | buffer[w + 1]);
|
||||
}
|
||||
|
||||
crc = (~((crc & 0xFFFF) + (crc >> 16)));
|
||||
|
||||
return (UInt16)crc;
|
||||
}
|
||||
|
||||
protected UInt16 CalcIPCRC(UInt16 headerLength)
|
||||
{
|
||||
return CalcOcCRC(14, headerLength);
|
||||
}
|
||||
|
||||
internal byte IPVersion
|
||||
{
|
||||
get { return this.ipVersion; }
|
||||
}
|
||||
internal UInt16 HeaderLength
|
||||
{
|
||||
get { return (UInt16)(this.ipHeaderLength * 4); }
|
||||
}
|
||||
internal byte TypeOfService
|
||||
{
|
||||
get { return this.tos; }
|
||||
}
|
||||
internal UInt16 IPLength
|
||||
{
|
||||
get { return this.ipLength; }
|
||||
}
|
||||
internal UInt16 FragmentID
|
||||
{
|
||||
get { return this.fragmentID; }
|
||||
}
|
||||
internal UInt16 FragmentOffset
|
||||
{
|
||||
get { return this.fragmentOffset; }
|
||||
}
|
||||
internal byte Flags
|
||||
{
|
||||
get { return this.flags; }
|
||||
}
|
||||
internal byte TTL
|
||||
{
|
||||
get { return this.ttl; }
|
||||
}
|
||||
internal byte Protocol
|
||||
{
|
||||
get { return this.proto; }
|
||||
}
|
||||
internal UInt16 IPCRC
|
||||
{
|
||||
get { return this.ipCRC; }
|
||||
}
|
||||
internal Address SourceIP
|
||||
{
|
||||
get { return this.sourceIP; }
|
||||
}
|
||||
internal Address DestinationIP
|
||||
{
|
||||
get { return this.destIP; }
|
||||
}
|
||||
internal UInt16 DataLength
|
||||
{
|
||||
get { return (UInt16)(this.ipLength - this.HeaderLength); }
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "IP Packet Src=" + sourceIP + ", Dest=" + destIP + ", Protocol=" + proto + ", TTL=" + ttl + ", DataLen=" + DataLength;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,156 @@
|
|||
using System.Collections.Generic;
|
||||
using Cosmos.Core.Network;
|
||||
using Cosmos.Hardware;
|
||||
using Cosmos.System.Network.ARP;
|
||||
|
||||
namespace Cosmos.System.Network.IPv4
|
||||
{
|
||||
internal static class OutgoingBuffer
|
||||
{
|
||||
private class BufferEntry
|
||||
{
|
||||
public enum EntryStatus { ADDED, ARP_SENT, ROUTE_ARP_SENT, JUST_SEND, DONE };
|
||||
|
||||
public NetworkDevice NIC;
|
||||
public IPPacket Packet;
|
||||
public EntryStatus Status;
|
||||
public Address nextHop;
|
||||
|
||||
public BufferEntry(NetworkDevice nic, IPPacket packet)
|
||||
{
|
||||
this.NIC = nic;
|
||||
this.Packet = packet;
|
||||
this.Status = EntryStatus.ADDED;
|
||||
}
|
||||
}
|
||||
|
||||
private static List<BufferEntry> queue;
|
||||
|
||||
private static void ensureQueueExists()
|
||||
{
|
||||
if (queue == null)
|
||||
{
|
||||
queue = new List<BufferEntry>();
|
||||
}
|
||||
}
|
||||
|
||||
internal static void AddPacket(IPPacket packet)
|
||||
{
|
||||
ensureQueueExists();
|
||||
NetworkDevice nic = Config.FindInterface(packet.SourceIP);
|
||||
packet.SourceMAC = nic.MACAddress;
|
||||
queue.Add(new BufferEntry(nic, packet));
|
||||
}
|
||||
|
||||
internal static void Send()
|
||||
{
|
||||
ensureQueueExists();
|
||||
if (queue.Count < 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//foreach (BufferEntry entry in queue)
|
||||
for (int e = 0; e < queue.Count; e++)
|
||||
{
|
||||
BufferEntry entry = queue[e];
|
||||
if (entry.Status == BufferEntry.EntryStatus.ADDED)
|
||||
{
|
||||
if (Config.IsLocalAddress(entry.Packet.DestinationIP) == false)
|
||||
{
|
||||
entry.nextHop = Config.FindRoute(entry.Packet.DestinationIP);
|
||||
if (entry.nextHop == null)
|
||||
{
|
||||
entry.Status = BufferEntry.EntryStatus.DONE;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ARPCache.Contains(entry.nextHop) == true)
|
||||
{
|
||||
entry.Packet.DestinationMAC = ARPCache.Resolve(entry.nextHop);
|
||||
|
||||
entry.NIC.QueueBytes(entry.Packet.RawData);
|
||||
|
||||
entry.Status = BufferEntry.EntryStatus.DONE;
|
||||
}
|
||||
else
|
||||
{
|
||||
ARPRequest_Ethernet arp_request = new ARPRequest_Ethernet(entry.NIC.MACAddress, entry.Packet.SourceIP,
|
||||
MACAddress.Broadcast, entry.nextHop);
|
||||
|
||||
entry.NIC.QueueBytes(arp_request.RawData);
|
||||
|
||||
entry.Status = BufferEntry.EntryStatus.ROUTE_ARP_SENT;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ARPCache.Contains(entry.Packet.DestinationIP) == true)
|
||||
{
|
||||
entry.Packet.DestinationMAC = ARPCache.Resolve(entry.Packet.DestinationIP);
|
||||
|
||||
entry.NIC.QueueBytes(entry.Packet.RawData);
|
||||
|
||||
entry.Status = BufferEntry.EntryStatus.DONE;
|
||||
}
|
||||
else
|
||||
{
|
||||
ARPRequest_Ethernet arp_request = new ARPRequest_Ethernet(entry.NIC.MACAddress, entry.Packet.SourceIP,
|
||||
MACAddress.Broadcast, entry.Packet.DestinationIP);
|
||||
|
||||
entry.NIC.QueueBytes(arp_request.RawData);
|
||||
|
||||
entry.Status = BufferEntry.EntryStatus.ARP_SENT;
|
||||
}
|
||||
}
|
||||
else if (entry.Status == BufferEntry.EntryStatus.JUST_SEND)
|
||||
{
|
||||
entry.NIC.QueueBytes(entry.Packet.RawData);
|
||||
|
||||
entry.Status = BufferEntry.EntryStatus.DONE;
|
||||
}
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
while (i < queue.Count)
|
||||
{
|
||||
if (queue[i].Status == BufferEntry.EntryStatus.DONE)
|
||||
{
|
||||
queue.RemoveAt(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal static void ARPCache_Update(ARPReply_Ethernet arp_reply)
|
||||
{
|
||||
ensureQueueExists();
|
||||
//foreach (BufferEntry entry in queue)
|
||||
for (int e = 0; e < queue.Count; e++)
|
||||
{
|
||||
BufferEntry entry = queue[e];
|
||||
if (entry.Status == BufferEntry.EntryStatus.ARP_SENT)
|
||||
{
|
||||
if (entry.Packet.DestinationIP.CompareTo(arp_reply.SenderIP) == 0)
|
||||
{
|
||||
entry.Packet.DestinationMAC = arp_reply.SenderMAC;
|
||||
|
||||
entry.Status = BufferEntry.EntryStatus.JUST_SEND;
|
||||
}
|
||||
}
|
||||
else if (entry.Status == BufferEntry.EntryStatus.ROUTE_ARP_SENT)
|
||||
{
|
||||
if (entry.nextHop.CompareTo(arp_reply.SenderIP) == 0)
|
||||
{
|
||||
entry.Packet.DestinationMAC = arp_reply.SenderMAC;
|
||||
|
||||
entry.Status = BufferEntry.EntryStatus.JUST_SEND;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
64
source2/Kernel/System/Cosmos.System/Network/NetworkStack.cs
Normal file
64
source2/Kernel/System/Cosmos.System/Network/NetworkStack.cs
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
using System;
|
||||
using Sys = System;
|
||||
using System.Collections.Generic;
|
||||
using Cosmos.Hardware;
|
||||
using Cosmos.System.Network.ARP;
|
||||
|
||||
namespace Cosmos.System.Network
|
||||
{
|
||||
/// <summary>
|
||||
/// Implement a Network Stack for all network devices and protocols
|
||||
/// </summary>
|
||||
public static class NetworkStack
|
||||
{
|
||||
internal static TempDictionary<NetworkDevice> AddressMap { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initialize the Network Stack to prepare it for operation
|
||||
/// </summary>
|
||||
internal static void Init()
|
||||
{
|
||||
AddressMap = new TempDictionary<NetworkDevice>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configure a IP configuration on the given network device.
|
||||
/// <remarks>Multiple IP Configurations can be made, like *nix environments</remarks>
|
||||
/// </summary>
|
||||
/// <param name="nic"><see cref="Cosmos.Hardware.NetworkDevice"/> that will have the assigned configuration</param>
|
||||
/// <param name="config"><see cref="Cosmos.System.Network.IPv4.Config"/> instance that defines the IP Address, Subnet
|
||||
/// Mask and Default Gateway for the device</param>
|
||||
public static void ConfigIP(NetworkDevice nic, IPv4.Config config)
|
||||
{
|
||||
AddressMap.Add(config.IPAddress.Hash, nic);
|
||||
IPv4.Config.Add(config);
|
||||
nic.DataReceived = HandlePacket;
|
||||
}
|
||||
|
||||
internal static void HandlePacket(byte[] packetData)
|
||||
{
|
||||
//Sys.Console.Write("Received Packet Length=");
|
||||
//Sys.Console.WriteLine(packetData.Length);
|
||||
//Sys.Console.WriteLine(BitConverter.ToString(packetData));
|
||||
|
||||
UInt16 etherType = (UInt16)((packetData[12] << 8) | packetData[13]);
|
||||
switch (etherType)
|
||||
{
|
||||
case 0x0806:
|
||||
ARPPacket.ARPHandler(packetData);
|
||||
break;
|
||||
case 0x0800:
|
||||
IPv4.IPPacket.IPv4Handler(packetData);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called continously to keep the Network Stack going.
|
||||
/// </summary>
|
||||
internal static void Update()
|
||||
{
|
||||
IPv4.OutgoingBuffer.Send();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,9 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace SSchockeTest
|
||||
namespace Cosmos.System.Network
|
||||
{
|
||||
public class TempDictionary<TValue>
|
||||
internal class TempDictionary<TValue>
|
||||
{
|
||||
private List<UInt32> mKeys;
|
||||
private List<TValue> mValues;
|
||||
|
|
@ -75,6 +75,8 @@
|
|||
<Compile Include="Bootstrap.cs" />
|
||||
<Compile Include="IOGroup\COM.cs" />
|
||||
<Compile Include="IOGroup\PCSpeaker.cs" />
|
||||
<Compile Include="ManagedMemoryBlock.cs" />
|
||||
<Compile Include="Network\MACAddress.cs" />
|
||||
<Compile Include="PCIBaseAddressBar.cs" />
|
||||
<Compile Include="PCIDeviceNormal.cs" />
|
||||
<Compile Include="PCIDeviceBridge.cs" />
|
||||
|
|
|
|||
|
|
@ -1,10 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Cosmos.Core;
|
||||
|
||||
namespace SSchockeTest
|
||||
namespace Cosmos.Core
|
||||
{
|
||||
public unsafe class ManagedMemoryBlock
|
||||
{
|
||||
|
|
@ -1,9 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace SSchockeTest
|
||||
namespace Cosmos.Core.Network
|
||||
{
|
||||
public class MACAddress : IComparable
|
||||
{
|
||||
|
|
@ -75,12 +75,14 @@
|
|||
<Compile Include="BlockDevice\Partition.cs" />
|
||||
<Compile Include="Bootstrap.cs" />
|
||||
<Compile Include="Device.cs" />
|
||||
<Compile Include="Drivers\PCI\Network\AMDPCNetII.cs" />
|
||||
<Compile Include="Drivers\PCI\Video\VMWareSVGAII.cs" />
|
||||
<Compile Include="Drivers\VGAScreen.cs" />
|
||||
<Compile Include="Global.cs" />
|
||||
<Compile Include="Keyboard.cs" />
|
||||
<Compile Include="BlockDevice\AtaPio.cs" />
|
||||
<Compile Include="Mouse.cs" />
|
||||
<Compile Include="NetworkDevice.cs" />
|
||||
<Compile Include="PciDevice.cs" />
|
||||
<Compile Include="PIT.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
|
|
@ -88,6 +90,10 @@
|
|||
<Compile Include="TextScreen.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\IL2CPU\Cosmos.IL2CPU.Plugs\Cosmos.IL2CPU.Plugs.csproj">
|
||||
<Project>{C801F19C-A9D3-42D5-9A57-9FFDF9B4D05E}</Project>
|
||||
<Name>Cosmos.IL2CPU.Plugs</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Common\Cosmos.Common.Extensions\Cosmos.Common.Extensions.csproj">
|
||||
<Project>{1FAC100C-D732-4EA4-B518-5AF4BAF64F2E}</Project>
|
||||
<Name>Cosmos.Common.Extensions</Name>
|
||||
|
|
@ -112,6 +118,7 @@
|
|||
<Content Include="RTC.html" />
|
||||
<Content Include="TextScreen.html" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Cosmos.Common.Extensions;
|
||||
using Cosmos.Core;
|
||||
using Cosmos.Core.Network;
|
||||
using CompilerPlugs = Cosmos.IL2CPU.Plugs;
|
||||
|
||||
namespace SSchockeTest
|
||||
namespace Cosmos.Hardware.Drivers.PCI.Network
|
||||
{
|
||||
public class AMDPCNetII : NetworkDevice
|
||||
{
|
||||
|
|
@ -118,8 +119,7 @@ namespace SSchockeTest
|
|||
{
|
||||
UInt32 cur_status = StatusRegister;
|
||||
|
||||
Console.WriteLine("AMD PCNet IRQ raised!");
|
||||
|
||||
//Console.WriteLine("AMD PCNet IRQ raised!");
|
||||
if ((cur_status & 0x100) != 0)
|
||||
{
|
||||
mInitDone = true;
|
||||
|
|
@ -129,10 +129,10 @@ namespace SSchockeTest
|
|||
if (mTransmitBuffer.Count > 0)
|
||||
{
|
||||
byte[] data = mTransmitBuffer.Peek();
|
||||
//if (SendBytes(ref data) == true)
|
||||
//{
|
||||
// mTransmitBuffer.Dequeue();
|
||||
//}
|
||||
if (SendBytes(ref data) == true)
|
||||
{
|
||||
mTransmitBuffer.Dequeue();
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((cur_status & 0x400) != 0)
|
||||
|
|
@ -141,7 +141,7 @@ namespace SSchockeTest
|
|||
}
|
||||
|
||||
StatusRegister = cur_status;
|
||||
Global.PIC.EoiSlave();
|
||||
Cosmos.Core.Global.PIC.EoiSlave();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -150,7 +150,7 @@ namespace SSchockeTest
|
|||
public static void FindAll()
|
||||
{
|
||||
Console.WriteLine("Scanning for AMD PCNetII cards...");
|
||||
PCIDevice device = PCI.GetDevice(0x1022, 0x2000);
|
||||
PCIDevice device = Cosmos.Core.PCI.GetDevice(0x1022, 0x2000);
|
||||
if (device != null)
|
||||
{
|
||||
AMDPCNetII nic = new AMDPCNetII((PCIDeviceNormal)device);
|
||||
|
|
@ -229,9 +229,21 @@ namespace SSchockeTest
|
|||
return true;
|
||||
}
|
||||
|
||||
[CompilerPlugs.DebugStub(Off = true)]
|
||||
public override bool QueueBytes(byte[] buffer, int offset, int length)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
byte[] data = new byte[length];
|
||||
for (int b = 0; b < length; b++)
|
||||
{
|
||||
data[b] = buffer[b + offset];
|
||||
}
|
||||
|
||||
if (SendBytes(ref data) == false)
|
||||
{
|
||||
mTransmitBuffer.Enqueue(data);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool ReceiveBytes(byte[] buffer, int offset, int max)
|
||||
|
|
@ -241,25 +253,67 @@ namespace SSchockeTest
|
|||
|
||||
public override byte[] ReceivePacket()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
if (mRecvBuffer.Count < 1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
byte[] data = mRecvBuffer.Dequeue();
|
||||
return data;
|
||||
}
|
||||
|
||||
public override int BytesAvailable()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
if (mRecvBuffer.Count < 1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return mRecvBuffer.Peek().Length;
|
||||
}
|
||||
|
||||
public override bool IsSendBufferFull()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool IsReceiveBufferFull()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
return false;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Helper Functions
|
||||
[CompilerPlugs.DebugStub(Off = true)]
|
||||
protected bool SendBytes(ref byte[] aData)
|
||||
{
|
||||
int txd = mNextTXDesc++;
|
||||
if (mNextTXDesc >= 16)
|
||||
{
|
||||
mNextTXDesc = 0;
|
||||
}
|
||||
|
||||
uint xOffset = (uint)(txd * 16);
|
||||
UInt32 status = mTxDescriptor.Read32(xOffset + 4);
|
||||
if ((status & 0x80000000) == 0)
|
||||
{
|
||||
for (uint b = 0; b < aData.Length; b++)
|
||||
{
|
||||
mTxBuffers[txd][b] = aData[b];
|
||||
}
|
||||
UInt16 buffer_len = (UInt16)(aData.Length < 64 ? 64 : aData.Length);
|
||||
buffer_len = (UInt16)(~buffer_len);
|
||||
buffer_len++;
|
||||
|
||||
UInt32 flags = (UInt32)(buffer_len & 0x0FFF) | 0x0300F000 | 0x80000000;
|
||||
|
||||
mTxDescriptor.Write32(xOffset + 4, flags);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
[CompilerPlugs.DebugStub(Off = true)]
|
||||
private void ReadRawData()
|
||||
{
|
||||
uint status;
|
||||
|
|
@ -292,5 +346,6 @@ namespace SSchockeTest
|
|||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -3,8 +3,9 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using Cosmos.Hardware;
|
||||
using Cosmos.Core.Network;
|
||||
|
||||
namespace SSchockeTest
|
||||
namespace Cosmos.Hardware
|
||||
{
|
||||
public delegate void DataReceivedHandler(byte[] packetData);
|
||||
|
||||
|
|
@ -4,6 +4,10 @@ using System.Text;
|
|||
using Sys = Cosmos.System;
|
||||
using Cosmos.Core;
|
||||
using System.Net;
|
||||
using Cosmos.Hardware;
|
||||
using Cosmos.Hardware.Drivers.PCI.Network;
|
||||
using Cosmos.System.Network;
|
||||
using IPv4 = Cosmos.System.Network.IPv4;
|
||||
|
||||
namespace SSchockeTest
|
||||
{
|
||||
|
|
@ -104,19 +108,66 @@ namespace SSchockeTest
|
|||
// return x;
|
||||
//}
|
||||
|
||||
//internal class BaseClass
|
||||
//{
|
||||
// public int baseField;
|
||||
|
||||
// internal BaseClass()
|
||||
// {
|
||||
// initFields();
|
||||
// }
|
||||
|
||||
// protected virtual void initFields()
|
||||
// {
|
||||
// baseField = 1;
|
||||
// }
|
||||
//}
|
||||
//internal class SubClass : BaseClass
|
||||
//{
|
||||
// public int subField;
|
||||
|
||||
// internal SubClass()
|
||||
// : base()
|
||||
// {
|
||||
// }
|
||||
|
||||
// protected override void initFields()
|
||||
// {
|
||||
// base.initFields();
|
||||
// subField = 2;
|
||||
// }
|
||||
//}
|
||||
//internal class SubSubClass : SubClass
|
||||
//{
|
||||
// public int subsubField;
|
||||
|
||||
// internal SubSubClass()
|
||||
// :base()
|
||||
// {
|
||||
// }
|
||||
|
||||
// protected override void initFields()
|
||||
// {
|
||||
// base.initFields();
|
||||
// subsubField = 3;
|
||||
// }
|
||||
//}
|
||||
|
||||
protected override void BeforeRun()
|
||||
{
|
||||
Console.WriteLine("SSchocke Test Playground");
|
||||
|
||||
NetworkStack.Init();
|
||||
|
||||
Console.WriteLine("Finding network devices...");
|
||||
AMDPCNetII.FindAll();
|
||||
|
||||
AMDPCNetII nic = (AMDPCNetII)NetworkDevice.Devices[0];
|
||||
NetworkDevice nic = NetworkDevice.Devices[0];
|
||||
|
||||
IPAddress myIP = new IPAddress(new byte[] { 192, 168, 1, 51 });
|
||||
NetworkStack.ConfigIP(nic, myIP);
|
||||
IPv4.Address myIP = new IPv4.Address(192, 168, 1, 51);
|
||||
IPv4.Address mySubnet = new IPv4.Address(255, 255, 255, 0);
|
||||
IPv4.Address myGateway = new IPv4.Address(192, 168, 1, 1);
|
||||
IPv4.Config myConfig = new IPv4.Config(myIP, mySubnet, myGateway);
|
||||
|
||||
NetworkStack.ConfigIP(nic, myConfig);
|
||||
nic.Enable();
|
||||
|
||||
Console.WriteLine("Init Done... Starting main loop");
|
||||
|
|
@ -124,6 +175,14 @@ namespace SSchockeTest
|
|||
|
||||
protected override void Run()
|
||||
{
|
||||
//SubSubClass instance = new SubSubClass();
|
||||
|
||||
//Console.WriteLine("BaseClass.field = " + instance.baseField);
|
||||
//Console.WriteLine("SubClass.field = " + instance.subField);
|
||||
//Console.WriteLine("SubSubClass.field = " + instance.subsubField);
|
||||
|
||||
//Stop();
|
||||
|
||||
//RunSqrtTest();
|
||||
//FloatingPointTest();
|
||||
//MapTest();
|
||||
|
|
|
|||
|
|
@ -1,49 +0,0 @@
|
|||
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()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -36,37 +36,33 @@
|
|||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Cosmos.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983, processorArchitecture=x86">
|
||||
<HintPath>..\..\..\Kernel\System\Hardware\Cosmos.Hardware\bin\x86\Debug\Cosmos.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Cosmos.Debug.Kernel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983, processorArchitecture=x86">
|
||||
<HintPath>..\..\..\Kernel\System\Hardware\Cosmos.Hardware\bin\x86\Debug\Cosmos.Debug.Kernel.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Cosmos.Hardware, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983, processorArchitecture=x86">
|
||||
<HintPath>..\..\..\Kernel\System\Hardware\Cosmos.Hardware\bin\x86\Debug\Cosmos.Hardware.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Cosmos.System, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983, processorArchitecture=x86">
|
||||
<HintPath>..\..\..\Kernel\System\Cosmos.System\bin\x86\Debug\Cosmos.System.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AMDPCNetII.cs" />
|
||||
<Compile Include="BinaryHelper.cs" />
|
||||
<Compile Include="Kernel.cs" />
|
||||
<Compile Include="AssemblyInfo.cs" />
|
||||
<Compile Include="MACAddress.cs" />
|
||||
<Compile Include="ManagedMemoryBlock.cs" />
|
||||
<Compile Include="Map.cs" />
|
||||
<Compile Include="NetworkDevice.cs" />
|
||||
<Compile Include="NetworkStack.cs" />
|
||||
<Compile Include="TempDictionary.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\IL2CPU\Cosmos.IL2CPU.Plugs\Cosmos.IL2CPU.Plugs.csproj">
|
||||
<Project>{C801F19C-A9D3-42D5-9A57-9FFDF9B4D05E}</Project>
|
||||
<Name>Cosmos.IL2CPU.Plugs</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Kernel\System\Cosmos.System\Cosmos.System.csproj">
|
||||
<Project>{DA50B9B2-0E95-4F0D-A3C8-79FC549301B5}</Project>
|
||||
<Name>Cosmos.System</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Kernel\System\Hardware\Core\Cosmos.Core\Cosmos.Core.csproj">
|
||||
<Project>{5AC4773C-CB4E-4CD9-8D50-02E10A07DEE6}</Project>
|
||||
<Name>Cosmos.Core</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Kernel\System\Hardware\Cosmos.Hardware\Cosmos.Hardware.csproj">
|
||||
<Project>{6A991D03-1435-4005-9809-B8BACDF3B021}</Project>
|
||||
<Name>Cosmos.Hardware</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
|
|
|||
Loading…
Reference in a new issue