class FFI::PCap::Offline
A wrapper class for pcap devices opened with {PCap.open_offline}.
Attributes
path[RW]
Public Class Methods
new(path, opts={}, &block)
click to toggle source
Creates a pcap interface for reading saved capture files.
@param [String] path
The path to the file to open.
@param [Hash] opts
Options are ignored and passed to the super-class except for those below.
@option opts [ignored] :path
The :path option will be overridden with the value of the path argument. If specified in opts, its value will be ignored.
@return [Offline]
A offline wrapper.
@raise [LibError]
On failure, an exception is raised with the relevant error message from libpcap.
Calls superclass method
FFI::PCap::CaptureWrapper::new
# File lib/ffi/pcap/offline.rb, line 33 def initialize(path, opts={}, &block) @path = path @errbuf = ErrorBuffer.new @pcap = PCap.pcap_open_offline(File.expand_path(@path), @errbuf) if @pcap.null? raise(LibError,"pcap_open_offline(): #{@errbuf}",caller) end super(@pcap, opts, &block) end
Public Instance Methods
file_version()
click to toggle source
# File lib/ffi/pcap/offline.rb, line 49 def file_version "#{PCap.pcap_major_version(_pcap)}.#{PCap.pcap_minor_version(_pcap)}" end
swapped?()
click to toggle source
# File lib/ffi/pcap/offline.rb, line 45 def swapped? PCap.pcap_is_swapped(_pcap) == 1 ? true : false end