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

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

public class UDPKey
extends SimpleKey
implements ITableKey

Version:
$Revision: 825 $
Author:
hugja

Field Summary
private  int dstPort
           
private  int srcPort
           
static int UDP_TIMEOUT
          Default time out value for UDP connections
 
Fields inherited from class verinec.netsim.firewall.util.tables.keys.SimpleKey
CONFIG_FILE_NAME
 
Constructor Summary
UDPKey(IAddress src, IAddress dst, int srcPort, int dstPort)
          Creates a new UDP 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()
           
 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.
 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
 
Methods inherited from interface verinec.netsim.firewall.util.tables.keys.ITableKey
getProtocol, hashCode
 

Field Detail

UDP_TIMEOUT

public static int UDP_TIMEOUT
Default time out value for UDP connections


dstPort

private int dstPort

srcPort

private int srcPort
Constructor Detail

UDPKey

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

Parameters:
src - Source address of the UDP Packet.
dst - Destination address of the UDP Packet.
srcPort - Destination Port of the UDP Packet.
dstPort - Source Port of the UDP 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.

Specified by:
handleNew in interface ITableKey
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.

Specified by:
handleEstablished in interface ITableKey
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.

Specified by:
handleRelated in interface ITableKey
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.

Specified by:
updateEntry in interface ITableKey
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)

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