Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UnsupportedOption" /> class.
        /// </summary>
        /// <param name="buffer">The buffer.</param>
        /// <param name="offset">The buffer.</param>
        /// <param name="optionType">The offset.</param>
        /// <param name="optionLength">The option type.</param>
        public UnsupportedOption(byte[] buffer, int offset, DhcpV4OptionType optionType, int optionLength) : base(optionType)
        {
            var availableBufferLength = buffer.Length - offset;

            if (availableBufferLength < optionLength)
            {
                optionLength = availableBufferLength >= 0 ? availableBufferLength : 0;
            }

            _data = new byte[optionLength];

            Array.Copy(buffer, offset, _data, 0, optionLength);
        }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DhcpV4Option" /> class.
 /// </summary>
 /// <param name="optionType">Type of the option.</param>
 protected DhcpV4Option(DhcpV4OptionType optionType)
 {
     OptionType = optionType;
 }