org.jnetpcap.packet.analysis
Class JController

java.lang.Object
  extended by org.jnetpcap.packet.analysis.AbstractAnalyzer
      extended by org.jnetpcap.packet.analysis.JController
All Implemented Interfaces:
JAnalyzer, JPacketHandler<Pcap>

public class JController
extends AbstractAnalyzer
implements JPacketHandler<Pcap>

Author:
Mark Bednarczyk, Sly Technologies, Inc.

Constructor Summary
JController()
           
 
Method Summary
<T> boolean
add(JPacketHandler<T> o, T user)
           
 void addAnalyzer(JAnalyzer analyzer, int id)
           
 void consumePacket(JPacket packet)
           
 java.util.Set<JAnalyzer> getAnalyzers(int id)
           
 long getBufferSize()
           
 java.util.Queue<JPacket> getInQueue()
           
 java.util.Queue<JPacket> getOutQueue()
           
 int getPriority()
           
 long getProcessingTime()
           
 TimeoutQueue getTimeoutQueue()
           
 int hold()
           
 void nextPacket(JPacket packet, Pcap pcap)
          Callback function called on by libpcap and jNetPcap scanner once a new packet arrives and has passed the set BPF filter.
 boolean processHeaders(JPacket packet)
           
 boolean processHeaders(JPacket packet, long map)
           
protected  void processInboundQueue()
           
protected  void processingOutboundQueue()
           
 boolean processPacket(JPacket packet)
           
 int release()
           
 boolean remove(JPacketHandler<?> o)
           
 void setBufferSize(long bufferSize)
           
protected  void setProcessingTime(JPacket packet)
           
 
Methods inherited from class org.jnetpcap.packet.analysis.AbstractAnalyzer
setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JController

public JController()
Method Detail

add

public <T> boolean add(JPacketHandler<T> o,
                       T user)

addAnalyzer

public void addAnalyzer(JAnalyzer analyzer,
                        int id)

getAnalyzers

public java.util.Set<JAnalyzer> getAnalyzers(int id)

getBufferSize

public final long getBufferSize()

getInQueue

public java.util.Queue<JPacket> getInQueue()
Specified by:
getInQueue in interface JAnalyzer
Overrides:
getInQueue in class AbstractAnalyzer

getOutQueue

public java.util.Queue<JPacket> getOutQueue()
Specified by:
getOutQueue in interface JAnalyzer
Overrides:
getOutQueue in class AbstractAnalyzer

getPriority

public int getPriority()
Specified by:
getPriority in interface JAnalyzer
Overrides:
getPriority in class AbstractAnalyzer
Returns:

getProcessingTime

public long getProcessingTime()
Specified by:
getProcessingTime in interface JAnalyzer
Overrides:
getProcessingTime in class AbstractAnalyzer

getTimeoutQueue

public TimeoutQueue getTimeoutQueue()
Specified by:
getTimeoutQueue in interface JAnalyzer
Overrides:
getTimeoutQueue in class AbstractAnalyzer
Returns:

hold

public int hold()
Specified by:
hold in interface JAnalyzer
Overrides:
hold in class AbstractAnalyzer

nextPacket

public void nextPacket(JPacket packet,
                       Pcap pcap)
Description copied from interface: JPacketHandler
Callback function called on by libpcap and jNetPcap scanner once a new packet arrives and has passed the set BPF filter. The packet object dispatched is not allocated on a per call basis, but is shared between every call made. At the time the pcap dispatch or loop is established a freshly allocated packet is used to peer with received packet buffers from libpcap, scanned then dispatched to this method for the user to process. The packet memory and state is not persistent between calls. If a more persistent state is need it must be copied outof the supplied packet into a more permanent packet.
 public void nextPacket(JPacket packet, T user) {
        JPacket permanentPacket = new JPacket(packet);// creates a permanent packet
 }
 

Specified by:
nextPacket in interface JPacketHandler<Pcap>
Parameters:
packet - a non persistent between invokations decoded packet
pcap - user supplied object of type

processHeaders

public boolean processHeaders(JPacket packet)
Specified by:
processHeaders in interface JAnalyzer
Overrides:
processHeaders in class AbstractAnalyzer
Returns:

processHeaders

public boolean processHeaders(JPacket packet,
                              long map)
Specified by:
processHeaders in interface JAnalyzer
Overrides:
processHeaders in class AbstractAnalyzer

processInboundQueue

protected void processInboundQueue()

processingOutboundQueue

protected void processingOutboundQueue()

processPacket

public boolean processPacket(JPacket packet)
Specified by:
processPacket in interface JAnalyzer
Specified by:
processPacket in class AbstractAnalyzer

release

public int release()
Specified by:
release in interface JAnalyzer
Overrides:
release in class AbstractAnalyzer

remove

public boolean remove(JPacketHandler<?> o)

setBufferSize

public final void setBufferSize(long bufferSize)

setProcessingTime

protected void setProcessingTime(JPacket packet)

consumePacket

public void consumePacket(JPacket packet)
Specified by:
consumePacket in interface JAnalyzer
Overrides:
consumePacket in class AbstractAnalyzer