Class: PacketFu::InvalidHeader
- Includes:
- StructFu
- Defined in:
- lib/packetfu/protos/invalid.rb
Overview
InvalidHeader catches all packets that we don’t already have a Struct for, or for whatever reason, violates some basic packet rules for other packet types.
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ InvalidHeader
constructor
A new instance of InvalidHeader.
-
#read(str) ⇒ Object
Reads a string to populate the object.
-
#to_s ⇒ Object
Returns the object in string form.
Methods included from StructFu
#clone, #set_endianness, #sz, #typecast
Methods inherited from Struct
Constructor Details
#initialize(args = {}) ⇒ InvalidHeader
Returns a new instance of InvalidHeader.
10 11 12 13 |
# File 'lib/packetfu/protos/invalid.rb', line 10 def initialize(args={}) args[:body] ||= StructFu::String.new super(args[:body]) end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body
7 8 9 |
# File 'lib/packetfu/protos/invalid.rb', line 7 def body @body end |
Instance Method Details
#read(str) ⇒ Object
Reads a string to populate the object.
21 22 23 24 25 26 |
# File 'lib/packetfu/protos/invalid.rb', line 21 def read(str) force_binary(str) return self if str.nil? self[:body].read str self end |
#to_s ⇒ Object
Returns the object in string form.
16 17 18 |
# File 'lib/packetfu/protos/invalid.rb', line 16 def to_s self.to_a.map {|x| x.to_s}.join end |