simnet
Class NATRouter.Connection

java.lang.Object
  extended bysimnet.NATRouter.Connection
Enclosing class:
NATRouter

class NATRouter.Connection
extends java.lang.Object

Class to store all relevant information about a given connection.


Field Summary
(package private)  int externalPort
          The port we will use to uniquely identify this connection to the outside world.
(package private)  int internalIP
          The NATted IP address of the sending node.
(package private)  int internalPort
          The port on which this connection was originally established.
(package private)  int lastSeqNum
          If this is a TCP connection, then use this field to match up ACKs to FINs
(package private)  int proto
          The protocol this connection uses.
(package private)  NATRouter.StaleConnectionRemover scr
          A TimerTask that will remove this connection when it is no longer in use.
(package private)  long timeOfLastUse
          The last time a packet was sent over this connection
 
Constructor Summary
NATRouter.Connection(int internalIP, int internalPort, int externalPort, int proto)
          Create this connection.
 
Method Summary
 java.lang.String toString()
          Print out our basic stats.
 void updateUsage()
          Set the timeOfLastUse to the current time so TimerTasks will know that this connection is still active.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

internalIP

int internalIP
The NATted IP address of the sending node.


internalPort

int internalPort
The port on which this connection was originally established.


externalPort

int externalPort
The port we will use to uniquely identify this connection to the outside world.


proto

int proto
The protocol this connection uses.


timeOfLastUse

long timeOfLastUse
The last time a packet was sent over this connection


scr

NATRouter.StaleConnectionRemover scr
A TimerTask that will remove this connection when it is no longer in use.


lastSeqNum

int lastSeqNum
If this is a TCP connection, then use this field to match up ACKs to FINs

Constructor Detail

NATRouter.Connection

public NATRouter.Connection(int internalIP,
                            int internalPort,
                            int externalPort,
                            int proto)
Create this connection. If this is not a TCP connection, create a new TimerTask to make sure that it is removed when it is stale.

Parameters:
internalIP - the original source address (NATted)
internalPort - the orignal port
externalPort - the port we will use on the outside to uniquely ID this connection
proto - The protocol of this connection
Method Detail

updateUsage

public void updateUsage()
Set the timeOfLastUse to the current time so TimerTasks will know that this connection is still active.


toString

public java.lang.String toString()
Print out our basic stats.