Google

Capture

Packet Capture Object

Super Class:

Object

Included Modules:

Enumerable

Class Methods:

open_live(device[, snaplen[, promisc[, to_ms]]])

Open specified device and return Capture object. Default value for snaplen, promisc and to_ms are 68 octets, true and 1000 milliseconds.

open_offline(filename)

Open filename and return Capture object.

Methods:

close

Close Capture object.

datalink

Return an integer representing data-link type. (e.g. DLT_EN10MB)

dispatch([count]) {|packet|...}

Iterate over each packet. The argument given to the block is an instance of Packet or its sub-class.

count specifies the maximum number of packets to process. a count of -1 processes all the packets received in one buffer. a count of 0 processes all packets until an error occurs, EOF is reached, or the read times out. Default of count is -1.

each_packet([count]) {|packet|...}
each([count]) {|packet|...}
loop([count]) {|packet|...}

Iterate over each packet. The argument given to the block is an instance of Packet or its sub-class.

count specifies the maximum number of packets to process. A negative count processes packets forever or until EOF is reached. Default of count is -1.

snapshot
snaplen

Return the snapshot length.

setfilter(filter[, optimize])

Specify filter as packet filter. filter can be a string or a Filter object. optimize controls whether optimization is performed. Default of optimize is true.

stats

Return a Struct which represents packet statistics. This struct has following members.

recv
number of received packets
drop
number of dropped packets


fukusima@goto.info.waseda.ac.jp