isc.sensor
Class UDPSessionProcessor

java.lang.Object
  extended by java.lang.Thread
      extended by isc.sensor.SessionProcessor
          extended by isc.sensor.UDPSessionProcessor
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
AppLayerMgrUDP

public class UDPSessionProcessor
extends SessionProcessor

The UDP Session processor manage the full lifecycle for each tcp session, defined by a client/port server/port pair. The Session Processor runs in its own thread

Author:
John Casey
Project: DNA_sensor - Aug 12, 2005

TODO:


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
protected static org.apache.log4j.Logger log
          log4j
protected static java.lang.String PROP_DBSIZE
          Property to specify the initial size of the inflight packet flow hashtable
protected static java.lang.String PROP_SESHASH_SIZE
          Property to specify the initial size of the active session hash table
protected static java.lang.String PROP_SESSION_OUTPUT
          Property to enable/disable session output
protected static java.lang.String PROP_WORKQ_SIZE
          Property to specify the initial size of the packet work queue
protected static java.lang.String[] SVCNAMES
          Array of well-know services
protected static int[] SVCNUMS
          Array of well-known service ports
 
Fields inherited from class isc.sensor.SessionProcessor
currentPacketTime, dbh, finish, packetDB, PROP_OUTPUTWRITERCLASS, props, sessions, sesTimer, sesWorkQueue, workItem, writeSession
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
UDPSessionProcessor()
          Create a new UDP Session processor, internally controlled Thread
UDPSessionProcessor(boolean startThread)
          Create a new UDP Session processor, stub for a subclass to manage the initialization of the thread
 
Method Summary
 void addPacket(UDPBean udpbean)
          Add a packet to be process into a session
protected  void flush(SessionBean udpsbean)
          Flush/write out a completed UDP Session
protected  void init(boolean startThread, boolean writeSession)
          Initialize this session processor from this class or a subclass.
 void insertBeanDB(UDPBean bean)
          Add a packet to the current session's packet summary DB
protected  void processWorkItem()
          Process the sesWorkQueue containing completed sessions @see SessionProcessor#addCompletedSession(String)
 
Methods inherited from class isc.sensor.SessionProcessor
addCompletedSession, close, finished, getActiveSessions, getSessionPackets, notifyProc, open, run, setFinish, updatePacketClock, waitProc
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SVCNUMS

protected static final int[] SVCNUMS
Array of well-known service ports


SVCNAMES

protected static final java.lang.String[] SVCNAMES
Array of well-know services


PROP_SESSION_OUTPUT

protected static final java.lang.String PROP_SESSION_OUTPUT
Property to enable/disable session output

See Also:
Constant Field Values

PROP_WORKQ_SIZE

protected static final java.lang.String PROP_WORKQ_SIZE
Property to specify the initial size of the packet work queue

See Also:
Constant Field Values

PROP_SESHASH_SIZE

protected static final java.lang.String PROP_SESHASH_SIZE
Property to specify the initial size of the active session hash table

See Also:
Constant Field Values

PROP_DBSIZE

protected static final java.lang.String PROP_DBSIZE
Property to specify the initial size of the inflight packet flow hashtable

See Also:
Constant Field Values

log

protected static org.apache.log4j.Logger log
log4j

Constructor Detail

UDPSessionProcessor

public UDPSessionProcessor()
Create a new UDP Session processor, internally controlled Thread


UDPSessionProcessor

public UDPSessionProcessor(boolean startThread)
Create a new UDP Session processor, stub for a subclass to manage the initialization of the thread

Parameters:
startThread - unused
Method Detail

init

protected void init(boolean startThread,
                    boolean writeSession)
Initialize this session processor from this class or a subclass. External management of the writer flag and thread creation

Parameters:
startThread - True to start the thread internally, False to start/manage the thread from a subclass
writeSession - True to write out the session record, False to disable

insertBeanDB

public void insertBeanDB(UDPBean bean)
                  throws java.lang.Exception
Add a packet to the current session's packet summary DB

Parameters:
bean - The UDPBean to add
Throws:
java.lang.Exception

processWorkItem

protected void processWorkItem()
Process the sesWorkQueue containing completed sessions @see SessionProcessor#addCompletedSession(String)

Overrides:
processWorkItem in class SessionProcessor

addPacket

public void addPacket(UDPBean udpbean)
Add a packet to be process into a session

Parameters:
udpbean - The UDPBean to be processed

flush

protected void flush(SessionBean udpsbean)
Flush/write out a completed UDP Session

Parameters:
udpsbean - The UDPSession to flush