net.clackrouter.component.simplerouter
Class ARPLookup

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

public class ARPLookup
extends ClackComponent

Contains ARP cache, sends ARP requests, handles ARP replies, and supplies Ethernet Destination addresses based on next hop addresses for packets.


Nested Class Summary
 class ARPLookup.CacheEntry
          Data structure representing a single ARP Cache entry
 
Nested classes/interfaces inherited from class net.clackrouter.component.base.ClackComponent
ClackComponent.Waiter
 
Field Summary
static int DEFAULT_CACHE_TIMEOUT
           
static int DEST_UNREACH_TIMER
           
static int MAX_QUEUE_PACKETS
           
static int NUM_PORTS
           
static int PORT_IP_IN
           
static int PORT_OUT
           
static int PORT_REPLY_IN
           
 
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
ARPLookup(Router router, java.lang.String name)
           
 
Method Summary
 void acceptPacket(VNSPacket packet, int port_number)
          Handles both incoming ARP Replies and Outgoing IP packets needing an destination Ethernet address
 void addARPCacheEntry(java.lang.String interface_name, java.net.InetAddress ip, EthernetAddress hw)
          Adds an entry to the ARP cache
 java.util.Hashtable getARPCache()
           
 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.
 boolean removeARPCacheEntry(java.lang.String interface_name, java.net.InetAddress ip)
          Removes an entry in the specified ARP cache
protected  void setupPorts(int num_ports)
          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, 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_REPLY_IN

public static int PORT_REPLY_IN

PORT_IP_IN

public static int PORT_IP_IN

PORT_OUT

public static int PORT_OUT

NUM_PORTS

public static int NUM_PORTS

DEFAULT_CACHE_TIMEOUT

public static int DEFAULT_CACHE_TIMEOUT

DEST_UNREACH_TIMER

public static int DEST_UNREACH_TIMER

MAX_QUEUE_PACKETS

public static int MAX_QUEUE_PACKETS
Constructor Detail

ARPLookup

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

setupPorts

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

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

acceptPacket

public void acceptPacket(VNSPacket packet,
                         int port_number)
Handles both incoming ARP Replies and Outgoing IP packets needing an destination Ethernet address

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

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

getARPCache

public java.util.Hashtable getARPCache()

removeARPCacheEntry

public boolean removeARPCacheEntry(java.lang.String interface_name,
                                   java.net.InetAddress ip)
Removes an entry in the specified ARP cache

Parameters:
interface_name - interface of the entry to remove
ip - IP address of entry to remove
Returns:
true if an actual entry was removed, false otherwise.

addARPCacheEntry

public void addARPCacheEntry(java.lang.String interface_name,
                             java.net.InetAddress ip,
                             EthernetAddress hw)
Adds an entry to the ARP cache


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