class Packetz::Capture
- Packetz::Capture
- Reference
- Object
Overview
The Capture
class is responsible for all of the supported capturing operations provided
by LibPcap
in a clean, friendly API.
Simply start a new capture object called cap
, with all the defaults:
cap = Packetz::Capture.new
If you want to start customizing the capture object during initialization, you have a few
ways to do that to change the #interface
, #snapshot_length
, #promiscuous_mode
and #timeout_ms
values
of a capture.
Listen specifically on the en0
network interface:
cap = Packetz::Capture.new("en0")
Listen with alll the default options, but in promiscuous mode:
cap = Packetz::Capture.new(promiscuous_mode = true)
Change the default snapshot length from 65535
to half that size.
cap = Packetz::Capture.new(snapshot_length: 65535/2)
Defined in:
packetz/capture.crConstructors
-
.new(interface : String = Packetz.interfaces.default, snapshot_length : Int32 = 65535, promiscuous_mode : Bool | Int32 = 0, timeout_ms : Int32 = 1, monitor_mode : Bool = false)
The
#initialize
method takes care of setting up a newCapture
object.
Instance Method Summary
- #each(&)
- #enable_monitor_mode!
- #immediate_mode!
- #immediate_mode=(value : Int32)
- #immediate_mode=(value : Bool)
- #immediate_mode?
-
#interface : String
Provides access to underlying interface string.
-
#interface=(interface : String)
Set the network interface to a given string.
- #microsecond_timestamp_precision!
- #microsecond_timestamp_precision?
- #monitor_mode : Bool
- #monitor_mode=(value : Bool)
- #monitor_mode?
- #nanosecond_timestamp_precision!
- #nanosecond_timestamp_precision?
- #next
- #non_blocking_mode!
- #non_blocking_mode=(value : Int32)
- #non_blocking_mode=(value : Bool)
- #non_blocking_mode?
- #promiscuous_mode
- #promiscuous_mode!
- #promiscuous_mode=(value : Bool)
- #promiscuous_mode=(value : Int32)
- #promiscuous_mode?
- #reset!
- #snapshot_length : Int32
- #snapshot_length=(value : Int32)
-
#start!
Handles activating the actual packet capturing.
- #started?
- #stop!
- #stopped?
- #supports_monitor_mode?
- #timeout_ms : Int32
- #timeout_ms=(value : Int32)
- #timestamp_precision
Constructor Detail
The #initialize
method takes care of setting up a new Capture
object.