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)); } }
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); } }
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> /// 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)); }
/// <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)); }
/// <summary> /// The Option Value associated with the Scope Configuration /// </summary> internal DhcpServerOptionValue GetScopeValue(DhcpServerScope scope) => DhcpServerOptionValue.GetScopeOptionValue(scope, OptionId, ClassName, VendorName);
/// <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);
/// <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);
/// <summary> /// The Option Value associated with the Scope Configuration /// </summary> public DhcpServerOptionValue GetScopeValue(DhcpServerScope Scope) { return(DhcpServerOptionValue.GetScopeOptionValue(Scope, OptionId, ClassName, VendorName)); }
public void RemoveOptionValue(IDhcpServerOptionValue value) => DhcpServerOptionValue.DeleteScopeOptionValue(Scope, (DhcpServerOptionValue)value);
public void RemoveOptionValue(DhcpServerOptionIds optionId) => DhcpServerOptionValue.DeleteScopeOptionValue(Scope, (int)optionId);
/// <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);
/// <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);
public void AddOrSetOptionValue(IDhcpServerOptionValue value) => DhcpServerOptionValue.SetScopeOptionValue(Scope, (DhcpServerOptionValue)value);
/// <summary> /// The Option Value associated with the Reservation Configuration /// </summary> public DhcpServerOptionValue GetScopeReservationValue(DhcpServerScopeReservation Reservation) { return(DhcpServerOptionValue.GetScopeReservationOptionValue(Reservation, OptionId, ClassName, VendorName)); }
/// <summary> /// The Option Value associated with the Global Server Configuration /// </summary> public DhcpServerOptionValue GetGlobalValue() { return(DhcpServerOptionValue.GetGlobalOptionValue(Server, OptionId, ClassName, VendorName)); }
/// <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();
/// <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> /// Enumerates a list of Default Option Values associated with the DHCP Scope /// </summary> public IEnumerable <IDhcpServerOptionValue> GetDefaultOptionValues() => DhcpServerOptionValue.EnumScopeDefaultOptionValues(Scope);
/// <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);
public IEnumerable <IDhcpServerOptionValue> GetUserOptionValues(string className) => DhcpServerOptionValue.EnumScopeUserOptionValues(Scope, className);
/// <summary> /// Enumerates a list of Global Option Values associated with the DHCP Server /// </summary> public IEnumerable <IDhcpServerOptionValue> GetDefaultOptionValues() => DhcpServerOptionValue.EnumGlobalDefaultOptionValues(Server);
public IEnumerable <IDhcpServerOptionValue> GetVendorOptionValues(string vendorName) => DhcpServerOptionValue.EnumScopeVendorOptionValues(Scope, vendorName);
/// <summary> /// The Option Value associated with the Reservation Configuration /// </summary> internal DhcpServerOptionValue GetScopeReservationValue(DhcpServerScopeReservation reservation) => DhcpServerOptionValue.GetScopeReservationOptionValue(reservation, OptionId, ClassName, VendorName);
/// <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);
/// <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)); }
/// <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);
/// <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);
/// <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);