Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RouterOption" /> class.
        /// </summary>
        /// <param name="buffer">The buffer.</param>
        /// <param name="offset">The buffer.</param>
        /// <param name="optionLength">The offset.</param>
        public RouterOption(byte[] buffer, int offset, int optionLength) : base(DhcpV4OptionType.Router)
        {
            Routers = new List <IPAddress>();

            for (int i = 0; i < optionLength; i += 4)
            {
                if (offset + i + 4 < buffer.Length)
                {
                    Routers.Add(IPPacket.GetIPAddress(AddressFamily.InterNetwork, offset + i, buffer));
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ServerIdOption" /> class.
 /// </summary>
 /// <param name="buffer">The buffer.</param>
 /// <param name="offset">The buffer.</param>
 public ServerIdOption(byte[] buffer, int offset) : base(DhcpV4OptionType.DHCPServerId)
 {
     ServerId = offset + IPv4Fields.AddressLength < buffer.Length ? IPPacket.GetIPAddress(AddressFamily.InterNetwork, offset, buffer) : IPAddress.Any;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SubnetMaskOption" /> class.
 /// </summary>
 /// <param name="buffer">The buffer.</param>
 /// <param name="offset">The offset.</param>
 public SubnetMaskOption(byte[] buffer, int offset) : base(DhcpV4OptionType.SubnetMask)
 {
     SubnetMask = offset + IPv4Fields.AddressLength < buffer.Length ? IPPacket.GetIPAddress(AddressFamily.InterNetwork, offset, buffer) : IPAddress.Any;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BroadcastAddressOption" /> class.
 /// </summary>
 /// <param name="buffer">The buffer.</param>
 /// <param name="offset">The offset.</param>
 public BroadcastAddressOption(byte[] buffer, int offset) : base(DhcpV4OptionType.BroadcastAddress)
 {
     BroadcastAddress = offset + IPv4Fields.AddressLength < buffer.Length ? IPPacket.GetIPAddress(AddressFamily.InterNetwork, offset, buffer) : IPAddress.Any;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AddressRequestOption" /> class.
 /// </summary>
 /// <param name="buffer">The buffer.</param>
 /// <param name="offset">The offset.</param>
 public AddressRequestOption(byte[] buffer, int offset) : base(DhcpV4OptionType.AddressRequest)
 {
     RequestedIP = offset + IPv4Fields.AddressLength < buffer.Length ? IPPacket.GetIPAddress(AddressFamily.InterNetwork, offset, buffer) : IPAddress.Any;
 }