# Filter

  `Filter` determines whether a packet satisfies specified condition. Actually `Filter` is wrapper for `bpf_program`. For details of filter expression, see `tcpdump(1)`.

## Super Class:

  `Object`

## Class Methods:

`compile(expr, capture[, optimize[, netmask]])`
`new(expr, capture[, optimize[, netmask]])`

  Create a new `Filter` object. expr is a filter string. capture is a `Capture` object. optimize controls optimization of resulting code. netmask specifies the netmask of the local net.

  Created `Filter` can be applied to packets captured via capture.

  If `libpcap-0.5 or later` used, one of following values can be specified instead of capture:

  > `[snaplen, datalink]`
  >   an array containing required parameters
  > omitted (or `nil`)
  >   Ethernet default (`[68, `DLT_EN10MB`]`)

## Methods:

`self === packet`
`self =~ packet`

  Return true if packet matches this filter.

`~ self`

  Return a `Filter` which represents "not `self`".

`self | other`

  Return a `Filter` which represents "`self` or other".

`self & other`

  Return a `Filter` which represents "`self` and other".

`source`

  Returns the orginal string from which the filter is constructed.

fukusima@goto.info.waseda.ac.jp