mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-20 04:48:53 +00:00
Update Global to call driver initialization routines for different drivers. Devices are enumerated during startup regardless of what hardware you are using. Update FrodeTest workspace to run via new NetworkDevice interface Update Builder.cs so that QEMU gets called with only either "-net tap" or "-net user", as these two options conflict Internalized most of the TCP/IP stack leaving only the User needed classes available to use. Commented most of TCP/IP stack public methods, and cleaned out code a little bit.
53 lines
1.5 KiB
C#
53 lines
1.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using Cosmos.Sys.Network;
|
|
|
|
namespace FrodeTest.Test
|
|
{
|
|
class ICMPv4Test
|
|
{
|
|
public static void RunTest()
|
|
{
|
|
|
|
//Create a ICMP packet
|
|
ICMPPacket xICMP = new ICMPPacket(
|
|
0xAC1C0606, //172.28.6.6
|
|
0xAC1C050A, //172.28.5.10
|
|
ICMPPacket.ICMPType.EchoRequest,
|
|
new byte[]
|
|
{
|
|
(byte)'a',
|
|
(byte)'b',
|
|
(byte)'c',
|
|
(byte)'d',
|
|
(byte)'e',
|
|
(byte)'f',
|
|
(byte)'g',
|
|
(byte)'h',
|
|
(byte)'i',
|
|
(byte)'j',
|
|
(byte)'k',
|
|
(byte)'l',
|
|
(byte)'m',
|
|
(byte)'n',
|
|
(byte)'o'
|
|
},
|
|
0x0 //Code
|
|
);
|
|
|
|
//Wrap ICMP packet inside EthernetPacket
|
|
var xEthernet = new EthernetPacket(
|
|
xICMP.GetData(),
|
|
0x525400123457, 0xFFFFFFFFFFFF
|
|
, EthernetPacket.PacketType.IP);
|
|
|
|
//Send EthernetPacket using RTL8139 network card
|
|
var nic = Cosmos.Hardware.Network.NetworkDevice.NetworkDevices[0];
|
|
nic.Enable();
|
|
|
|
nic.QueueBytes(xEthernet.GetData());
|
|
}
|
|
}
|
|
}
|