mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-20 21:08:51 +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.6 KiB
C#
53 lines
1.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using Cosmos.Sys.Network;
|
|
using Cosmos.Hardware.Network.Devices.RTL8139;
|
|
using System.Net;
|
|
using Cosmos.Hardware;
|
|
|
|
namespace FrodeTest.Application
|
|
{
|
|
public class ping : IConsoleApplication
|
|
{
|
|
public int Execute(string[] args)
|
|
{
|
|
//Parse args into a host/ip
|
|
//System.Net.IPAddress xDestinationIP = IPAddress.Parse("172.28.5.10");
|
|
uint xDestinationIP = 999; //TODO
|
|
|
|
//Get my own IP
|
|
uint xSourceIP = 1; //TODO
|
|
|
|
//Send ICMP Ping Request packet towards that host
|
|
var xNic = Cosmos.Hardware.Network.NetworkDevice.NetworkDevices[0];
|
|
xNic.Enable();
|
|
|
|
byte[] xPingData = {(byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f'};
|
|
var xPingOut = new ICMPPacket(xSourceIP, xDestinationIP, ICMPPacket.ICMPType.EchoRequest, xPingData, 0);
|
|
|
|
if (xNic.QueueBytes(xPingOut.GetData()))
|
|
{
|
|
DebugUtil.SendMessage("ping.cs", "Leaving Execute");
|
|
return 0;
|
|
}
|
|
else
|
|
{
|
|
DebugUtil.SendMessage("ping.cs", "Leaving Execute");
|
|
return -1;
|
|
}
|
|
|
|
//Wait for response back
|
|
}
|
|
|
|
public string CommandName
|
|
{
|
|
get { return "ping"; }
|
|
}
|
|
|
|
public string Description
|
|
{
|
|
get { return "Pings a destination with ICMP"; }
|
|
}
|
|
}
|
|
}
|