Class: PacketGen::PcapNG::UnknownBlock
- Defined in:
- lib/packetgen/pcapng/unknown_block.rb
Overview
UnknownBlock is used to handle unsupported blocks of a pcapng file.
Constant Summary collapse
- MIN_SIZE =
Minimum Iblock size
12
Instance Attribute Summary collapse
Attributes inherited from Block
#block_len, #block_len2, #type
Instance Method Summary collapse
-
#options? ⇒ false
Has this block options?.
-
#read(str_or_io) ⇒ self
Reads a String or a IO to populate the object.
-
#to_s ⇒ String
Return the object as a String.
Methods inherited from Block
#initialize, #pad_field, #recalc_block_len
Constructor Details
This class inherits a constructor from PacketGen::PcapNG::Block
Instance Attribute Details
#body ⇒ BinStruct::String
24 |
# File 'lib/packetgen/pcapng/unknown_block.rb', line 24 define_attr_before :block_len2, :body, BinStruct::String |
#endian ⇒ :little, :big
18 19 20 |
# File 'lib/packetgen/pcapng/unknown_block.rb', line 18 def endian @endian end |
#section ⇒ SHB
20 21 22 |
# File 'lib/packetgen/pcapng/unknown_block.rb', line 20 def section @section end |
Instance Method Details
#options? ⇒ false
Has this block options?
29 30 31 |
# File 'lib/packetgen/pcapng/unknown_block.rb', line 29 def false end |
#read(str_or_io) ⇒ self
Reads a String or a IO to populate the object
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/packetgen/pcapng/unknown_block.rb', line 36 def read(str_or_io) io = to_io(str_or_io) return self if io.eof? self[:type].read(io.read(4)) self[:block_len].read(io.read(4)) self[:body].read(io.read(self[:block_len].to_i - MIN_SIZE)) read_blocklen2_and_check(io) self end |
#to_s ⇒ String
Return the object as a String
50 51 52 53 54 |
# File 'lib/packetgen/pcapng/unknown_block.rb', line 50 def to_s pad_field(:body) recalc_block_len super end |