Class BOOTP
In: lib/l5/bootp.rb  (CVS)
Parent: RacketPart

$Id: bootp.rb 14 2008-03-02 05:42:30Z warchild $

Copyright (c) 2008, Jon Hart All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in the
      documentation and/or other materials provided with the distribution.
    * Neither the name of the <organization> nor the
      names of its contributors may be used to endorse or promote products
      derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY Jon Hart ``AS IS’’ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Jon Hart BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Bootstrap Protocol — BOOTP

RFC951 (www.faqs.org/rfcs/rfc951.html)

Methods

add_option   fix!   new   to_s   to_str  

Constants

BOOTP_REQUEST = 1
BOOTP_REPLY = 2

Attributes

chaddr    Client hardware address
cip    Client IP address
file    Boot file name
flags    Flags. Generally unused
gip    Gateway IP address
hops    Hops between client and server
hwlen    Hardware adddress length
hwtype    Hardware address type
id    Transaction ID
payload    Payload
secs    Seceonds elapsed since client started trying to boot
server    Optional server host name
sip    Server IP address
type    Message type
yip    "Your" (client) IP address.

Public Class methods

[Source]

# File lib/l5/bootp.rb, line 94
  def initialize(*args)
    @options = []
    @options << "\x63\x82\x53\x63" # magic
    super
    @autofix = false
  end

Public Instance methods

[Source]

# File lib/l5/bootp.rb, line 66
  def add_option(number, value)
    o = TLV.new(1,1)
    o.type = number
    o.value = value
    o.length = value.length
    @options << o.encode
  end

[Source]

# File lib/l5/bootp.rb, line 74
  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

[Source]

# File lib/l5/bootp.rb, line 86
  def to_s
    puts "to_s"
  end

[Source]

# File lib/l5/bootp.rb, line 90
  def to_str
    puts to_str
  end

[Validate]