Add functions to find the devices connected to this device
This commit is contained in:
parent
a72aec9f9a
commit
fded1f454a
@ -655,6 +655,53 @@ namespace EduNetworkBuilder
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the list of devices connected to this device
|
||||
/// </summary>
|
||||
/// <returns>A list of devices</returns>
|
||||
List<NetworkDevice> ConnectedTo()
|
||||
{
|
||||
List<NetworkDevice> connected = new List<NetworkDevice>();
|
||||
foreach(NetworkCard nic in NICs)
|
||||
{
|
||||
NetworkDevice nd = ConnectedTo(nic);
|
||||
if (nd != null) connected.Add(nd);
|
||||
}
|
||||
return connected;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// return the device this nic is attached to
|
||||
/// </summary>
|
||||
/// <param name="NIC"></param>
|
||||
/// <returns></returns>
|
||||
NetworkDevice ConnectedTo(NetworkCard NIC)
|
||||
{
|
||||
return NIC.ConnectedTo();
|
||||
}
|
||||
/// <summary>
|
||||
/// return the device this nic is attached to
|
||||
/// </summary>
|
||||
/// <param name="NIC">the network card ID</param>
|
||||
/// <returns></returns>
|
||||
NetworkDevice ConnectedTo(HostNicID NIC)
|
||||
{
|
||||
NetworkCard nic = NicFromID(NIC);
|
||||
if (nic == null) return null;
|
||||
return nic.ConnectedTo();
|
||||
}
|
||||
/// <summary>
|
||||
/// return the device this nic is attached to
|
||||
/// </summary>
|
||||
/// <param name="nicname">The network card name</param>
|
||||
/// <returns></returns>
|
||||
NetworkDevice ConnectedTo(string nicname)
|
||||
{
|
||||
NetworkCard nic = NicFromName(nicname);
|
||||
if (nic == null) return null;
|
||||
return nic.ConnectedTo();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check to see if the device has a link to the specified host
|
||||
/// </summary>
|
||||
|
Loading…
Reference in New Issue
Block a user