Пример #1
0
        public override IDHCPOption FromStream(Stream s)
        {
            DHCPOptionHostName result = new DHCPOptionHostName();

            result.m_HostName = ParseHelper.ReadString(s);
            return(result);
        }
Пример #2
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);
        }