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.
9 10 11 12 |
# File 'lib/packetfu/protos/invalid.rb', line 9 def initialize(args={}) args[:body] ||= StructFu::String.new super(args[:body]) end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body
6 7 8 |
# File 'lib/packetfu/protos/invalid.rb', line 6 def body @body end |
Instance Method Details
#read(str) ⇒ Object
Reads a string to populate the object.
20 21 22 23 24 25 |
# File 'lib/packetfu/protos/invalid.rb', line 20 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.
15 16 17 |
# File 'lib/packetfu/protos/invalid.rb', line 15 def to_s self.to_a.map {|x| x.to_s}.join end |