Exemplo n.º 1
0
 /// <summary>
 /// Decode any options sent by the client inside this IA_NA.  Mostly, we are
 /// a hint to which address(es) it may want.RFC 3315 does not specify if
 /// a client can actually provide any options other than IA_ADDR options in
 /// inside the IA_NA, but it does not say that the client cannot do so, and
 /// the IA_NA option definition supports any type of sub-options.
 /// </summary>
 /// <param name="buf">buf ByteBuffer positioned at the start of the options in the packet</param>
 /// <param name="eof">eof the eof</param>
 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 DhcpV6IaAddrOption)
             {
                 iaAddrOptions.Add((DhcpV6IaAddrOption)option);
             }
             else
             {
                 PutDhcpOption(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
         }
     }
 }
Exemplo n.º 3
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);
 }
Exemplo n.º 4
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);
 }