class FFI::PCap::Dead
A wrapper class for pcap devices opened with {PCap.open_dead}
Attributes
datalink[R]
Public Class Methods
new(opts={}, &block)
click to toggle source
Creates a fake pcap interface for compiling filters or opening a capture for output.
@param [Hash] opts
Options are ignored and passed to the super-class except those below.
@option opts [optional, String, Symbol, Integer] :datalink
The link-layer type for pcap. nil is equivalent to 0 (aka DLT_NULL).
@option opts [optional, Integer] :snaplen
The snapshot length for the pcap object. Defaults to FFI::PCap::DEFAULT_SNAPLEN
@return [Dead]
A FFI::PCap::Dead wrapper.
Calls superclass method
FFI::PCap::CommonWrapper::new
# File lib/ffi/pcap/dead.rb, line 32 def initialize(opts={}, &block) dl = opts[:datalink] || DataLink.new(0) @datalink = dl.kind_of?(DataLink) ? dl : DataLink.new(dl) @snaplen = opts[:snaplen] || DEFAULT_SNAPLEN @pcap = PCap.pcap_open_dead(@datalink.value, @snaplen) if @pcap.null? raise(LibError,"pcap_open_dead(): returned a null pointer",caller) end super(@pcap, opts, &block) end