Handling
This commit is contained in:
parent
1e42791584
commit
ea5f732e24
5 changed files with 19 additions and 6 deletions
|
|
@ -14,7 +14,7 @@ public record struct KeaDhcp4Lease(
|
||||||
IPAddress Address,
|
IPAddress Address,
|
||||||
PhysicalAddress HWAddr,
|
PhysicalAddress HWAddr,
|
||||||
string? ClientId,
|
string? ClientId,
|
||||||
uint ValidLifetime,
|
TimeSpan ValidLifetime,
|
||||||
DateTimeOffset Expire,
|
DateTimeOffset Expire,
|
||||||
uint SubnetId,
|
uint SubnetId,
|
||||||
bool FqdnFwd,
|
bool FqdnFwd,
|
||||||
|
|
@ -81,7 +81,7 @@ public record struct KeaDhcp4Lease(
|
||||||
static bool ToValidLifetime(ref Lease lease, in Cell span)
|
static bool ToValidLifetime(ref Lease lease, in Cell span)
|
||||||
{
|
{
|
||||||
bool result = uint.TryParse(span, out var validLifetime);
|
bool result = uint.TryParse(span, out var validLifetime);
|
||||||
lease.ValidLifetime = validLifetime;
|
lease.ValidLifetime = TimeSpan.FromSeconds(validLifetime);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,12 @@ public class KeaDhcp4LeaseHandler : IKeaDhcpLeaseHandler
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new(lease.Address, lease.Hostname, null, default);
|
DhcpLeaseIdentifier identifier = lease.ClientId switch
|
||||||
|
{
|
||||||
|
string clientId when !string.IsNullOrWhiteSpace(clientId) => new DhcpLeaseClientIdentifier(clientId),
|
||||||
|
_ => new DhcpLeaseHWAddrIdentifier(lease.HWAddr)
|
||||||
|
};
|
||||||
|
|
||||||
|
return new(lease.Address, lease.Hostname, identifier, lease.ValidLifetime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ using Lease = KeaDhcp6Lease;
|
||||||
public record struct KeaDhcp6Lease(
|
public record struct KeaDhcp6Lease(
|
||||||
IPAddress Address,
|
IPAddress Address,
|
||||||
string DUId,
|
string DUId,
|
||||||
uint ValidLifetime,
|
TimeSpan ValidLifetime,
|
||||||
DateTimeOffset Expire,
|
DateTimeOffset Expire,
|
||||||
uint SubnetId,
|
uint SubnetId,
|
||||||
uint PrefLifetime,
|
uint PrefLifetime,
|
||||||
|
|
@ -86,7 +86,7 @@ public record struct KeaDhcp6Lease(
|
||||||
static bool ToValidLifetime(ref Lease lease, in Cell span)
|
static bool ToValidLifetime(ref Lease lease, in Cell span)
|
||||||
{
|
{
|
||||||
bool result = uint.TryParse(span, out var validLifetime);
|
bool result = uint.TryParse(span, out var validLifetime);
|
||||||
lease.ValidLifetime = validLifetime;
|
lease.ValidLifetime = TimeSpan.FromSeconds(validLifetime);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,12 @@ public class KeaDhcp6LeaseHandler : IKeaDhcpLeaseHandler
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new(lease.Address, lease.Hostname, null, default);
|
DhcpLeaseIdentifier identifier = lease.DUId switch
|
||||||
|
{
|
||||||
|
string clientId when !string.IsNullOrWhiteSpace(clientId) => new DhcpLeaseClientIdentifier(clientId),
|
||||||
|
_ => new DhcpLeaseHWAddrIdentifier(lease.HWAddr)
|
||||||
|
};
|
||||||
|
|
||||||
|
return new(lease.Address, lease.Hostname, identifier, lease.ValidLifetime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ internal partial class MethodContext : JsonSerializerContext;
|
||||||
public abstract class Method<TParam>(TParam parameters) : Method
|
public abstract class Method<TParam>(TParam parameters) : Method
|
||||||
where TParam : MethodParameters
|
where TParam : MethodParameters
|
||||||
{
|
{
|
||||||
|
[JsonPropertyName("parameters")]
|
||||||
public TParam Parameters => parameters;
|
public TParam Parameters => parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue