class Lib::DHCP::Option122::SubOption::Option4

Attributes

max_retries[RW]
max_timeout[RW]
nom_timeout[RW]

Public Class Methods

new(nom_timeout, max_timeout, max_retries) click to toggle source
# File lib/lib/dhcp/options/option122.rb, line 175
def initialize(nom_timeout, max_timeout, max_retries)
  @oid = 4
  @nom_timeout = nom_timeout
  @max_timeout = max_timeout
  @max_retries = max_retries
end
unpack(oid, len, payload) click to toggle source
# File lib/lib/dhcp/options/option122.rb, line 202
def self.unpack(oid, len, payload)
  raise ArgumentError, "OID mismatch for TSP's AS-REQ/AS-REP Backoff and Retry, require 4, #{oid} given" unless oid == 4
  raise ArgumentError, "Wrong  length for TSP's AS-REQ/AS-REP Backoff and Retry = #{len}" unless len == 12
  nom_timeout, max_timeout, max_retries = payload.unpack('N3')
  self.new nom_timeout, max_timeout, max_retries
end

Public Instance Methods

name() click to toggle source
# File lib/lib/dhcp/options/option122.rb, line 182
def name
  "TSP's AS-REQ/AS-REP Backoff and Retry"
end
pack() click to toggle source
# File lib/lib/dhcp/options/option122.rb, line 198
def pack
  [4, 12, @nom_timeout.to_i, @max_timeout.to_i, @max_retries.to_i].pack('C2N3')
end
payload() click to toggle source
# File lib/lib/dhcp/options/option122.rb, line 186
def payload
  [@nom_timeout, @max_timeout, @max_retries]
end
to_i() click to toggle source
# File lib/lib/dhcp/options/option122.rb, line 194
def to_i
  nil
end
to_s() click to toggle source
# File lib/lib/dhcp/options/option122.rb, line 190
def to_s
  "#{@nom_timeout}, #{@max_timeout}, #{@max_retries}"
end