Starting towards traceroute
This commit is contained in:
parent
98c524c1f9
commit
1ebf932edb
@ -29,7 +29,8 @@ namespace EduNetworkBuilder
|
||||
}
|
||||
public enum VLANTagType { Tagged, Untagged, Forbidden }
|
||||
public enum LinkType { normal, wireless, broken }
|
||||
public enum PacketType { none, ping_request, ping_answer, arp_request, arp_answer, dhcp_request, dhcp_answer, vpn_packet, tun_packet }
|
||||
public enum PacketType { none, ping_request, ping_answer, arp_request, arp_answer, dhcp_request,
|
||||
dhcp_answer, vpn_packet, tun_packet, tracert_request, tracert_reply }
|
||||
public enum ResponseToPacket { none, accept, masq, drop, reject }
|
||||
public enum DebugLevel { none=0, info=1, routing=2, switching=4, natting=8, filtering=16, debug=32 , packet=64, all=127}
|
||||
public enum NetworkComponentType { none, router, net_switch, net_hub, laptop, pc, server, wap ,
|
||||
|
@ -617,6 +617,8 @@ namespace EduNetworkBuilder
|
||||
{
|
||||
pbNetworkView.ContextMenuStrip.Items.Add(NB.Translate("_Ping1"));
|
||||
pbNetworkView.ContextMenuStrip.Items[index++].Click += pbNetworkView_Ping_Click;
|
||||
pbNetworkView.ContextMenuStrip.Items.Add(NB.Translate("_Traceroute"));
|
||||
pbNetworkView.ContextMenuStrip.Items[index++].Click += pbNetworkView_Traceroute_Click;
|
||||
pbNetworkView.ContextMenuStrip.Items.Add(NB.Translate("H_ARP_Title"));
|
||||
pbNetworkView.ContextMenuStrip.Items[index++].Click += pbNetworkView_Arp_Click;
|
||||
pbNetworkView.ContextMenuStrip.Items.Add(NB.Translate("NB_NetViewClr"));
|
||||
@ -812,6 +814,21 @@ namespace EduNetworkBuilder
|
||||
UpdateMessages();
|
||||
}
|
||||
}
|
||||
|
||||
private void pbNetworkView_Traceroute_Click(object sender, EventArgs e)
|
||||
{
|
||||
bool todo = true;
|
||||
if (ItemClickedOn == null) return; //we do not have something chosen to traceroute from
|
||||
IPAddress destination = new IPAddress(NB.ZeroIPString, NB.ZeroIPString, IPAddressType.ip_only);
|
||||
todo = destination.Edit(ItemClickedOn, this, NB.Translate("_Traceroute"));
|
||||
if (todo)
|
||||
{
|
||||
//ItemClickedOn.PingFromHere(destination);
|
||||
//myNetwork.ProcessPackets();
|
||||
//UpdateMessages();
|
||||
}
|
||||
}
|
||||
|
||||
private void pbNetworkView_Ping_Name_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (ItemClickedOn == null) return; //we do not have something chosen to ping from
|
||||
|
@ -1277,6 +1277,16 @@ namespace EduNetworkBuilder
|
||||
myNet.addPacket(PingPacket);
|
||||
}
|
||||
|
||||
public void TracerouteFromHere(IPAddress Destination)
|
||||
{
|
||||
//We need to create a packet
|
||||
Packet TracertPacket = new Packet(this, Destination, NB.Translate("_Traceroute"), PacketType.tracert_request, -1, 1);
|
||||
Network myNet = NB.GetNetwork();
|
||||
//string dHost = myNet.ReverseDNSLookup(this, Destination);
|
||||
//myNet.RegisterPingTest(hostname, dHost);
|
||||
myNet.addPacket(TracertPacket);
|
||||
}
|
||||
|
||||
public void AskArpFromHere(IPAddress Destination, PacketMessage Tracker=null)
|
||||
{
|
||||
//We need to create a packet
|
||||
|
@ -115,7 +115,7 @@ namespace EduNetworkBuilder
|
||||
}
|
||||
|
||||
//Generate a packet with the given payload.
|
||||
public Packet(NetworkComponent start, string source, string dest, string payload, PacketType theType, int NewPacketID=-1)
|
||||
public Packet(NetworkComponent start, string source, string dest, string payload, PacketType theType, int NewPacketID=-1, int startTTL = -1)
|
||||
{
|
||||
if (NewPacketID == -1)
|
||||
{
|
||||
@ -125,6 +125,7 @@ namespace EduNetworkBuilder
|
||||
{
|
||||
packetID = NewPacketID;
|
||||
}
|
||||
if (startTTL != -1) this.TTL = startTTL;
|
||||
WhereAmI = start;
|
||||
payloadData = payload;
|
||||
MyType = theType;
|
||||
@ -154,7 +155,7 @@ namespace EduNetworkBuilder
|
||||
isFresh = true;
|
||||
}
|
||||
|
||||
public Packet(NetworkComponent start, IPAddress dest, string payload, PacketType theType, int NewPacketID = -1)
|
||||
public Packet(NetworkComponent start, IPAddress dest, string payload, PacketType theType, int NewPacketID = -1, int startTTL =-1)
|
||||
{
|
||||
WhereAmI = start;
|
||||
payloadData = payload;
|
||||
@ -168,6 +169,9 @@ namespace EduNetworkBuilder
|
||||
packetID = NewPacketID;
|
||||
}
|
||||
|
||||
if (startTTL != -1) this.TTL = startTTL;
|
||||
|
||||
|
||||
if (theType != PacketType.arp_answer && theType != PacketType.arp_request)
|
||||
{
|
||||
sourceIP = new IPAddress(NB.ZeroIPString);
|
||||
|
@ -1657,4 +1657,8 @@
|
||||
<value>Device cannot respond - Packet Failed</value>
|
||||
<comment>ND_DoInputFromLink_PowerOff = Device cannot respond - Packet Failed</comment>
|
||||
</data>
|
||||
<data name="_Traceroute" xml:space="preserve">
|
||||
<value>Traceroute</value>
|
||||
<comment>_Traceroute = Traceroute</comment>
|
||||
</data>
|
||||
</root>
|
Loading…
Reference in New Issue
Block a user