Class: DHCP::ClientSystemArchitectureOption

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

Overview

Octet “n” gives the number of octets containing “architecture types” (not including the code and len fields). It MUST be an even number greater than zero. Clients that support more than one architecture type MAY include a list of these types in their initial DHCP and PXE boot server packets. The list of supported architecture types MAY be reduced in any packet exchange between the client and server(s). Octets “n1” and “n2” encode a 16-bit architecture type identifier that describes the pre-boot runtime environment(s) of the client machine.

See rfc4578 for full details

The code for this option is 93, and its length must be an even number greater than zero.

The default payload for this option is $DHCP_CLIENTARCH_I386

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

Returns a new instance of ClientSystemArchitectureOption.



421
422
423
424
425
# File 'lib/net/dhcp/options.rb', line 421

def initialize(params={})
  params[:type] =  $DHCP_CLIENTARCH
  params[:payload] = params.fetch(:payload, [$DHCP_CLIENTARCH_I386].pack('n').unpack('C*'))
  super(params)
end

Instance Method Details

#to_sObject



426
427
428
429
430
431
432
433
434
435
# File 'lib/net/dhcp/options.rb', line 426

def to_s
  arch_id = self.payload.pack('C*').unpack('n').first
  if (arch_id > ($DHCP_CLIENTARCH_NAMES.size-1))
    arch = 'unknown'
  else
    arch = $DHCP_CLIENTARCH_NAMES[arch_id]
  end

  "Client System Architecture = #{arch}"
end