Example #1
0
        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);
                    }
                }
            }
        }
Example #2
0
        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);
        }
Example #3
0
 public void SaveDhcpOption(IaAddress iaAddr, BaseDhcpOption baseOption)
 {
     try
     {
         //byte[] newVal = baseOption.encode().array();
         // don't store the option code, start with length to
         // simplify decoding when retrieving from database
         //if (baseOption.IsV4())
         //{
         //    newVal = Arrays.copyOfRange(newVal, 1, newVal.length);
         //}
         //else
         //{
         //    newVal = Arrays.copyOfRange(newVal, 2, newVal.length);
         //}
         ////			DhcpOption dbOption = iaAddr.getDhcpOption(baseOption.getCode());
         //DhcpOption dbOption = FindIaAddressOption(iaAddr, baseOption);
         //if (dbOption == null)
         //{
         //    dbOption = new DhcpOption();
         //    dbOption.SetCode(baseOption.GetCode());
         //    dbOption.SetValue(newVal);
         //    SetDhcpOption(iaAddr, dbOption);
         //}
         //else
         //{
         //    if (!Arrays.equals(dbOption.getValue(), newVal))
         //    {
         //        dbOption.setValue(newVal);
         //        setDhcpOption(iaAddr, dbOption);
         //    }
         //}
     }
     catch (Exception ex)
     {
         log.Error("Failed to update binding with option");
     }
 }
 public void DeleteDhcpOption(IaAddress iaAddr, BaseDhcpOption option)
 {
 }
 public void SaveDhcpOption(IaAddress iaAddr, BaseDhcpOption option)
 {
 }