private static void SetConfigIP(NetworkDevice nic, IPV4.Config config) { NetworkConfig.Add(nic, config); AddressMap.Add(config.IPAddress.Hash, nic); MACMap.Add(nic.MACAddress.Hash, nic); IPV4.Config.Add(config); nic.DataReceived = HandlePacket; }
public static void RemoveIPConfig(NetworkDevice nic) { IPV4.Config config = NetworkConfig.Get(nic); AddressMap.Remove(config.IPAddress.Hash); MACMap.Remove(nic.MACAddress.Hash); IPV4.Config.Remove(config); NetworkConfig.Remove(nic); }
/// <summary> /// Configure a IP configuration on the given network device. /// <remarks>Multiple IP Configurations can be made, like *nix environments</remarks> /// </summary> /// <param name="nic"><see cref="NetworkDevice"/> that will have the assigned configuration</param> /// <param name="config"><see cref="IPV4.Config"/> instance that defines the IP Address, Subnet /// Mask and Default Gateway for the device</param> public static void ConfigIP(NetworkDevice nic, IPV4.Config config) { if (NetworkConfig.ContainsKey(nic)) { RemoveIPConfig(nic); SetConfigIP(nic, config); } else { SetConfigIP(nic, config); } }
/// <summary> /// Configure a IP configuration on the given network device. /// <remarks>Multiple IP Configurations can be made, like *nix environments</remarks> /// </summary> /// <param name="nic"><see cref="NetworkDevice"/> that will have the assigned configuration</param> /// <param name="config"><see cref="IPV4.Config"/> instance that defines the IP Address, Subnet /// Mask and Default Gateway for the device</param> public static void ConfigIP(NetworkDevice nic, Config config) { if (NetworkConfig.ContainsKey(nic)) { RemoveIPConfig(nic); SetConfigIP(nic, config); } else { SetConfigIP(nic, config); } NetworkConfig.CurrentConfig = new KeyValuePair <NetworkDevice, Config>(nic, config); }
/// <summary> /// Configure a IP configuration on the given network device. /// <remarks>Multiple IP Configurations can be made, like *nix environments</remarks> /// </summary> /// <param name="nic"><see cref="NetworkDevice"/> that will have the assigned configuration</param> /// <param name="config"><see cref="IPV4.Config"/> instance that defines the IP Address, Subnet /// Mask and Default Gateway for the device</param> public static void ConfigIP(NetworkDevice nic, IPV4.Config config) { if (NetworkConfig.ContainsKey(nic)) { CustomConsole.WriteLineInfo("Config existante"); IPV4.Config toremove = NetworkConfig.Get(nic); AddressMap.Remove(toremove.IPAddress.Hash); MACMap.Remove(nic.MACAddress.Hash); IPV4.Config.Remove(config); NetworkConfig.Remove(nic); SetConfigIP(nic, config); } else { SetConfigIP(nic, config); } }