Module: DhcpsApi::OptionValue

Included in:
Server
Defined in:
lib/dhcpsapi/option_value.rb

Instance Method Summary collapse

Instance Method Details

#get_multicast_option_value(option_id, multicast_scope_name, vendor_name = nil) ⇒ Hash

Retrieves an option value for a multicast scope.

api.get_multicast_option_value(3, ‘224.0.0.0’)

Examples:

Retrieve a multicast scope option value

Parameters:

  • option_id (Fixnum)

    Option id

  • multicast_scope_name (String)

    Multicast scope ip address

  • vendor_name (String, nil) (defaults to: nil)

    The name of the vendor class (for vendor options)

Returns:

  • (Hash)

See Also:



167
168
169
170
171
172
173
# File 'lib/dhcpsapi/option_value.rb', line 167

def get_multicast_option_value(option_id, multicast_scope_name, vendor_name = nil)
  dhcp_get_option_value_v5(
      option_id,
      vendor_name,
      DhcpsApi::DHCP_OPTION_SCOPE_INFO.build_for_multicast_scope(multicast_scope_name)
  )
end

#get_option_value(option_id, vendor_name = nil) ⇒ Hash

Retrieves an option value for a default scope.

api.get_option_value(3)

Examples:

Retrieve an option value

Parameters:

  • option_id (Fixnum)

    Option id

  • vendor_name (String, nil) (defaults to: nil)

    The name of the vendor class (for vendor options)

Returns:

  • (Hash)

See Also:



188
189
190
191
192
193
194
# File 'lib/dhcpsapi/option_value.rb', line 188

def get_option_value(option_id, vendor_name = nil)
  dhcp_get_option_value_v5(
      option_id,
      vendor_name,
      DhcpsApi::DHCP_OPTION_SCOPE_INFO.build_for_default_scope
  )
end

#get_reserved_option_value(option_id, reserved_ip_address, subnet_ip_address, vendor_name = nil) ⇒ Hash

Retrieves an option value for a reservation.

api.get_reserved_option_value(3, ‘192.168.42.100’, 192.168.42.0’)

Examples:

Retrieve a reservation option value

Parameters:

  • option_id (Fixnum)

    Option id

  • reserved_ip_address (String)

    Reservation ip address

  • subnet_ip_address (String)

    Subnet ip address

  • vendor_name (String, nil) (defaults to: nil)

    The name of the vendor class (for vendor options)

Returns:

  • (Hash)

See Also:



144
145
146
147
148
149
150
# File 'lib/dhcpsapi/option_value.rb', line 144

def get_reserved_option_value(option_id, reserved_ip_address, subnet_ip_address, vendor_name = nil)
  dhcp_get_option_value_v5(
      option_id,
      vendor_name,
      DhcpsApi::DHCP_OPTION_SCOPE_INFO.build_for_reserved_scope(reserved_ip_address, subnet_ip_address)
  )
end

#get_subnet_option_value(option_id, subnet_ip_address, vendor_name = nil) ⇒ Hash

Retrieves an option value for a subnet.

api.get_subnet_option_value(3, ‘192.168.42.0’)

Examples:

Retrieve a subnet option value

Parameters:

  • option_id (Fixnum)

    Option id

  • subnet_ip_address (String)

    Subnet ip address

  • vendor_name (String, nil) (defaults to: nil)

    The name of the vendor class (for vendor options)

Returns:

  • (Hash)

See Also:



121
122
123
124
125
126
127
# File 'lib/dhcpsapi/option_value.rb', line 121

def get_subnet_option_value(option_id, subnet_ip_address, vendor_name = nil)
  dhcp_get_option_value_v5(
      option_id,
      vendor_name,
      DhcpsApi::DHCP_OPTION_SCOPE_INFO.build_for_subnet_scope(subnet_ip_address)
  )
end

#list_multicast_option_values(multicast_scope_name, vendor_name = nil) ⇒ Array<Hash>

List option values for a multicast scope.

api.list_multicast_option_values(‘224.0.0.0’)

Examples:

Retrieve all option values for a multicast scope

Parameters:

  • multicast_scope_name (String)

    Multicast scope ip address

  • vendor_name (String, nil) (defaults to: nil)

    The name of the vendor class (for vendor options)

Returns:

  • (Array<Hash>)

See Also:



332
333
334
335
336
337
338
# File 'lib/dhcpsapi/option_value.rb', line 332

def list_multicast_option_values(multicast_scope_name, vendor_name = nil)
  items, _ = retrieve_items(:dhcp_enum_option_values_v5,
                            vendor_name,
                            DhcpsApi::DHCP_OPTION_SCOPE_INFO.build_for_multicast_scope(multicast_scope_name),
                            1024, 0)
  items
end

#list_reserved_option_values(reserved_ip_address, subnet_ip_address, vendor_name = nil) ⇒ Array<Hash>

List option values for a reservation.

api.list_reserved_option_values(‘192.168.42.100’, ‘192.168.42.0’)

Examples:

Retrieve all option values for a reservation

Parameters:

  • reserved_ip_address (String)

    Reservation ip address

  • subnet_ip_address (String)

    Subnet ip address

  • vendor_name (String, nil) (defaults to: nil)

    The name of the vendor class (for vendor options)

Returns:

  • (Array<Hash>)

See Also:



311
312
313
314
315
316
317
# File 'lib/dhcpsapi/option_value.rb', line 311

def list_reserved_option_values(reserved_ip_address, subnet_ip_address, vendor_name = nil)
  items, _ = retrieve_items(:dhcp_enum_option_values_v5,
                            vendor_name,
                            DhcpsApi::DHCP_OPTION_SCOPE_INFO.build_for_reserved_scope(reserved_ip_address, subnet_ip_address),
                            1024, 0)
  items
end

#list_subnet_option_values(subnet_ip_address, vendor_name = nil) ⇒ Array<Hash>

List option values for a subnet.

api.list_subnet_option_values(‘192.168.42.0’)

Examples:

Retrieve all subnet option values

Parameters:

  • subnet_ip_address (String)

    Subnet ip address

  • vendor_name (String, nil) (defaults to: nil)

    The name of the vendor class (for vendor options)

Returns:

  • (Array<Hash>)

See Also:



289
290
291
292
293
294
295
# File 'lib/dhcpsapi/option_value.rb', line 289

def list_subnet_option_values(subnet_ip_address, vendor_name = nil)
  items, _ = retrieve_items(:dhcp_enum_option_values_v5,
                            vendor_name,
                            DhcpsApi::DHCP_OPTION_SCOPE_INFO.build_for_subnet_scope(subnet_ip_address),
                            1024, 0)
  items
end

#list_values(vendor_name = nil) ⇒ Array<Hash>

List option values for a default scope.

api.list_multicast_option_values

Examples:

Retrieve all option values for a default scope

Parameters:

  • vendor_name (String, nil) (defaults to: nil)

    The name of the vendor class (for vendor options)

Returns:

  • (Array<Hash>)

See Also:



352
353
354
355
356
357
358
# File 'lib/dhcpsapi/option_value.rb', line 352

def list_values(vendor_name = nil)
  items, _ = retrieve_items(:dhcp_enum_option_values_v5,
                            vendor_name,
                            DhcpsApi::DHCP_OPTION_SCOPE_INFO.build_for_default_scope,
                            1024, 0)
  items
end

#remove_multicast_option_value(option_id, multicast_scope_name, vendor_name = nil) ⇒ void

This method returns an undefined value.

Removes an option value for a multicast scope.

api.remove_multicast_option_value(3, ‘224.0.0.0’)

Examples:

Remove a multicast scope option value

Parameters:

  • option_id (Fixnum)

    Option id

  • multicast_scope_name (String)

    Multicast scope ip address

  • vendor_name (String, nil) (defaults to: nil)

    The name of the vendor class (for vendor options)



249
250
251
252
253
254
255
# File 'lib/dhcpsapi/option_value.rb', line 249

def remove_multicast_option_value(option_id, multicast_scope_name, vendor_name = nil)
  dhcp_remove_option_value_v5(
      option_id,
      vendor_name,
      DhcpsApi::DHCP_OPTION_SCOPE_INFO.build_for_multicast_scope(multicast_scope_name)
  )
end

#remove_option_value(option_id, vendor_name = nil) ⇒ void

This method returns an undefined value.

Removes a default scope option value.

api.remove_option_value(3)

Examples:

Remove a default scope option value

Parameters:

  • option_id (Fixnum)

    Option id

  • vendor_name (String, nil) (defaults to: nil)

    The name of the vendor class (for vendor options)



268
269
270
271
272
273
274
# File 'lib/dhcpsapi/option_value.rb', line 268

def remove_option_value(option_id, vendor_name = nil)
  dhcp_remove_option_value_v5(
      option_id,
      vendor_name,
      DhcpsApi::DHCP_OPTION_SCOPE_INFO.build_for_default_scope
  )
end

#remove_reserved_option_value(option_id, reserved_ip_address, subnet_ip_address, vendor_name = nil) ⇒ void

This method returns an undefined value.

Removes an option value for a reservation.

api.remove_reserved_option_value(3, ‘192.168.42.100’, 192.168.42.0’)

Examples:

Remove a reservation option value

Parameters:

  • option_id (Fixnum)

    Option id

  • reserved_ip_address (String)

    Reservation ip address

  • subnet_ip_address (String)

    Subnet ip address

  • vendor_name (String, nil) (defaults to: nil)

    The name of the vendor class (for vendor options)



229
230
231
232
233
234
235
# File 'lib/dhcpsapi/option_value.rb', line 229

def remove_reserved_option_value(option_id, reserved_ip_address, subnet_ip_address, vendor_name = nil)
  dhcp_remove_option_value_v5(
      option_id,
      vendor_name,
      DhcpsApi::DHCP_OPTION_SCOPE_INFO.build_for_reserved_scope(reserved_ip_address, subnet_ip_address)
  )
end

#remove_subnet_option_value(option_id, subnet_ip_address, vendor_name = nil) ⇒ void

This method returns an undefined value.

Removes an option value for a subnet.

api.remove_subnet_option_value(3, ‘192.168.42.0’)

Examples:

Remove a subnet option value

Parameters:

  • option_id (Fixnum)

    Option id

  • subnet_ip_address (String)

    Subnet ip address

  • vendor_name (String, nil) (defaults to: nil)

    The name of the vendor class (for vendor options)



208
209
210
211
212
213
214
# File 'lib/dhcpsapi/option_value.rb', line 208

def remove_subnet_option_value(option_id, subnet_ip_address, vendor_name = nil)
  dhcp_remove_option_value_v5(
      option_id,
      vendor_name,
      DhcpsApi::DHCP_OPTION_SCOPE_INFO.build_for_subnet_scope(subnet_ip_address)
  )
end

#set_multicast_option_value(option_id, multicast_scope_name, option_type, values, vendor_name = nil) ⇒ void

This method returns an undefined value.

Sets an option value for a multicast scope.

api.set_multicast_option_value(26, ‘224.0.0.0’, DhcpsApi::DHCP_OPTION_DATA_TYPE::DhcpWordOption, [1500])

Examples:

Set a multicast scope option value

Parameters:

  • option_id (Fixnum)

    Option id

  • multicast_scope_name (String)

    Multicast scope ip address

  • option_type (DHCP_OPTION_DATA_TYPE)

    Option type

  • values (Array)

    array of values (or an array of one element if option supports one value only)

  • vendor_name (String, nil) (defaults to: nil)

    The name of the vendor class (for vendor options)

See Also:



72
73
74
75
76
77
78
79
80
# File 'lib/dhcpsapi/option_value.rb', line 72

def set_multicast_option_value(option_id, multicast_scope_name, option_type, values, vendor_name = nil)
  dhcp_set_option_value_v5(
      option_id,
      vendor_name,
      DhcpsApi::DHCP_OPTION_SCOPE_INFO.build_for_multicast_scope(multicast_scope_name),
      option_type,
      values.is_a?(Array) ? values : [values]
  )
end

#set_option_value(option_id, option_type, values, vendor_name = nil) ⇒ void

This method returns an undefined value.

Sets an option value for a default scope.

api.set_option_value(26, DhcpsApi::DHCP_OPTION_DATA_TYPE::DhcpWordOption, [1500])

Examples:

Set an option value

Parameters:

  • option_id (Fixnum)

    Option id

  • option_type (DHCP_OPTION_DATA_TYPE)

    Option type

  • values (Array)

    array of values (or an array of one element if option supports one value only)

  • vendor_name (String, nil) (defaults to: nil)

    The name of the vendor class (for vendor options)

See Also:



97
98
99
100
101
102
103
104
105
# File 'lib/dhcpsapi/option_value.rb', line 97

def set_option_value(option_id, option_type, values, vendor_name = nil)
  dhcp_set_option_value_v5(
      option_id,
      vendor_name,
      DhcpsApi::DHCP_OPTION_SCOPE_INFO.build_for_default_scope,
      option_type,
      values.is_a?(Array) ? values : [values]
  )
end

#set_reserved_option_value(option_id, reserved_ip_address, subnet_ip_address, option_type, values, vendor_name = nil) ⇒ void

This method returns an undefined value.

Sets an option value for a reservation.

api.set_reservationt_option_value(3, ‘192.168.42.100’, ‘192.168.42.0’, DhcpsApi::DHCP_OPTION_DATA_TYPE::DhcpIpAddressOption, [‘192.168.42.1’, ‘192.168.42.2’])

Examples:

Set a reservation option value

Parameters:

  • option_id (Fixnum)

    Option id

  • subnet_ip_address (String)

    Reservation ip address

  • subnet_ip_address (String)

    Subnet ip address

  • option_type (DHCP_OPTION_DATA_TYPE)

    Option type

  • values (Array)

    array of values (or an array of one element if option supports one value only)

  • vendor_name (String, nil) (defaults to: nil)

    The name of the vendor class (for vendor options)

See Also:



46
47
48
49
50
51
52
53
54
# File 'lib/dhcpsapi/option_value.rb', line 46

def set_reserved_option_value(option_id, reserved_ip_address, subnet_ip_address, option_type, values, vendor_name = nil)
  dhcp_set_option_value_v5(
      option_id,
      vendor_name,
      DhcpsApi::DHCP_OPTION_SCOPE_INFO.build_for_reserved_scope(reserved_ip_address, subnet_ip_address),
      option_type,
      values.is_a?(Array) ? values : [values]
  )
end

#set_subnet_option_value(option_id, subnet_ip_address, option_type, values, vendor_name = nil) ⇒ void

This method returns an undefined value.

Sets an option value for a subnet.

api.set_subnet_option_value(3, ‘192.168.42.0’, DhcpsApi::DHCP_OPTION_DATA_TYPE::DhcpIpAddressOption, [‘192.168.42.1’, ‘192.168.42.2’])

Examples:

Set a subnet option value

Parameters:

  • option_id (Fixnum)

    Option id

  • subnet_ip_address (String)

    Subnet ip address

  • option_type (DHCP_OPTION_DATA_TYPE)

    Option type

  • values (Array)

    Array of values (or an array of one element if option supports one value only)

  • vendor_name (String, nil) (defaults to: nil)

    The name of the vendor class (for vendor options)

See Also:



19
20
21
22
23
24
25
26
27
# File 'lib/dhcpsapi/option_value.rb', line 19

def set_subnet_option_value(option_id, subnet_ip_address, option_type, values, vendor_name = nil)
  dhcp_set_option_value_v5(
      option_id,
      vendor_name,
      DhcpsApi::DHCP_OPTION_SCOPE_INFO.build_for_subnet_scope(subnet_ip_address),
      option_type,
      values.is_a?(Array) ? values : [values]
  )
end