/// <summary>Ruby DHCP server</summary> /// <param name="prms">initialization parameters</param> /// <param name="listener">event listener</param> /// <param name="localIp">the local IP address to bind to and will be the server identifier</param> public RTDhcpSvr(DhcpParams prms, IRTDhcpListener listener, IPAddress localIp) { /* * intf = findNetworkInterface(); * if (intf!=null) * { * Util.log(string.Format("network interface: {0}({1})", intf.Name, intf.Id)); * }*/ localAddress = localIp == null?Util.getLocalIPAddress() : localIp; defaultOptions = new DHCPReplyOptions(); defaultOptions.DomainName = prms.domainName; defaultOptions.DomainNameServers = new IPAddress[] { IPAddress.Parse(prms.dnsSvr) }; defaultOptions.IPAddressLeaseTime = prms.leaseTime; defaultOptions.RouterIP = IPAddress.Parse(prms.defaultGateway); defaultOptions.SubnetMask = IPAddress.Parse(prms.mask); if (localAddress != null) { defaultOptions.ServerIdentifier = localAddress; } pool = new IpPool(prms.ipStart, prms.ipEnd, prms.leaseTime); RTDhcpSvr.listener = listener; state = STATE_READY; }
public RTDhcpSvr(DhcpParams prms) : this(prms, null) { }
/// <summary>Ruby DHCP server. The server will bind to 0.0.0.0. Suggest providing local IP address if there are multiple network interface on your machine.</summary> /// <param name="prms">initialization parameters</param> /// <param name="listener">event listener</param> public RTDhcpSvr(DhcpParams prms, IRTDhcpListener listener) : this(prms, listener, null) { }