net.clackrouter.component.simplerouter
Class IPRouteLookup

java.lang.Object
  extended by net.clackrouter.component.base.ClackComponent
      extended by net.clackrouter.component.simplerouter.IPRouteLookup
All Implemented Interfaces:
Alarm

public class IPRouteLookup
extends ClackComponent

Performs route lookup for an IP packet, identifying local packets, setting the output interface for forwarding, or dropping the packet.


Nested Class Summary
 
Nested classes/interfaces inherited from class net.clackrouter.component.base.ClackComponent
ClackComponent.Waiter
 
Field Summary
protected  java.util.Hashtable mPortsToInterface
           
protected  RoutingTable mRtable
           
static int NUM_PORTS
           
static int PORT_IP_IN
           
static int PORT_LOCAL
           
static int PORT_NOROUTE
           
static int PORT_OUT
           
 
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
IPRouteLookup(Router router, java.lang.String name)
           
 
Method Summary
 void acceptPacket(VNSPacket packet, int port_number)
          Accept IP packet and either forward, drop, or pass on for local processing.
protected  void debug_addr_print(IPPacket ippacket)
           
 java.awt.Color getColor()
          The color this component should be rendered in, assuming a standard component rendering by the ComponentView.ComponentRenderer class.
 javax.swing.JPanel getPropertiesView()
          Method for getting the properties view associated with this component Property views are used to display more detailed information about internal component state.
 RoutingTable getRoutingTable()
           
 java.util.Properties getSerializableProperties(boolean isTransient)
          Serialize the routing table state for reloading the router
protected  java.net.InetAddress getSourceFromRtable(java.net.InetAddress dest)
          Finds the correct source address for a given destination.
 void initializeProperties(java.util.Properties props)
          Load and static entries that have been hard-coded into the topo file
protected  boolean ipForward(IPPacket packet)
          Internal function used to forward a packet, either sending it to the local output port, dropping it, or forwarding it via an output port.
protected  boolean isForUs(IPPacket egg)
           
 void setRoutingTable(RoutingTable table)
           
protected  void setupPorts(int numports)
          Allocates an array of ClackPort objects to be used by this component
 
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, getRouter, getTime, getTypeName, getUniqueCount, getView, handlePullRequest, hasError, 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_IP_IN

public static int PORT_IP_IN

PORT_NOROUTE

public static int PORT_NOROUTE

PORT_LOCAL

public static int PORT_LOCAL

PORT_OUT

public static int PORT_OUT

NUM_PORTS

public static int NUM_PORTS

mRtable

protected RoutingTable mRtable

mPortsToInterface

protected java.util.Hashtable mPortsToInterface
Constructor Detail

IPRouteLookup

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

setupPorts

protected void setupPorts(int numports)
Description copied from class: ClackComponent
Allocates an array of ClackPort objects to be used by this component

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

acceptPacket

public void acceptPacket(VNSPacket packet,
                         int port_number)
Accept IP packet and either forward, drop, or pass on for local processing.

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

isForUs

protected boolean isForUs(IPPacket egg)

getSourceFromRtable

protected java.net.InetAddress getSourceFromRtable(java.net.InetAddress dest)
Finds the correct source address for a given destination.

Used in the case of "local packets" such as ICMP messages that need their source address set according to the interface they are being forwarded out of.

Parameters:
dest - destination IP address of the packet
Returns:

getRoutingTable

public RoutingTable getRoutingTable()

setRoutingTable

public void setRoutingTable(RoutingTable table)

ipForward

protected boolean ipForward(IPPacket packet)
Internal function used to forward a packet, either sending it to the local output port, dropping it, or forwarding it via an output port.

Parameters:
packet -
Returns:

getPropertiesView

public javax.swing.JPanel getPropertiesView()
Description copied from class: ClackComponent
Method for getting the properties view associated with this component Property views are used to display more detailed information about internal component state. This method creates a default property view, and can be overriden to provide custom properties views

Overrides:
getPropertiesView in class ClackComponent
Returns:
this component's property view

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

debug_addr_print

protected void debug_addr_print(IPPacket ippacket)

initializeProperties

public void initializeProperties(java.util.Properties props)
Load and static entries that have been hard-coded into the topo file

Overrides:
initializeProperties in class ClackComponent
Parameters:
props - all property values serialized for this component

getSerializableProperties

public java.util.Properties getSerializableProperties(boolean isTransient)
Serialize the routing table state for reloading the router

Overrides:
getSerializableProperties in class ClackComponent
Parameters:
isTransient - flag indicating if serialization is transient
Returns:
all property key-value pairs to serialize