public NetworkPeerService(NetworkPeerStorage p, WinDHCP.Library.DhcpServer dhcpManager) { this.storage = p; init(); if (isSetIP) { dhcpManager.addReservation(storage.MACAddress, storage.IPAddress); if (isSetHostName) updateHostName(storage.HostName); } }
internal void updatePeer(NetworkPeerService peer, WinDHCP.Library.DhcpServer dhcpManager) { if (needUpdate(isSetIP, peer.isSetIP, storage.IPAddress, peer.storage.IPAddress)) { isSetIP = peer.isSetIP; if (isSetIP) { storage.IPAddress = peer.storage.IPAddress; dhcpManager.addReservation(peer.storage.MACAddress, storage.IPAddress); } else { dhcpManager.removeReservation(peer.storage.MACAddress); } } if (needUpdate(isSetHostName, peer.isSetHostName, storage.HostName, peer.storage.HostName)) { isSetHostName = peer.isSetHostName; if (isSetHostName) { //TODO add hostname to dns storage.HostName = peer.storage.HostName; } else { //TODO remove hostname from dns storage.HostName = null; } updateHostName(storage.HostName); } }