internal static DhcpServerDnsSettings GetGlobalDnsSettings(DhcpServer server) { // Flag is Global Option 81 try { var option = DhcpServerOptionValue.GetGlobalDefaultOptionValue(server, 81); if (option.Values.FirstOrDefault() is DhcpServerOptionElementDWord value) { return(new DhcpServerDnsSettings((uint)value.RawValue)); } else { return(new DhcpServerDnsSettings(flagDefaultSettings)); } } catch (DhcpServerException e) when(e.ApiErrorId == (uint)DhcpErrors.ERROR_FILE_NOT_FOUND) { // Default Settings return(new DhcpServerDnsSettings(flagDefaultSettings)); } }
internal static DhcpServerDnsSettings GetGlobalDnsSettings(DhcpServer Server) { // Flag is Global Option 81 try { var option = DhcpServerOptionValue.GetGlobalDefaultOptionValue(Server, 81); if (option.Values.Count == 1 && option.Values[0] is DhcpServerOptionElementDWord) { var value = (DhcpServerOptionElementDWord)option.Values[0]; return(new DhcpServerDnsSettings((uint)value.RawValue)); } else { return(new DhcpServerDnsSettings(FlagDefaultSettings)); } } catch (DhcpServerException e) when(e.ApiErrorId == (uint)DhcpErrors.ERROR_FILE_NOT_FOUND) { // Default Settings return(new DhcpServerDnsSettings(FlagDefaultSettings)); } }
/// <summary> /// Queries the DHCP Server for the specified OptionId Value from the Default options /// </summary> /// <param name="optionId">The identifier for the option value to retrieve</param> /// <returns>A <see cref="IDhcpServerOptionValue"/>.</returns> public IDhcpServerOptionValue GetDefaultOptionValue(DhcpServerOptionIds optionId) => DhcpServerOptionValue.GetGlobalDefaultOptionValue(Server, (int)optionId);
/// <summary> /// Queries the DHCP Server for the specified OptionId Value from the Default options /// </summary> /// <param name="OptionId">The identifier for the option value to retrieve</param> /// <returns>A <see cref="DhcpServerOptionValue"/>.</returns> public DhcpServerOptionValue GetOptionValue(int OptionId) { return(DhcpServerOptionValue.GetGlobalDefaultOptionValue(this, OptionId)); }