ln.dhcp/IPPool.cs

46 lines
965 B
C#
Raw Normal View History

2019-04-23 09:22:14 +02:00
using System;
using ln.types.net;
using System.Collections.Generic;
using ln.types.odb.attributes;
namespace ln.dhcp
{
public class IPPool
{
[DocumentID]
public String Name { get; set; }
public IPv4 FirstIP { get; set; }
public IPv4 LastIP { get; set; }
IPv4 nextIP;
public IPv4 NextIP
{
get
{
IPv4 next = nextIP++;
if (nextIP > LastIP)
nextIP = FirstIP;
return next;
}
set => nextIP = value;
}
public TimeSpan DefaultLeaseTime { get; set; }
private IPPool()
{
DefaultLeaseTime = TimeSpan.FromHours(1);
}
public IPPool(String name, IPv4 first, IPv4 last)
: this()
{
Name = name;
FirstIP = first;
LastIP = last;
NextIP = FirstIP;
}
}
}