Arp and clearArp as doactions

This commit is contained in:
Tim Young 2018-05-07 09:43:50 -05:00
parent 8e0fdd9105
commit 06ca7c59f3
3 changed files with 34 additions and 3 deletions

View File

@ -139,6 +139,10 @@ namespace EduNetworkBuilder
case NBAction.dhcp:
break;
case NBAction.arp:
source.AskArpFromHere(Destination);
break;
case NBAction.cleararp:
source.ClearArps();
break;
case NBAction.ping:
source.PingFromHere(Destination) ;

View File

@ -104,7 +104,9 @@ namespace EduNetworkBuilder
public enum HowToBreak { PowerOff, EthernetBreak, EthernetCorrupt, EthernetRemoveLink, LockOutSwitch,
WirelessBreakSSID, WirelessBreakKey, DeviceChangeIP, DeviceChangeGW, StaticRouteClear,
StaticRouteCorrupt, VLANChange, VPNChangeEndpoint, VPNChangeKey, BreakDevice }
public enum NBAction { none, newdevice, changelocation, changedevice, deletecomponent, ping, traceroute, arp, dhcp }
public enum NBAction { none, newdevice, changelocation, changedevice, deletecomponent,
ping, traceroute, arp, cleararp, dhcp }
[Serializable]
public struct HostNicID //This holds a unique identifier for a network card. Links use this to know what it is connected to
@ -1405,6 +1407,29 @@ namespace EduNetworkBuilder
AC.DoAction();
}
public static void DoActionArpDevice(int HostID, NB_IPAddress Destination)
{
ActionClass AC = new ActionClass();
AC.Action = NBAction.arp;
AC.SourceID = HostID;
AC.Destination = Destination;
RegisterAction(AC);
AC.DoAction();
}
public static void DoActionClearArpDevice(int HostID)
{
ActionClass AC = new ActionClass();
AC.Action = NBAction.cleararp;
AC.SourceID = HostID;
RegisterAction(AC);
AC.DoAction();
}
#endregion ActionFunctions

View File

@ -1494,7 +1494,8 @@ namespace EduNetworkBuilder
todo = destination.Edit(ItemClickedOn, this, NB.Translate("H_ARP_Title2"));
if (todo)
{
ItemClickedOn.AskArpFromHere(destination);
//ItemClickedOn.AskArpFromHere(destination);
NB.DoActionArpDevice(ItemClickedOn.GetUniqueIdentifier, destination);
myNetwork.ProcessPackets();
UpdateMessages();
}
@ -1503,7 +1504,8 @@ namespace EduNetworkBuilder
private void pbNetworkView_ArpClear_Click(object sender, EventArgs e)
{
if (ItemClickedOn == null) return; //we do not have something chosen to arp request from
ItemClickedOn.ClearArps();
//ItemClickedOn.ClearArps();
NB.DoActionClearArpDevice(ItemClickedOn.GetUniqueIdentifier);
}
private void pbNetworkView_MouseUp(object sender, MouseEventArgs e)