예제 #1
0
        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));
            }
        }
예제 #2
0
 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));
     }
 }
예제 #3
0
 /// <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);
예제 #4
0
 /// <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));
 }