Class: DHCP::RequestedIPAddressOption

Inherits:
Option
  • Object
show all
Defined in:
lib/net/dhcp/options.rb

Overview

This option is used in a client request (DHCPDISCOVER) to allow the client to request that a particular IP address be assigned.

The code for this option is 50, and its length is 4.

The default value for this option is 0.0.0.0

Instance Attribute Summary

Attributes inherited from Option

#len, #payload, #type

Instance Method Summary collapse

Methods inherited from Option

#eql?, #pack, #to_a

Constructor Details

#initialize(params = {}) ⇒ RequestedIPAddressOption

Returns a new instance of RequestedIPAddressOption.



201
202
203
204
205
# File 'lib/net/dhcp/options.rb', line 201

def initialize(params={})
  params[:type] =  $DHCP_DISCOVERADDR
  params[:payload] = params.fetch(:payload, [0, 0, 0, 0])
  super(params)
end

Instance Method Details

#to_sObject



207
208
209
# File 'lib/net/dhcp/options.rb', line 207

def to_s
  "Requested IP address = #{self.payload.join('.')}"
end