verinec.netsim.firewall.util.tables.keys
Class TCPKey

java.lang.Object
  extended by verinec.netsim.firewall.util.tables.keys.SimpleKey
      extended by verinec.netsim.firewall.util.tables.keys.TCPKey
All Implemented Interfaces:
ITableKey

public class TCPKey
extends SimpleKey

Version:
$Revision: 825 $
Author:
jason.hug@unifr.ch

Field Summary
private static String CLOSE_WAIT
           
private static int CLOSE_WAIT_TIMEOUT
           
private static String CLOSED
           
private static int CLOSED_TIMEOUT
           
private static String CLOSING
           
private static int CLOSING_TIMEOUT
           
private  int dstPort
          Destination Port
private static String ESTABLISHED
           
private static int ESTABLISHED_TIMEOUT
           
private static String FIN_WAIT
           
private static int FIN_WAIT_TIMEOUT
           
private static String LAST_ACK
           
private static int LAST_ACK_TIMEOUT
           
private static String LISTEN
           
private static int LISTEN_TIMEOUT
           
private static String NONE
           
private static int NONE_TIMEOUT
           
private  int srcPort
          Source Port
private static String SYN_RCV
           
private static int SYN_RCV_TIMEOUT
           
private static String SYN_SENT
           
private static int SYN_SENT_TIMEOUT
           
private static String TIME_WAIT
           
private static int TIME_WAIT_TIMEOUT
           
 
Fields inherited from class verinec.netsim.firewall.util.tables.keys.SimpleKey
CONFIG_FILE_NAME
 
Constructor Summary
TCPKey(IAddress src, IAddress dst, int srcPort, int dstPort)
          Creates a new TCP Key for the Hash Table.
 
Method Summary
 boolean equals(Object other)
          Equals methos which overrides @link Object#equals(java.lang.Object) The method was overriden so that the one can compare @link ITableKey Objects.
 int getDstPort()
           
private  FSMSocketImpl getSocket(Node node)
           
 int getSrcPort()
           
 boolean handleEstablished(Packet packet, StatefulInspection stateInspect)
          Method which checks if a packet is in the NEW satet of the appropriate packet's protocol.
 boolean handleNew(Packet packet, StatefulInspection stateInspect)
          Method which checks if a packet is in the ESTABLISHED satet of the appropriate packet's protocol.
 boolean handleRelated(Packet packet, StatefulInspection stateInspect)
          Method which checks if a packet is in the RELATED satet of the appropriate packet's protocol.
static Element initTimeouts(Document doc)
          Method which loads the timeout values from a config document.
private  String retrieveState(FSMSocketImpl sock)
           
private  int retrieveTimeout(FSMSocketImpl sock)
           
 TableEntry updateEntry(TableEntry entry, boolean reply, Node node, String hostname)
          Method which updates the connection entry according to the protocol.
 
Methods inherited from class verinec.netsim.firewall.util.tables.keys.SimpleKey
getDirection, getDst, getLogger, getProtocol, getSrc, hashCode, loadTimeouts, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

private static final String NONE
See Also:
Constant Field Values

NONE_TIMEOUT

private static int NONE_TIMEOUT

CLOSED

private static final String CLOSED
See Also:
Constant Field Values

CLOSED_TIMEOUT

private static int CLOSED_TIMEOUT

CLOSE_WAIT

private static final String CLOSE_WAIT
See Also:
Constant Field Values

CLOSE_WAIT_TIMEOUT

private static int CLOSE_WAIT_TIMEOUT

CLOSING

private static final String CLOSING
See Also:
Constant Field Values

CLOSING_TIMEOUT

private static int CLOSING_TIMEOUT

ESTABLISHED

private static final String ESTABLISHED
See Also:
Constant Field Values

ESTABLISHED_TIMEOUT

private static int ESTABLISHED_TIMEOUT

FIN_WAIT

private static final String FIN_WAIT
See Also:
Constant Field Values

FIN_WAIT_TIMEOUT

private static int FIN_WAIT_TIMEOUT

LAST_ACK

private static final String LAST_ACK
See Also:
Constant Field Values

LAST_ACK_TIMEOUT

private static int LAST_ACK_TIMEOUT

LISTEN

private static final String LISTEN
See Also:
Constant Field Values

LISTEN_TIMEOUT

private static int LISTEN_TIMEOUT

SYN_RCV

private static final String SYN_RCV
See Also:
Constant Field Values

SYN_RCV_TIMEOUT

private static int SYN_RCV_TIMEOUT

SYN_SENT

private static final String SYN_SENT
See Also:
Constant Field Values

SYN_SENT_TIMEOUT

private static int SYN_SENT_TIMEOUT

TIME_WAIT

private static final String TIME_WAIT
See Also:
Constant Field Values

TIME_WAIT_TIMEOUT

private static int TIME_WAIT_TIMEOUT

dstPort

private int dstPort
Destination Port


srcPort

private int srcPort
Source Port

Constructor Detail

TCPKey

public TCPKey(IAddress src,
              IAddress dst,
              int srcPort,
              int dstPort)
Creates a new TCP Key for the Hash Table.

Parameters:
src - Source address of the TCP Packet.
dst - Destination address of the TCP Packet.
srcPort - Destination Port of the TCP Packet.
dstPort - Source Port of the TCP Packet
Method Detail

getDstPort

public int getDstPort()
Returns:
Returns the dstPort.

getSrcPort

public int getSrcPort()
Returns:
Returns the srcPort.

equals

public boolean equals(Object other)
Description copied from interface: ITableKey
Equals methos which overrides @link Object#equals(java.lang.Object) The method was overriden so that the one can compare @link ITableKey Objects. This is useful to look for HashTable entries in @link verinec.netsim.firewall.util.tables.StatefulInspection

Specified by:
equals in interface ITableKey
Overrides:
equals in class SimpleKey
Parameters:
other - the Other Object to compare against.
Returns:
True if the two Objects are of the same type and have the same field values.
See Also:
SimpleKey.equals(java.lang.Object)

handleNew

public boolean handleNew(Packet packet,
                         StatefulInspection stateInspect)
Description copied from interface: ITableKey
Method which checks if a packet is in the ESTABLISHED satet of the appropriate packet's protocol.

Parameters:
packet - Packet which is checked for its state.
stateInspect - State Table with all the connection entries of the node.
Returns:
True if the packet is consider ESTABLISHED false otherwise.
See Also:
ITableKey.handleNew(verinec.netsim.entities.packets.Packet, verinec.netsim.firewall.util.tables.StatefulInspection)

handleEstablished

public boolean handleEstablished(Packet packet,
                                 StatefulInspection stateInspect)
Description copied from interface: ITableKey
Method which checks if a packet is in the NEW satet of the appropriate packet's protocol.

Parameters:
packet - Packet which is checked for its state.
stateInspect - State Table with all the connection entries of the node.
Returns:
True if the packet is consider NEW false otherwise.
See Also:
ITableKey.handleEstablished(verinec.netsim.entities.packets.Packet, verinec.netsim.firewall.util.tables.StatefulInspection)

handleRelated

public boolean handleRelated(Packet packet,
                             StatefulInspection stateInspect)
Description copied from interface: ITableKey
Method which checks if a packet is in the RELATED satet of the appropriate packet's protocol.

Parameters:
packet - Packet which is checked for its state.
stateInspect - State Table with all the connection entries of the node.
Returns:
True if the packet is consider RELATED false otherwise.
See Also:
ITableKey.handleRelated(verinec.netsim.entities.packets.Packet, verinec.netsim.firewall.util.tables.StatefulInspection)

updateEntry

public TableEntry updateEntry(TableEntry entry,
                              boolean reply,
                              Node node,
                              String hostname)
Description copied from interface: ITableKey
Method which updates the connection entry according to the protocol. The timeout value for the connection is set according to the protocol. Furthermore the state of the connection is updated if needed.

Parameters:
entry - Entry to update.
reply - If we are dealing with a reply packet.
node - Node object needed to retrieve the socket state of a connection (Needed for TCP connections).
hostname - Hostname for which the Stateful Inspection Table is active.
Returns:
The new entry, where the timeout value and the state of the connection has been newly set.
See Also:
ITableKey.updateEntry(verinec.netsim.firewall.util.tables.TableEntry, boolean, verinec.netsim.components.Node, java.lang.String)

retrieveTimeout

private int retrieveTimeout(FSMSocketImpl sock)

retrieveState

private String retrieveState(FSMSocketImpl sock)

getSocket

private FSMSocketImpl getSocket(Node node)

initTimeouts

public static Element initTimeouts(Document doc)
Method which loads the timeout values from a config document. This method loads each states timeout value which was stored within a config document. The loaded parameters are returned as an Element.

Parameters:
doc - The document where the timeout values are stored. If doc is null the default values will be used.
Returns:
The loaded values stored in an Element.

Copyright © 2005 Verinec, DIUF