Example #1
0
        public DHCPv4Packet(
            IPv4HeaderInformation ipv4Header,
            Byte[] hwAddress,
            UInt32 transactionId,
            IPv4Address yourIPAddress,
            IPv4Address gwIPAddress,
            IPv4Address clientIPAddress,
            DHCPv4PacketFlags flags,
            IEnumerable <DHCPv4PacketOption> options
            ) : this()
        {
            TransactionId         = transactionId;
            ClientHardwareAddress = ByteHelper.CopyData(hwAddress);
            HardwareAddressLength = (Byte)ClientHardwareAddress.Length;
            YourIPAdress          = IPv4Address.FromByteArray(yourIPAddress.GetBytes());
            ClientIPAdress        = IPv4Address.FromByteArray(clientIPAddress.GetBytes());
            GatewayIPAdress       = IPv4Address.FromByteArray(gwIPAddress.GetBytes());
            Header = ipv4Header;
            Flags  = flags;

            _options = new List <DHCPv4PacketOption>();

            foreach (var item in options)
            {
                AddOption(item);
            }

            SetClientIdentifier();
            _isValid = true;
        }
Example #2
0
 public DHCPv4Packet(
     IPv4HeaderInformation ipv4Header,
     Byte[] hwAddress,
     UInt32 transactionId,
     IPv4Address yourIPAddress,
     IPv4Address gwIPAddress,
     IPv4Address clientIPAddress,
     DHCPv4PacketFlags flags = DHCPv4PacketFlags.Unicast,
     params DHCPv4PacketOption[] options
     ) : this(ipv4Header, hwAddress, transactionId, yourIPAddress, gwIPAddress, clientIPAddress, flags, options.ToList())
 {
 }