verinec.netsim.firewall.packetFilter
Class PacketFilterRule

java.lang.Object
  extended by verinec.netsim.firewall.packetFilter.PacketFilterRule
All Implemented Interfaces:
IPacketFilter

public class PacketFilterRule
extends Object
implements IPacketFilter

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

Field Summary
private  String id
           
private  Logger logger
           
private  IPacketAction packetAction
           
private  PacketMatchList packetMatchList
           
 
Constructor Summary
protected PacketFilterRule(Element node)
          Creates a new Packet Filter Rule.
 
Method Summary
 String getId()
           
 IPacketAction getPacketAction()
           
 PacketMatchList getPacketMatchList()
           
 IPacketAction matchAction(Packet packet, String interfaceRef, String hostname, String simTime, String direction, ILogger eventsLog)
          This method receives a packet and checks in the defined packet-filter-chains if there are any rules that match.
 void setId(String id)
           
 void setPacketAction(IPacketAction packetAction)
           
 void setPacketMatchList(PacketMatchList packetMatchList)
           
 String toString()
          This returns a String representation of the Packet Filter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

id

private String id

packetMatchList

private PacketMatchList packetMatchList

packetAction

private IPacketAction packetAction

logger

private Logger logger
Constructor Detail

PacketFilterRule

protected PacketFilterRule(Element node)
Creates a new Packet Filter Rule. The packet filter rules configurations consist of the Packet Match List and the Packet Action. These two components configurations are specified in the node Element.

Parameters:
node - Element which specifies the configurations for the Packet Filter Rule.
Method Detail

matchAction

public IPacketAction matchAction(Packet packet,
                                 String interfaceRef,
                                 String hostname,
                                 String simTime,
                                 String direction,
                                 ILogger eventsLog)
Description copied from interface: IPacketFilter
This method receives a packet and checks in the defined packet-filter-chains if there are any rules that match. If so the defined action is returned. If no match was observed the default policy of the packet-filter-chain is returned.

Specified by:
matchAction in interface IPacketFilter
Parameters:
packet - Packet that should be inspected.
interfaceRef - From which interface the packet came from.
hostname - In which direction the packet is heading. Use @link verinec.netsim.firewall.IFirewall#IN IN, @link verinec.netsim.firewall.IFirewall#OUT OUT or @link verinec.netsim.firewall.IFirewall#FORWARD FORWARD.
simTime - The hostname of the node for which the firewall is checking for.
direction - Simulation time at which the firewall is being consulted.
eventsLog - The Verinec Simulator Event logger instance.
Returns:
The corresponding Action.
See Also:
IPacketFilter.matchAction(verinec.netsim.entities.packets.Packet, java.lang.String, java.lang.String, java.lang.String, java.lang.String, verinec.netsim.loggers.ILogger)

getId

public String getId()
Returns:
Returns the id.

setId

public void setId(String id)
Parameters:
id - The id to set.

getPacketMatchList

public PacketMatchList getPacketMatchList()
Returns:
Returns the packetMatchList.

setPacketMatchList

public void setPacketMatchList(PacketMatchList packetMatchList)
Parameters:
packetMatchList - The packetMatchList to set.

getPacketAction

public IPacketAction getPacketAction()
Returns:
Returns the packetAction.

setPacketAction

public void setPacketAction(IPacketAction packetAction)
Parameters:
packetAction - The packetAction to set.

toString

public String toString()
Description copied from interface: IPacketFilter
This returns a String representation of the Packet Filter

Specified by:
toString in interface IPacketFilter
Overrides:
toString in class Object
Returns:
the a String representation of the Packet Filter
See Also:
IPacketFilter.toString()

Copyright © 2005 Verinec, DIUF