Class: DHCP::HostNameOption

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

Overview

This option specifies the name of the client. The name may or may not be qualified with the local domain name (see section 3.17 for the preferred way to retrieve the domain name). See RFC 1035 for character set restrictions.

The code for this option is 12, and its minimum length is 1.

The default value for this option is ‘caprica’

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 = {}) ⇒ HostNameOption

Returns a new instance of HostNameOption.



146
147
148
149
150
# File 'lib/net/dhcp/options.rb', line 146

def initialize(params={})
  params[:type] = $DHCP_HOSTNAME
  params[:payload] = params.fetch(:payload, 'caprica'.unpack('C*'))
  super(params)
end

Instance Method Details

#to_sObject



152
153
154
# File 'lib/net/dhcp/options.rb', line 152

def to_s()
  "Host Name = #{self.payload.pack('C*')}"
end