Class: Racket::L5::BOOTP

Inherits:
RacketPart show all
Defined in:
lib/racket/l5/bootp.rb

Overview

Constant Summary collapse

BOOTP_REQUEST =
1
BOOTP_REPLY =
2

Instance Attribute Summary

Attributes inherited from RacketPart

#autofix

Instance Method Summary collapse

Methods inherited from RacketPart

#autofix?, #pretty

Constructor Details

#initialize(*args) ⇒ BOOTP

Returns a new instance of BOOTP.



96
97
98
99
100
101
# File 'lib/racket/l5/bootp.rb', line 96

def initialize(*args)
  @options = []
  @options << "\x63\x82\x53\x63" # magic
  super
  @autofix = false
end

Instance Method Details

#add_option(number, value) ⇒ Object



68
69
70
71
72
73
74
# File 'lib/racket/l5/bootp.rb', line 68

def add_option(number, value)
  o = Racket::Misc::TLV.new(1,1)
  o.type = number
  o.value = value
  o.length = value.length
  @options << o.encode
end

#fix!Object



76
77
78
79
80
81
82
83
84
85
86
# File 'lib/racket/l5/bootp.rb', line 76

def fix!
  # tack on an EOL to the options
  newpayload = @options.join + "\xff"
 
  # pad out to 64 bytes
  while (newpayload.length != 64)
    newpayload += "\x00"
  end

  self.payload = newpayload + self.payload
end

#to_sObject



88
89
90
# File 'lib/racket/l5/bootp.rb', line 88

def to_s
  puts "to_s"
end

#to_strObject



92
93
94
# File 'lib/racket/l5/bootp.rb', line 92

def to_str
  puts to_str
end