ln.skyscanner/entities/NetworkInterface.cs

66 lines
1.6 KiB
C#

// /**
// * File: Router.cs
// * Author: haraldwolff
// *
// * This file and it's content is copyrighted by the Author and / or copyright holder.
// * Any use wihtout proper permission is illegal and may lead to legal actions.
// *
// *
// **/
using System;
using System.Collections.Generic;
using ln.types.net;
namespace ln.skyscanner.entities
{
public class NetworkInterface
{
public readonly Guid ID = Guid.NewGuid();
public string Name { get; private set; } = "";
public string HWAddress { get; set; } = "";
public List<ConfiguredIP> ConfiguredIPs { get; private set; } = new List<ConfiguredIP>();
private NetworkInterface()
{ }
public NetworkInterface(String name)
{
Name = name;
}
public bool HasIP(IPv4 ip)
{
foreach (ConfiguredIP ifip in ConfiguredIPs)
{
if (ifip.IP.Equals(ip))
return true;
}
return false;
}
public override int GetHashCode()
{
return Name.GetHashCode();
}
public override bool Equals(object obj)
{
if (obj is NetworkInterface)
{
NetworkInterface networkInterface = obj as NetworkInterface;
return object.Equals(Name,networkInterface.Name);
}
return false;
}
public override string ToString()
{
return string.Format("[NetworkInterface ID={0} Name={1}]",ID,Name);
}
}
}