示例#1
0
        private TimeSpan GetLeaseDuration()
        {
            var option = DhcpServerOptionValue.GetScopeDefaultOptionValue(this, 51);

            if (option == null)
            {
                return(default(TimeSpan));
            }
            else
            {
                return(TimeSpan.FromSeconds(((DhcpServerOptionElementDWord)option.Values[0]).RawValue));
            }
        }
 internal static DhcpServerDnsSettings GetScopeDnsSettings(DhcpServer server, DhcpServerIpAddress address)
 {
     // Flag is Option 81
     try
     {
         var option = DhcpServerOptionValue.GetScopeDefaultOptionValue(server, address, 81);
         if (option.Values.FirstOrDefault() is DhcpServerOptionElementDWord value)
         {
             return(new DhcpServerDnsSettings((uint)value.RawValue));
         }
         else
         {
             return(GetGlobalDnsSettings(server));
         }
     }
     catch (DhcpServerException e) when(e.ApiErrorId == (uint)DhcpErrors.ERROR_FILE_NOT_FOUND)
     {
         return(GetGlobalDnsSettings(server));
     }
 }
示例#3
0
 internal static DhcpServerDnsSettings GetScopeDnsSettings(DhcpServerScope Scope)
 {
     // Flag is Option 81
     try
     {
         var option = DhcpServerOptionValue.GetScopeDefaultOptionValue(Scope, 81);
         if (option.Values.Count != 1)
         {
             return(GetGlobalDnsSettings(Scope.Server));
         }
         else
         {
             return(null);
         }
     }
     catch (DhcpServerException e) when(e.ApiErrorId == (uint)DhcpErrors.ERROR_FILE_NOT_FOUND)
     {
         return(null);
     }
 }
示例#4
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));
     }
 }
示例#5
0
 /// <summary>
 /// Retrieves the Option Value assoicated with the Option and Scope within a User Class
 /// </summary>
 /// <param name="ClassName">The name of the User Class to retrieve the Option from</param>
 /// <param name="OptionId">The identifier for the option value to retrieve</param>
 /// <returns>A <see cref="DhcpServerOptionValue"/>.</returns>
 public DhcpServerOptionValue GetUserOptionValue(string ClassName, int OptionId)
 {
     return(DhcpServerOptionValue.GetScopeUserOptionValue(this, OptionId, ClassName));
 }
示例#6
0
 /// <summary>
 /// Retrieves the Option Value assoicated with the Option and Scope 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.GetScopeDefaultOptionValue(this, OptionId));
 }
示例#7
0
 /// <summary>
 /// The Option Value associated with the Scope Configuration
 /// </summary>
 internal DhcpServerOptionValue GetScopeValue(DhcpServerScope scope)
 => DhcpServerOptionValue.GetScopeOptionValue(scope, OptionId, ClassName, VendorName);
示例#8
0
 /// <summary>
 /// Enumerates a list of all Global Option Values, including vendor/user class options, associated with the DHCP Server
 /// </summary>
 public IEnumerable <IDhcpServerOptionValue> GetOptionValues()
 => DhcpServerOptionValue.GetAllGlobalOptionValues(Server);
示例#9
0
 /// <summary>
 /// Queries the DHCP Server for the specified OptionId Value within a User Class
 /// </summary>
 /// <param name="className">The name of the User Class to retrieve the Option from</param>
 /// <param name="optionId">The identifier for the option value to retrieve</param>
 /// <returns>A <see cref="IDhcpServerOptionValue"/>.</returns>
 public IDhcpServerOptionValue GetUserOptionValue(string className, DhcpServerOptionIds optionId)
 => DhcpServerOptionValue.GetGlobalUserOptionValue(Server, className, (int)optionId);
示例#10
0
 /// <summary>
 /// The Option Value associated with the Scope Configuration
 /// </summary>
 public DhcpServerOptionValue GetScopeValue(DhcpServerScope Scope)
 {
     return(DhcpServerOptionValue.GetScopeOptionValue(Scope, OptionId, ClassName, VendorName));
 }
示例#11
0
 public void RemoveOptionValue(IDhcpServerOptionValue value)
 => DhcpServerOptionValue.DeleteScopeOptionValue(Scope, (DhcpServerOptionValue)value);
示例#12
0
 public void RemoveOptionValue(DhcpServerOptionIds optionId)
 => DhcpServerOptionValue.DeleteScopeOptionValue(Scope, (int)optionId);
示例#13
0
 /// <summary>
 /// Retrieves the Option Value associated with the Option and Scope within a Vendor Class
 /// </summary>
 /// <param name="vendorName">The name of the Vendor Class to retrieve the Option from</param>
 /// <param name="optionId">The identifier for the option value to retrieve</param>
 /// <returns>A <see cref="DhcpServerOptionValue"/>.</returns>
 public void RemoveVendorOptionValue(string vendorName, DhcpServerOptionIds optionId)
 => DhcpServerOptionValue.DeleteScopeVendorOptionValue(Scope, (int)optionId, vendorName);
示例#14
0
 /// <summary>
 /// Retrieves the Option Value associated with the Option and Scope within a User Class
 /// </summary>
 /// <param name="className">The name of the User Class to retrieve the Option from</param>
 /// <param name="optionId">The identifier for the option value to retrieve</param>
 /// <returns>A <see cref="DhcpServerOptionValue"/>.</returns>
 public void RemoveUserOptionValue(string className, DhcpServerOptionIds optionId)
 => DhcpServerOptionValue.DeleteScopeUserOptionValue(Scope, (int)optionId, className);
示例#15
0
 public void AddOrSetOptionValue(IDhcpServerOptionValue value)
 => DhcpServerOptionValue.SetScopeOptionValue(Scope, (DhcpServerOptionValue)value);
示例#16
0
 /// <summary>
 /// The Option Value associated with the Reservation Configuration
 /// </summary>
 public DhcpServerOptionValue GetScopeReservationValue(DhcpServerScopeReservation Reservation)
 {
     return(DhcpServerOptionValue.GetScopeReservationOptionValue(Reservation, OptionId, ClassName, VendorName));
 }
示例#17
0
 /// <summary>
 /// The Option Value associated with the Global Server Configuration
 /// </summary>
 public DhcpServerOptionValue GetGlobalValue()
 {
     return(DhcpServerOptionValue.GetGlobalOptionValue(Server, OptionId, ClassName, VendorName));
 }
示例#18
0
 /// <summary>
 /// Enumerates a list of All Option Values, including vendor/user class option values, associated with the DHCP Scope
 /// </summary>
 public IEnumerator <IDhcpServerOptionValue> GetEnumerator()
 => DhcpServerOptionValue.GetAllScopeOptionValues(Scope).GetEnumerator();
示例#19
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);
示例#20
0
 /// <summary>
 /// Enumerates a list of Default Option Values associated with the DHCP Scope
 /// </summary>
 public IEnumerable <IDhcpServerOptionValue> GetDefaultOptionValues()
 => DhcpServerOptionValue.EnumScopeDefaultOptionValues(Scope);
示例#21
0
 /// <summary>
 /// Queries the DHCP Server for the specified OptionId Value within a Vendor Class
 /// </summary>
 /// <param name="className">The name of the User Class to retrieve the Option from</param>
 /// <param name="optionId">The identifier for the option value to retrieve</param>
 /// <returns>A <see cref="IDhcpServerOptionValue"/>.</returns>
 public IDhcpServerOptionValue GetVendorOptionValue(string vendorName, DhcpServerOptionIds optionId)
 => DhcpServerOptionValue.GetGlobalVendorOptionValue(Server, vendorName, (int)optionId);
示例#22
0
 public IEnumerable <IDhcpServerOptionValue> GetUserOptionValues(string className)
 => DhcpServerOptionValue.EnumScopeUserOptionValues(Scope, className);
示例#23
0
 /// <summary>
 /// Enumerates a list of Global Option Values associated with the DHCP Server
 /// </summary>
 public IEnumerable <IDhcpServerOptionValue> GetDefaultOptionValues()
 => DhcpServerOptionValue.EnumGlobalDefaultOptionValues(Server);
示例#24
0
 public IEnumerable <IDhcpServerOptionValue> GetVendorOptionValues(string vendorName)
 => DhcpServerOptionValue.EnumScopeVendorOptionValues(Scope, vendorName);
示例#25
0
 /// <summary>
 /// The Option Value associated with the Reservation Configuration
 /// </summary>
 internal DhcpServerOptionValue GetScopeReservationValue(DhcpServerScopeReservation reservation)
 => DhcpServerOptionValue.GetScopeReservationOptionValue(reservation, OptionId, ClassName, VendorName);
示例#26
0
 /// <summary>
 /// Retrieves the Option Value associated with the Option and Scope from the Default options
 /// </summary>
 /// <param name="optionId">The identifier for the option value to retrieve</param>
 /// <returns>A <see cref="DhcpServerOptionValue"/>.</returns>
 public IDhcpServerOptionValue GetDefaultOptionValue(DhcpServerOptionIds optionId)
 => DhcpServerOptionValue.GetScopeDefaultOptionValue(Scope, (int)optionId);
示例#27
0
 /// <summary>
 /// Retrieves the Option Value assoicated with the Option and Scope within a Vendor Class
 /// </summary>
 /// <param name="VendorName">The name of the Vendor Class to retrieve the Option from</param>
 /// <param name="OptionId">The identifier for the option value to retrieve</param>
 /// <returns>A <see cref="DhcpServerOptionValue"/>.</returns>
 public DhcpServerOptionValue GetVendorOptionValue(string VendorName, int OptionId)
 {
     return(DhcpServerOptionValue.GetScopeVendorOptionValue(this, OptionId, VendorName));
 }
示例#28
0
 /// <summary>
 /// Retrieves the Option Value associated with the Option and Scope within a User Class
 /// </summary>
 /// <param name="className">The name of the User Class to retrieve the Option from</param>
 /// <param name="optionId">The identifier for the option value to retrieve</param>
 /// <returns>A <see cref="DhcpServerOptionValue"/>.</returns>
 public IDhcpServerOptionValue GetUserOptionValue(string className, DhcpServerOptionIds optionId)
 => DhcpServerOptionValue.GetScopeUserOptionValue(Scope, (int)optionId, className);
示例#29
0
 /// <summary>
 /// Retrieves the Option Value associated with the Option and Scope within a Vendor Class
 /// </summary>
 /// <param name="vendorName">The name of the Vendor Class to retrieve the Option from</param>
 /// <param name="optionId">The identifier for the option value to retrieve</param>
 /// <returns>A <see cref="DhcpServerOptionValue"/>.</returns>
 public IDhcpServerOptionValue GetVendorOptionValue(string vendorName, int optionId)
 => DhcpServerOptionValue.GetScopeVendorOptionValue(Scope, optionId, vendorName);
示例#30
0
 /// <summary>
 /// Retrieves the Option Value associated with the Option and Scope Reservation within a User Class
 /// </summary>
 /// <param name="className">The name of the User Class to retrieve the Option from</param>
 /// <param name="optionId">The identifier for the option value to retrieve</param>
 /// <returns>A <see cref="IDhcpServerOptionValue"/>.</returns>
 public IDhcpServerOptionValue GetUserOptionValue(string className, int optionId)
 => DhcpServerOptionValue.GetScopeReservationUserOptionValue(Reservation, optionId, className);