Class: DHCP::OptSInt32

Inherits:
OptInt32 show all
Defined in:
lib/dhcp/options.rb

Overview

Class for four-byte signed integer value DHCP options

Instance Attribute Summary

Attributes inherited from OptData

#data

Attributes inherited from Opt

#name, #opt

Instance Method Summary collapse

Methods inherited from OptInt8

#to_s

Methods inherited from OptFixedData

#data=, #initialize

Methods inherited from OptData

#get, #initialize, #opt_header, #set, #to_opt, #to_s

Methods inherited from Opt

#initialize, #opt_header, #to_opt, #to_s

Constructor Details

This class inherits a constructor from DHCP::OptFixedData

Instance Method Details

#bin_to_data(data) ⇒ Object

Convert unsigned form back to signed data



491
492
493
# File 'lib/dhcp/options.rb', line 491

def bin_to_data(data)
  (super(data) + 2**31) % 2**32 - 2**31
end

#data_to_bin(data) ⇒ Object

Convert signed data to unsigned form



486
487
488
# File 'lib/dhcp/options.rb', line 486

def data_to_bin(data)
  super(data % 2**32)
end