ln.skyscanner/entities/Subnet.cs

62 lines
1.5 KiB
C#

// /**
// * File: Subnet.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 ln.types;
using ln.types.odb;
using System.Collections.Generic;
using System.Linq;
namespace ln.skyscanner.entities
{
public class Subnet : Persistent
{
public GlobalNetwork GlobalNetwork { get; private set; }
public readonly CIDR Network;
public String Name;
public DateTime FirstSeen;
public DateTime LastScan;
public DateTime NextScan;
public NetworkInterface[] AttachedInterfaces => networkInterfaces.ToArray();
private HashSet<NetworkInterface> networkInterfaces = new HashSet<NetworkInterface>();
private Subnet()
{
}
public Subnet(GlobalNetwork globalNetwork,CIDR cidr)
{
GlobalNetwork = globalNetwork;
Network = cidr;
Name = Network.ToString();
FirstSeen = DateTime.Now;
}
public void AttachInterface(NetworkInterface networkInterface)
{
networkInterfaces.Add(networkInterface);
}
public void DetachInterface(NetworkInterface networkInterface)
{
networkInterfaces.Remove(networkInterface);
}
public override string ToString()
{
return Network.ToString();
}
}
}