Class: FFI::PCap::Offline
- Inherits:
-
CaptureWrapper
- Object
- CommonWrapper
- CaptureWrapper
- FFI::PCap::Offline
- Defined in:
- lib/ffi/pcap/offline.rb
Overview
A wrapper class for pcap devices opened with open_offline.
Constant Summary
Constants inherited from CaptureWrapper
Instance Attribute Summary collapse
-
#path ⇒ Object
Returns the value of attribute path.
Attributes inherited from CaptureWrapper
Attributes inherited from CommonWrapper
Instance Method Summary collapse
- #file_version ⇒ Object
-
#initialize(path, opts = {}, &block) ⇒ Offline
constructor
Creates a pcap interface for reading saved capture files.
- #swapped? ⇒ Boolean
Methods inherited from CaptureWrapper
#breakloop, #dispatch, #fileno, #loop, #next, #old_next, #selectable_fd, #selectable_io, #set_filter
Methods inherited from CommonWrapper
#close, #closed?, #compile, #datalink, #geterr, #open_dump, #ready?, #snaplen, #supported_datalinks, #to_ptr
Constructor Details
#initialize(path, opts = {}, &block) ⇒ Offline
Creates a pcap interface for reading saved capture files.
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/ffi/pcap/offline.rb', line 33 def initialize(path, opts={}, &block) @path = path @errbuf = ErrorBuffer.new @pcap = PCap.pcap_open_offline(File.(@path), @errbuf) if @pcap.null? raise(LibError,"pcap_open_offline(): #{@errbuf}",caller) end super(@pcap, opts, &block) end |
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
10 11 12 |
# File 'lib/ffi/pcap/offline.rb', line 10 def path @path end |
Instance Method Details
#file_version ⇒ Object
49 50 51 |
# File 'lib/ffi/pcap/offline.rb', line 49 def file_version "#{PCap.pcap_major_version(_pcap)}.#{PCap.pcap_minor_version(_pcap)}" end |
#swapped? ⇒ Boolean
45 46 47 |
# File 'lib/ffi/pcap/offline.rb', line 45 def swapped? PCap.pcap_is_swapped(_pcap) == 1 ? true : false end |