Exemple #1
0
 static DHCPMessage()
 {
     optionsTemplates = new IDHCPOption[256];
     for (int t = 1; t < 255; t++)
     {
         optionsTemplates[t] = new DHCPOptionGeneric((TDHCPOption)t);
     }
     optionsTemplates[0]   = new DHCPOptionFixedLength(TDHCPOption.Pad);
     optionsTemplates[255] = new DHCPOptionFixedLength(TDHCPOption.End);
     optionsTemplates[(int)TDHCPOption.HostName]                 = new DHCPOptionHostName();
     optionsTemplates[(int)TDHCPOption.IPAddressLeaseTime]       = new DHCPOptionIPAddressLeaseTime();
     optionsTemplates[(int)TDHCPOption.ServerIdentifier]         = new DHCPOptionServerIdentifier();
     optionsTemplates[(int)TDHCPOption.RequestedIPAddress]       = new DHCPOptionRequestedIPAddress();
     optionsTemplates[(int)TDHCPOption.OptionOverload]           = new DHCPOptionOptionOverload();
     optionsTemplates[(int)TDHCPOption.TFTPServerName]           = new DHCPOptionTFTPServerName();
     optionsTemplates[(int)TDHCPOption.BootFileName]             = new DHCPOptionBootFileName();
     optionsTemplates[(int)TDHCPOption.MessageType]              = new DHCPOptionMessageType();
     optionsTemplates[(int)TDHCPOption.Message]                  = new DHCPOptionMessage();
     optionsTemplates[(int)TDHCPOption.MaximumDHCPMessageSize]   = new DHCPOptionMaximumDHCPMessageSize();
     optionsTemplates[(int)TDHCPOption.ParameterRequestList]     = new DHCPOptionParameterRequestList();
     optionsTemplates[(int)TDHCPOption.RenewalTimeValue]         = new DHCPOptionRenewalTimeValue();
     optionsTemplates[(int)TDHCPOption.RebindingTimeValue]       = new DHCPOptionRebindingTimeValue();
     optionsTemplates[(int)TDHCPOption.VendorClassIdentifier]    = new DHCPOptionVendorClassIdentifier();
     optionsTemplates[(int)TDHCPOption.ClientIdentifier]         = new DHCPOptionClientIdentifier();
     optionsTemplates[(int)TDHCPOption.FullyQualifiedDomainName] = new DHCPOptionFullyQualifiedDomainName();
     optionsTemplates[(int)TDHCPOption.SubnetMask]               = new DHCPOptionSubnetMask();
 }
Exemple #2
0
        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);
        }