Esempio n. 1
0
 public void PutDhcpOption(DhcpOption dhcpOption)
 {
     if ((dhcpOption != null))
     {
         this.dhcpOptions[dhcpOption.GetCode()] = dhcpOption;
     }
 }
Esempio n. 2
0
 public void PutDhcpOption(DhcpOption dhcpOption)
 {
     if (dhcpOption != null)
     {
         _dhcpOptions[dhcpOption.GetCode()] = dhcpOption;
     }
 }
Esempio n. 3
0
 protected void DecodeOptions(ByteBuffer buf, long eof)
 {
     while (buf.position() < eof)
     {
         int code = Util.GetUnsignedShort(buf);
         log.Debug("Option code=" + code);
         DhcpOption option = DhcpV6OptionFactory.GetDhcpOption(code);
         if (option != null)
         {
             option.Decode(buf);
             if (option is DhcpV6IaPrefixOption)
             {
                 iaPrefixOptions.Add((DhcpV6IaPrefixOption)option);
             }
             else
             {
                 dhcpOptions[option.GetCode()] = option;
             }
         }
         else
         {
             break;  // no more options, or one is malformed, so we're done
         }
     }
 }
 protected void DecodeOptions(ByteBuffer buf)
 {
     while (buf.hasRemaining())
     {
         int code = Util.GetUnsignedShort(buf);
         log.Debug("Option code=" + code);
         DhcpOption option = DhcpV6OptionFactory.GetDhcpOption(code);
         if (option != null)
         {
             option.Decode(buf);
             dhcpOptions[option.GetCode()] = option;
         }
         else
         {
             break;  // no more options, or one is malformed, so we're done
         }
     }
 }
Esempio n. 5
0
 /// <summary>
 /// Decode the options.
 /// </summary>
 /// <param name="buf">ByteBuffer positioned at the start of the options in the packet</param>
 /// <returns>a Map of DhcpOptions keyed by the option code</returns>
 protected Dictionary <int, DhcpOption> DecodeOptions(ByteBuffer buf)
 {
     while (buf.hasRemaining())
     {
         int code = Util.GetUnsignedShort(buf);
         if (log.IsDebugEnabled)
         {
             log.Debug("Option code=" + code);
         }
         DhcpOption option = DhcpV6OptionFactory.GetDhcpOption(code);
         if (option != null)
         {
             if ((option is DhcpV6RelayOption) &&
                 (this is DhcpV6RelayMessage))
             {
                 DhcpV6RelayOption relayOption = (DhcpV6RelayOption)option;
                 relayOption.SetRelayMessage((DhcpV6RelayMessage)this);
             }
             option.Decode(buf);
             if (option is DhcpV6IaNaOption)
             {
                 iaNaOptions.Add((DhcpV6IaNaOption)option);
             }
             else if (option is DhcpV6IaTaOption)
             {
                 iaTaOptions.Add((DhcpV6IaTaOption)option);
             }
             else if (option is DhcpV6IaPdOption)
             {
                 iaPdOptions.Add((DhcpV6IaPdOption)option);
             }
             else
             {
                 dhcpOptions[option.GetCode()] = option;
             }
         }
         else
         {
             break;  // no more options, or one is malformed, so we're done
         }
     }
     return(dhcpOptions);
 }
Esempio n. 6
0
        public void SetDhcpOption(DhcpOption newOption)
        {
            if ((this.dhcpOptions == null))
            {
                this.dhcpOptions = new List <DhcpOption>();
            }

            //  first remove the option, if it exists
            foreach (DhcpOption dhcpOption in this.dhcpOptions)
            {
                if ((dhcpOption.GetCode() == newOption.GetCode()))
                {
                    this.dhcpOptions.Remove(dhcpOption);
                    break;
                }
            }

            this.dhcpOptions.Add(newOption);
        }
Esempio n. 7
0
 /**
  * Decode the options.
  * @param buf	ByteBuffer positioned at the start of the options in the packet
  * @return	a Map of DhcpOptions keyed by the option code
  * @throws IOException
  */
 protected Dictionary <int, DhcpOption> DecodeOptions(ByteBuffer buf)
 {
     while (buf.hasRemaining())
     {
         short code = Util.GetUnsignedByte(buf);
         if (log.IsDebugEnabled)
         {
             log.Debug("Option code=" + code);
         }
         DhcpOption option = DhcpV4OptionFactory.GetDhcpOption(code);
         if (option != null)
         {
             option.Decode(buf);
             _dhcpOptions[option.GetCode()] = option;
         }
         else
         {
             break;  // no more options, or one is malformed, so we're done
         }
     }
     return(_dhcpOptions);
 }
Esempio n. 8
0
 /**
  * Implement DhcpOptionable.
  *
  * @param dhcpOption the dhcp option
  */
 public void PutDhcpOption(DhcpOption dhcpOption)
 {
     dhcpOptions[dhcpOption.GetCode()] = dhcpOption;
 }