DhcpPacket.cs 802 B

1234567891011121314151617181920
  1. using System.Linq;
  2. using System.Net;
  3. namespace DhcpServer
  4. {
  5. public partial class DhcpPacket
  6. {
  7. public string ClientMacAddressHex => string.Join("-", ClientMacAddress.Select(p => p.ToString("X2")));
  8. internal void LoadClientEntry(ClientEntry entry)
  9. {
  10. if (entry.IpAddress != null) YourIpAddress = IPAddress.Parse(entry.IpAddress);
  11. if (entry.SubNetMask != null) SubNetMask = IPAddress.Parse(entry.SubNetMask);
  12. if (entry.GateWay != null) Router = IPAddress.Parse(entry.GateWay);
  13. if (entry.DnsServer != null) DnsServer = IPAddress.Parse(entry.DnsServer);
  14. if (entry.TftpServer != null) TftpServer = entry.TftpServer;
  15. if (entry.BootFileName != null) BootFileName = entry.BootFileName;
  16. }
  17. }
  18. }