Exemple #1
0
 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);
 }
Exemple #2
0
 public 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;
 }
Exemple #3
0
 /// <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);
     }
 }
Exemple #4
0
 /// <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);
     }
 }