class PacketGen::Header::BOOTP

Bootstrap Protocol, {tools.ietf.org/html/rfc951 RFC 951}

A BOOTP header consists of:

Create a BOOTP header

# standalone
bootp = PacketGen::Header::BOOTP.new
# in a packet
pkt = PacketGen.gen('IP').add('BOOTP')
# access to BOOTP header
pkt.bootp      # => PacketGen::Header::BOOTP

@author Sylvain Daubert @since 2.2.0

Constants

OPCODES

DHCP opcodes

UDP_CLIENT_PORT
UDP_SERVER_PORT

Public Instance Methods

inspect() click to toggle source

@return [String]

Calls superclass method
# File lib/packetgen/header/bootp.rb, line 134
def inspect
  super do |attr|
    next unless (attr == :chaddr) && (self.hlen == 6)

    Inspect.inspect_attribute(attr, Eth::MacAddr.new.read(self[:chaddr][0, 6]))
  end
end
reply!() click to toggle source

Invert opcode, if known @return [self]

# File lib/packetgen/header/bootp.rb, line 144
def reply!
  case self.op
  when 1 then self.op = 2
  when 2 then self.op = 1
  end
  self
end