Class: FFI::PCap::Dumper
- Inherits:
-
Object
- Object
- FFI::PCap::Dumper
- Defined in:
- lib/ffi/pcap/dumper.rb
Overview
Instance Method Summary collapse
- #_write(header, bytes) ⇒ Object
- #close ⇒ Object
- #flush ⇒ Object
-
#initialize(dumper) ⇒ Dumper
constructor
A new instance of Dumper.
- #tell ⇒ Object
- #write(*args) ⇒ Object
- #write_pkt(pkt) ⇒ Object
Constructor Details
#initialize(dumper) ⇒ Dumper
Returns a new instance of Dumper.
12 13 14 |
# File 'lib/ffi/pcap/dumper.rb', line 12 def initialize(dumper) @dumper = dumper end |
Instance Method Details
#_write(header, bytes) ⇒ Object
16 17 18 |
# File 'lib/ffi/pcap/dumper.rb', line 16 def _write(header, bytes) PCap.pcap_dump(@dumper, header, bytes) end |
#close ⇒ Object
39 40 41 |
# File 'lib/ffi/pcap/dumper.rb', line 39 def close PCap.pcap_dump_close(@dumper) end |
#flush ⇒ Object
35 36 37 |
# File 'lib/ffi/pcap/dumper.rb', line 35 def flush PCap.pcap_dump_flush(@dumper) end |
#tell ⇒ Object
31 32 33 |
# File 'lib/ffi/pcap/dumper.rb', line 31 def tell PCap.pcap_dump_ftell(@dumper) end |
#write(*args) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/ffi/pcap/dumper.rb', line 20 def write(*args) case args.first when Packet then write_pkt(*args) else _write(*args) end end |
#write_pkt(pkt) ⇒ Object
27 28 29 |
# File 'lib/ffi/pcap/dumper.rb', line 27 def write_pkt(pkt) _write(pkt.header, pkt.body_ptr) end |