Class: Caper::Dead
- Inherits:
-
CommonWrapper
- Object
- CommonWrapper
- Caper::Dead
- Defined in:
- lib/caper/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.
23 24 25 26 27 28 29 30 |
# File 'lib/caper/dead.rb', line 23 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 = Caper.pcap_open_dead(@datalink.value, @snaplen) raise(LibError, "pcap_open_dead(): returned a null pointer") if @pcap.null? super(@pcap, opts, &block) end |
Instance Attribute Details
#datalink ⇒ Object (readonly)
Returns the value of attribute datalink.
6 7 8 |
# File 'lib/caper/dead.rb', line 6 def datalink @datalink end |