Class: FFI::PCap::Dead
- Inherits:
-
CommonWrapper
- Object
- CommonWrapper
- FFI::PCap::Dead
- Defined in:
- lib/ffi/pcap/dead.rb
Overview
A wrapper class for pcap devices opened with open_dead
Instance Attribute Summary collapse
-
#datalink ⇒ Object
readonly
Returns the value of attribute datalink.
Attributes inherited from CommonWrapper
Instance Method Summary collapse
-
#initialize(opts = {}, &block) ⇒ Dead
constructor
Creates a fake pcap interface for compiling filters or opening a capture for output.
Methods inherited from CommonWrapper
#close, #closed?, #compile, #geterr, #open_dump, #ready?, #snaplen, #supported_datalinks, #to_ptr
Constructor Details
#initialize(opts = {}, &block) ⇒ Dead
Creates a fake pcap interface for compiling filters or opening a capture for output.
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# 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 |
Instance Attribute Details
#datalink ⇒ Object (readonly)
Returns the value of attribute datalink.
11 12 13 |
# File 'lib/ffi/pcap/dead.rb', line 11 def datalink @datalink end |