org.jnetstream.filter
Interface Filter<T extends FilterTarget>

All Known Implementing Classes:
BPFFilter, BPFFilter.BPFProtocolFilter, Filter.AND, Filter.MAXIMUM, Filter.MINIMUM, Filter.NOT, Filter.OR, PcapDebugFilter, PcapFilter

public interface Filter<T extends FilterTarget>

A filter used to limit that scope of captures, packet reads from a file or from an IO stream.

Author:
Mark Bednarczyk, Sly Technologies, Inc.

Nested Class Summary
static class Filter.AND<T extends FilterTarget>
          Takes two filters (left and right) and does an AND logical operation after evaluating each of the filters.
static class Filter.MAXIMUM<T extends FilterTarget>
          Returns the larger value either returned by the filter or the supplied max value.
static class Filter.MINIMUM<T extends FilterTarget>
          Returns the smaller value either returned by the filter or the supplied min value.
static class Filter.NOT<T extends FilterTarget>
          Inverts the values returned by a source filter.
static class Filter.OR<T extends FilterTarget>
          A filter used to limit that scope of captures, packet reads from a file or from an IO stream.
 
Field Summary
static Filter<?> TRUE
           
 
Method Summary
 boolean accept(java.nio.ByteBuffer buffer, T target)
           
 long execute(java.nio.ByteBuffer buffer, T target)
          Executes the given filter and returns the result of the evaluation against the buffer.
 

Field Detail

TRUE

static final Filter<?> TRUE
Method Detail

accept

boolean accept(java.nio.ByteBuffer buffer,
               T target)
               throws FilterException
Throws:
FilterException

execute

long execute(java.nio.ByteBuffer buffer,
             T target)
             throws FilterException
Executes the given filter and returns the result of the evaluation against the buffer. True means the filter matched, false means it failed.

Parameters:
buffer - buffer to execute the filter against
target - Filter target of this filter. This is typically the DLT (Data Link Type) of the first structure in the buffer.
Returns:
true filter succeeded, false failed
Throws:
FilterException - TODO