net.clackrouter.component.extension
Class NAPT

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

public class NAPT
extends ClackComponent

VERY basic implementation of NAT. Only handles TCP/UDP for now, no ICMP. Defaults to using the first interface (usually eth0) of the current router as the external IP, and 10.1.1.0/24 as the private network (assumes that it has interfaces in the private networks, so it hears about them from routing).


Nested Class Summary
 class NAPT.ICMPMapping
           
 class NAPT.TransportLevelMapping
           
 
Nested classes/interfaces inherited from class net.clackrouter.component.base.ClackComponent
ClackComponent.Waiter
 
Field Summary
static int DEST_PORT
           
static int ICMP_MAX_TTL
           
static int NUM_PORTS
           
static int PORT_IN
           
static int PORT_OUT
           
static int SRC_PORT
           
static int TRANSPORT_MAX_TTL
           
 
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
NAPT(Router router, java.lang.String name)
           
 
Method Summary
 void acceptPacket(VNSPacket packet, int port_num)
          The starting point for packet-processing when packets are "pushed" to this component.
 java.awt.Color getColor()
          The color this component should be rendered in, assuming a standard component rendering by the ComponentView.ComponentRenderer class.
 java.util.Hashtable getICMPMappings()
           
 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.
 NAPT.TransportLevelMapping[] getTransportLevelMappings()
           
 void notifyAlarm()
          call-back method implemented by the code setting the alarm.
 void setExternalIPAddress(java.net.InetAddress new_addr)
           
 void setInternalNetwork(java.net.InetAddress net, java.net.InetAddress mask)
           
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, getSerializableProperties, getTime, getTypeName, getUniqueCount, getView, handlePullRequest, hasError, initializeProperties, isHierarchical, isModifying, log, 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_IN

public static final int PORT_IN
See Also:
Constant Field Values

PORT_OUT

public static final int PORT_OUT
See Also:
Constant Field Values

NUM_PORTS

public static final int NUM_PORTS
See Also:
Constant Field Values

DEST_PORT

public static final int DEST_PORT
See Also:
Constant Field Values

SRC_PORT

public static final int SRC_PORT
See Also:
Constant Field Values

TRANSPORT_MAX_TTL

public static int TRANSPORT_MAX_TTL

ICMP_MAX_TTL

public static int ICMP_MAX_TTL
Constructor Detail

NAPT

public NAPT(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_num)
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_num - The number of the port that this packet is arriving on

notifyAlarm

public void notifyAlarm()
Description copied from interface: Alarm
call-back method implemented by the code setting the alarm. notifies that the alarm has fired.

Specified by:
notifyAlarm in interface Alarm
Overrides:
notifyAlarm in class ClackComponent

setExternalIPAddress

public void setExternalIPAddress(java.net.InetAddress new_addr)

setInternalNetwork

public void setInternalNetwork(java.net.InetAddress net,
                               java.net.InetAddress mask)

getTransportLevelMappings

public NAPT.TransportLevelMapping[] getTransportLevelMappings()

getICMPMappings

public java.util.Hashtable getICMPMappings()

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