class PacketGen::Header::BOOTP
Bootstrap Protocol, {tools.ietf.org/html/rfc951 RFC 951}
A BOOTP
header consists of:
-
an operation code field ({#op} of type {Types::Int8Enum}),
-
a hardware address type ({#htype} of type {Types::Int8}),
-
a hardware address length ({#hlen} of type {Types::Int8}),
-
a {#hops} field ({Types::Int8}),
-
a transaction ID ({#xid} of type {Types::Int32}),
-
a {#secs} field (){Types::Int16}),
-
a {#flags} field (){Types::Int16}):
-
a 1-bit broadcast flag ({#b}),
-
a 15-bit Must Be Zero field ({#mbz}),
-
-
a {#ciaddr} field ({IP::Addr}),
-
a {#yiaddr} field ({IP::Addr}),
-
a {#siaddr} field ({IP::Addr}),
-
a {#giaddr} field ({IP::Addr}),
-
a {#chaddr} field (16-byte {Types::String}),
-
a {#sname} field (64-byte {Types::CString}),
-
a {#file} field (128-byte {Types::CString}),
-
and a body ({Types::String}).
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
@return [String]
# 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
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