class PacketGen::PcapNG::UnknownBlock
{UnknownBlock} is used to handle unsupported blocks of a pcapng file. @author Sylvain Daubert
Constants
- MIN_SIZE
Minimum Iblock size
Attributes
endian[RW]
@return [:little, :big]
section[RW]
@return [SHB]
Public Class Methods
new(options={})
click to toggle source
@option options [:little, :big] :endian set block endianness @option options [Integer] :type @option options [Integer] :block_len block total length @option options [::String] :body @option options [Integer] :block_len2 block total length
Calls superclass method
PacketGen::PcapNG::Block::new
# File lib/packetgen/pcapng/unknown_block.rb, line 30 def initialize(options={}) super endianness(options[:endian] || :little) recalc_block_len end
Public Instance Methods
options?()
click to toggle source
Has this block options? @return [false] @since 2.7.0
# File lib/packetgen/pcapng/unknown_block.rb, line 39 def options? false end
read(str_or_io)
click to toggle source
Reads a String or a IO to populate the object @param [::String,IO] str_or_io @return [self]
# File lib/packetgen/pcapng/unknown_block.rb, line 46 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()
click to toggle source
Return the object as a String @return [String]
Calls superclass method
# File lib/packetgen/pcapng/unknown_block.rb, line 60 def to_s pad_field :body recalc_block_len super end