net.clackrouter.component.simplerouter
Class IPHeaderCheck

java.lang.Object
  extended by net.clackrouter.component.base.ClackComponent
      extended by net.clackrouter.component.simplerouter.IPHeaderCheck
All Implemented Interfaces:
java.io.Serializable, Alarm

public class IPHeaderCheck
extends ClackComponent
implements java.io.Serializable

Performs some basic sanity checks on the IP header as part of the forwarding path.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class net.clackrouter.component.base.ClackComponent
ClackComponent.Waiter
 
Field Summary
static int NUM_PORTS
           
static int PORT_BADEGG
           
static int PORT_GOODEGG
           
static int PORT_INPUT
           
 
Fields inherited from class net.clackrouter.component.base.ClackComponent
componentCell, m_has_error, m_log, m_name, m_num_ports, m_packetcount_in, m_packetcount_out, m_ports, mListeners, mRouter, pendingError, SIGNAL_ERROR_LEN_MSEC, UNIQUE_COUNT, view
 
Constructor Summary
IPHeaderCheck(Router router, java.lang.String name)
           
 
Method Summary
 void acceptPacket(VNSPacket packet, int port_number)
          The starting point for packet-processing when packets are "pushed" to this component.
 int getBadChk()
           
 int getBadCnt()
           
 int getBadIHL()
           
 int getBadLen()
           
 int getBadVer()
           
 java.awt.Color getColor()
          The color this component should be rendered in, assuming a standard component rendering by the ComponentView.ComponentRenderer class.
protected  void setupPorts(int numports)
          Validates the IP checksum, version, and header length of the IP packet, send good packets out one port for forwarding and sending those that fail the tests to a different port.
 
Methods inherited from class net.clackrouter.component.base.ClackComponent
createCopy, createInputPullPort, createInputPushPort, createOutputPullPort, createOutputPushPort, error, fireListeners, getComponentCell, getHierarchicalView, getLog, getName, getNumPorts, getPacketCountIn, getPacketCountOut, getPendingError, getPort, getPropertiesView, getRouter, getSerializableProperties, getTime, getTypeName, getUniqueCount, getView, handlePullRequest, hasError, initializeProperties, isHierarchical, isModifying, log, notifyAlarm, poll, registerListener, sendOutPort, setAlarm, setComponentCell, setName, setPendingError, setView, showErrorDialog, signalError, try_repaint, unregisterListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PORT_INPUT

public static int PORT_INPUT

PORT_GOODEGG

public static int PORT_GOODEGG

PORT_BADEGG

public static int PORT_BADEGG

NUM_PORTS

public static int NUM_PORTS
Constructor Detail

IPHeaderCheck

public IPHeaderCheck(Router router,
                     java.lang.String name)
Method Detail

setupPorts

protected void setupPorts(int numports)
Validates the IP checksum, version, and header length of the IP packet, send good packets out one port for forwarding and sending those that fail the tests to a different port.

Overrides:
setupPorts in class ClackComponent
Parameters:
numports - the number of ports to create

acceptPacket

public void acceptPacket(VNSPacket packet,
                         int port_number)
Description copied from class: ClackComponent

The starting point for packet-processing when packets are "pushed" to this component.

The default implementation warns that the packet is being ignored.

Overrides:
acceptPacket in class ClackComponent
Parameters:
packet - The pushed packet
port_number - The number of the port that this packet is arriving on

getBadVer

public int getBadVer()

getBadIHL

public int getBadIHL()

getBadLen

public int getBadLen()

getBadChk

public int getBadChk()

getBadCnt

public int getBadCnt()

getColor

public java.awt.Color getColor()
Description copied from class: ClackComponent

The color this component should be rendered in, assuming a standard component rendering by the ComponentView.ComponentRenderer class.

Other renderers may ignore this value.

Overrides:
getColor in class ClackComponent
Returns:
the rendering color