Exemplo n.º 1
0
        internal static DHCPClient CreateFromMessage(DHCPMessage message)
        {
            DHCPClient result = new DHCPClient();

            result.m_HardwareAddress = message.ClientHardwareAddress;

            DHCPOptionHostName dhcpOptionHostName = (DHCPOptionHostName)message.GetOption(TDHCPOption.HostName);

            if (dhcpOptionHostName != null)
            {
                result.m_HostName = dhcpOptionHostName.HostName;
            }

            DHCPOptionClientIdentifier dhcpOptionClientIdentifier = (DHCPOptionClientIdentifier)message.GetOption(TDHCPOption.ClientIdentifier);

            if (dhcpOptionClientIdentifier != null)
            {
                result.m_Identifier = dhcpOptionClientIdentifier.Data;
            }
            else
            {
                result.m_Identifier = message.ClientHardwareAddress;
            }

            return(result);
        }
Exemplo n.º 2
0
        public override IDHCPOption FromStream(Stream s)
        {
            DHCPOptionHostName result = new DHCPOptionHostName();

            result.m_HostName = ParseHelper.ReadString(s);
            return(result);
        }