public void DeleteDhcpOption(IaAddress iaAddr, BaseDhcpOption baseOption) { DhcpLease lease = FindDhcpLeaseForInetAddr(iaAddr.GetIpAddress()); if (lease != null) { List <DhcpOption> iaAddrOptions = lease.GetIaAddrDhcpOptions(); if (iaAddrOptions != null) { bool deleted = false; foreach (DhcpOption iaAddrOption in iaAddrOptions) { if (iaAddrOption.GetCode() == baseOption.GetCode()) { iaAddrOptions.Remove(iaAddrOption); deleted = true; break; } } if (deleted) { UpdateIpAddrOptions(iaAddr.GetIpAddress(), iaAddrOptions); } } } }
public void UpdateIaAddr(IaAddress iaAddr) { _DhcpLeaseData.Where(d => d.GetIpAddress() == iaAddr.GetIpAddress()).ToList().ForEach(d => { d.SetStartTime(iaAddr.GetStartTime()); d.SetPreferredEndTime(iaAddr.GetPreferredEndTime()); d.SetValidEndTime(iaAddr.GetValidEndTime()); }); //(_DhcpLeaseData.Where(d => d.GetIpAddress().ToString() == iaAddr.GetIpAddress().ToString()).First()); }
/** * To dhcp lease. * * @param ia the ia * @param iaAddr the ia addr * @return the dhcp lease */ protected DhcpLease ToDhcpLease(IdentityAssoc ia, IaAddress iaAddr) { DhcpLease lease = new DhcpLease(); lease.SetDuid(ia.GetDuid()); lease.SetIaid(ia.GetIaid()); lease.SetIatype(ia.GetIatype()); lease.SetIpAddress(iaAddr.GetIpAddress()); if (iaAddr is IaPrefix) { lease.SetPrefixLength(((IaPrefix)iaAddr).GetPrefixLength()); } lease.SetState(iaAddr.GetState()); lease.SetStartTime(iaAddr.GetStartTime()); lease.SetPreferredEndTime(iaAddr.GetPreferredEndTime()); lease.SetValidEndTime(iaAddr.GetValidEndTime()); lease.SetIaAddrDhcpOptions(iaAddr.GetDhcpOptions()); lease.SetIaDhcpOptions(ia.GetDhcpOptions()); return(lease); }
protected DhcpOption FindIaAddressOption(IaAddress iaAddr, BaseDhcpOption baseOption) { DhcpOption dbOption = null; DhcpLease lease = FindDhcpLeaseForInetAddr(iaAddr.GetIpAddress()); if (lease != null) { List <DhcpOption> iaAddrOptions = lease.GetIaAddrDhcpOptions(); if (iaAddrOptions != null) { foreach (DhcpOption iaAddrOption in iaAddrOptions) { if (iaAddrOption.GetCode() == baseOption.GetCode()) { dbOption = iaAddrOption; break; } } } } return(dbOption); }
public void DeleteIaAddr(IaAddress iaAddr) { _DhcpLeaseData.RemoveAll(d => d.GetIpAddress().ToString() == iaAddr.GetIpAddress().ToString()); }
/* (non-Javadoc) * @see com.jagornet.dhcpv6.db.IaManager#findIA(com.jagornet.dhcpv6.db.IaAddress) */ public IdentityAssoc FindIA(IaAddress iaAddress) { return(FindIA(iaAddress.GetIpAddress(), true)); }
protected void SetDhcpOption(IaAddress iaAddr, DhcpOption option) { iaAddr.SetDhcpOption(option); UpdateIpAddrOptions(iaAddr.GetIpAddress(), iaAddr.GetDhcpOptions()); }