Example #1
0
        static DHCPMessage()
        {
            optionsTemplates = new IDHCPOption[256];
            for (int t = 1; t < 255; t++)
            {
                optionsTemplates[t] = new DHCPOptionGeneric((TDHCPOption)t);
            }

            RegisterOption(new DHCPOptionFixedLength(TDHCPOption.Pad));
            RegisterOption(new DHCPOptionFixedLength(TDHCPOption.End));
            RegisterOption(new DHCPOptionHostName());
            RegisterOption(new DHCPOptionIPAddressLeaseTime());
            RegisterOption(new DHCPOptionServerIdentifier());
            RegisterOption(new DHCPOptionRequestedIPAddress());
            RegisterOption(new DHCPOptionOptionOverload());
            RegisterOption(new DHCPOptionTFTPServerName());
            RegisterOption(new DHCPOptionBootFileName());
            RegisterOption(new DHCPOptionMessageType());
            RegisterOption(new DHCPOptionMessage());
            RegisterOption(new DHCPOptionMaximumDHCPMessageSize());
            RegisterOption(new DHCPOptionParameterRequestList());
            RegisterOption(new DHCPOptionRenewalTimeValue());
            RegisterOption(new DHCPOptionRebindingTimeValue());
            RegisterOption(new DHCPOptionVendorClassIdentifier());
            RegisterOption(new DHCPOptionClientIdentifier());
            RegisterOption(new DHCPOptionFullyQualifiedDomainName());
            RegisterOption(new DHCPOptionSubnetMask());
            RegisterOption(new DHCPOptionRouter());
            RegisterOption(new DHCPOptionDomainNameServer());
            RegisterOption(new DHCPOptionNetworkTimeProtocolServers());
        }
        public override IDHCPOption FromStream(Stream s)
        {
            DHCPOptionGeneric result = new DHCPOptionGeneric(m_OptionType);

            result.m_Data = new byte[s.Length];
            s.Read(result.m_Data, 0, result.m_Data.Length);
            return(result);
        }