Class: Caper::Offline
- Inherits:
-
CaptureWrapper
- Object
- CommonWrapper
- CaptureWrapper
- Caper::Offline
- Defined in:
- lib/caper/offline.rb
Overview
A wrapper class for pcap devices opened with open_offline()
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, #loop, #next, #old_next, #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.
29 30 31 32 33 34 35 |
# File 'lib/caper/offline.rb', line 29 def initialize(path, opts={}, &block) @path = path @errbuf = ErrorBuffer.create() @pcap = Caper.pcap_open_offline(File.(@path), @errbuf) raise(LibError, "pcap_open_offline(): #{@errbuf.to_s}") if @pcap.null? super(@pcap, opts, &block) end |
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
7 8 9 |
# File 'lib/caper/offline.rb', line 7 def path @path end |
Instance Method Details
#file_version ⇒ Object
41 42 43 |
# File 'lib/caper/offline.rb', line 41 def file_version "#{Caper.pcap_major_version(_pcap)}.#{Caper.pcap_minor_version(_pcap)}" end |
#swapped? ⇒ Boolean
37 38 39 |
# File 'lib/caper/offline.rb', line 37 def swapped? Caper.pcap_is_swapped(_pcap) == 1 ? true : false end |