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,
|
||||
PhysicalAddress HWAddr,
|
||||
string? ClientId,
|
||||
uint ValidLifetime,
|
||||
TimeSpan ValidLifetime,
|
||||
DateTimeOffset Expire,
|
||||
uint SubnetId,
|
||||
bool FqdnFwd,
|
||||
|
|
@ -81,7 +81,7 @@ public record struct KeaDhcp4Lease(
|
|||
static bool ToValidLifetime(ref Lease lease, in Cell span)
|
||||
{
|
||||
bool result = uint.TryParse(span, out var validLifetime);
|
||||
lease.ValidLifetime = validLifetime;
|
||||
lease.ValidLifetime = TimeSpan.FromSeconds(validLifetime);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,12 @@ public class KeaDhcp4LeaseHandler : IKeaDhcpLeaseHandler
|
|||
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(
|
||||
IPAddress Address,
|
||||
string DUId,
|
||||
uint ValidLifetime,
|
||||
TimeSpan ValidLifetime,
|
||||
DateTimeOffset Expire,
|
||||
uint SubnetId,
|
||||
uint PrefLifetime,
|
||||
|
|
@ -86,7 +86,7 @@ public record struct KeaDhcp6Lease(
|
|||
static bool ToValidLifetime(ref Lease lease, in Cell span)
|
||||
{
|
||||
bool result = uint.TryParse(span, out var validLifetime);
|
||||
lease.ValidLifetime = validLifetime;
|
||||
lease.ValidLifetime = TimeSpan.FromSeconds(validLifetime);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,12 @@ public class KeaDhcp6LeaseHandler : IKeaDhcpLeaseHandler
|
|||
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
|
||||
where TParam : MethodParameters
|
||||
{
|
||||
[JsonPropertyName("parameters")]
|
||||
public TParam Parameters => parameters;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue