Class: PacketGen::Header::DHCPv6::StatusCode

Inherits:
Option
  • Object
show all
Defined in:
lib/packetgen/header/dhcpv6/option.rb

Overview

DHCPv6 Status Code option

Author:

  • Sylvain Daubert

Since:

  • 2.5.0

Instance Attribute Summary collapse

Attributes inherited from Option

#length, #type

Instance Method Summary collapse

Methods inherited from Option

human_type, initialize, new, subclasses, to_human

Constructor Details

#initialize(options = {}) ⇒ StatusCode

Returns a new instance of StatusCode.

Parameters:

  • options (Hash) (defaults to: {})

Since:

  • 2.5.0



318
319
320
321
322
# File 'lib/packetgen/header/dhcpv6/option.rb', line 318

def initialize(options={})
  options[:length] = options[:status_message].to_s.size + 2 if options[:status_message]
  super
  self.length = self.sz - 4 if options[:status_message].nil?
end

Instance Attribute Details

#status_codeInteger

16-bit status code

Returns:

  • (Integer)


311
# File 'lib/packetgen/header/dhcpv6/option.rb', line 311

define_attr :status_code, BinStruct::Int16

#status_message::String

UTF-8 encoded text string suitable for display to an end user

Returns:

  • (::String)


315
# File 'lib/packetgen/header/dhcpv6/option.rb', line 315

define_attr :status_message, BinStruct::String

Instance Method Details

#human_dataString

Get human-readable data (status code)

Returns:

  • (String)

Since:

  • 2.5.0



326
327
328
# File 'lib/packetgen/header/dhcpv6/option.rb', line 326

def human_data
  status_code.to_s
end