net.clackrouter.component.tcp
Class TCB

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

public class TCB
extends ClackComponent

A Transmission Control Block (TCB) represents the state of a single TCP connection.

One TCB exists per (src address, source port, destination address, destination port) tuple. The relationship between TCBs and sockets is one-to-one, though it is a bit confusing in the case of server sockets, since a TCB exists despite the fact that no data is actually ever sent over a server socket.


Nested Class Summary
 
Nested classes/interfaces inherited from class net.clackrouter.component.base.ClackComponent
ClackComponent.Waiter
 
Field Summary
static long CLOSE_WAIT_MILLIS
           
 int connection_state
           
 boolean done
           
 long fin_seq_sent
           
 boolean finReceived
           
 long initial_sequence_num
           
 java.net.InetAddress local_address
           
 int local_port
           
static int MAX_PAYLOAD
           
static int MAX_WINDOW
           
 long mCloseWaitStart
           
 ClackComponentEvent mDataChangeEvent
           
 OrderPackets mOrderPackets
           
 TCP mParent
           
 ProcessAck mProcessAck
           
 ProcessSegment mProcessSegment
           
 SockBuffer mRecvBuffer
           
 ReceiveWindowCheck mRecvWinCheck
           
 Retransmitter mRetransmitter
           
 SockBuffer mSendBuffer
           
 SendWindowCheck mSendWinCheck
           
 SetChecksum mSetChecksum
           
 TCPSocket mSocket
           
 ValidateChecksum mValidateChecksum
           
static int NUM_PORTS
           
static int PORT_FROM_NET
           
static int PORT_INTERNAL_FROM_NET
           
static int PORT_INTERNAL_TO_NET
           
static int PORT_TO_NET
           
 long recv_nxt
           
 java.net.InetAddress remote_address
           
 int remote_port
           
 long rto_msec
           
static int RTO_MSECS
           
 long send_nxt
           
 long send_una
           
 int send_window
           
static int STATE_CLOSE_WAIT
           
static int STATE_CLOSED
           
static int STATE_CLOSING
           
static int STATE_ESTABLISHED
           
static int STATE_FIN_WAIT1
           
static int STATE_FIN_WAIT2
           
static int STATE_LAST_ACK
           
static int STATE_LISTEN
           
static int STATE_SYN_RECEIVED
           
static int STATE_SYN_SENT
           
static int STATE_TIME_WAIT
           
static int STATE_UNKNOWN
           
static int TOTAL_RETRANS_ATTEMPTS
           
 
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
TCB(TCP parent, 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.
 void connect_no_gui()
          Method to connect all TCP subcomponents for this TCB.
static java.lang.String getStateString(int state)
          Conveniance method to get a string value representing a TCP state integer value.
 void initiateConnection(java.net.InetAddress r_addr, int r_port)
          Used to start a client connection to a remote host/port pair.
 void notifySynReceived(VNSTCPPacket packet)
          Initializes the state of a TCB for a server port based on the contents of a newly received SYN packet.
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, getColor, 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

STATE_CLOSED

public static final int STATE_CLOSED
See Also:
Constant Field Values

STATE_LISTEN

public static final int STATE_LISTEN
See Also:
Constant Field Values

STATE_SYN_SENT

public static final int STATE_SYN_SENT
See Also:
Constant Field Values

STATE_SYN_RECEIVED

public static final int STATE_SYN_RECEIVED
See Also:
Constant Field Values

STATE_ESTABLISHED

public static final int STATE_ESTABLISHED
See Also:
Constant Field Values

STATE_FIN_WAIT1

public static final int STATE_FIN_WAIT1
See Also:
Constant Field Values

STATE_FIN_WAIT2

public static final int STATE_FIN_WAIT2
See Also:
Constant Field Values

STATE_CLOSE_WAIT

public static final int STATE_CLOSE_WAIT
See Also:
Constant Field Values

STATE_CLOSING

public static final int STATE_CLOSING
See Also:
Constant Field Values

STATE_LAST_ACK

public static final int STATE_LAST_ACK
See Also:
Constant Field Values

STATE_TIME_WAIT

public static final int STATE_TIME_WAIT
See Also:
Constant Field Values

STATE_UNKNOWN

public static final int STATE_UNKNOWN
See Also:
Constant Field Values

RTO_MSECS

public static final int RTO_MSECS
See Also:
Constant Field Values

MAX_WINDOW

public static final int MAX_WINDOW
See Also:
Constant Field Values

MAX_PAYLOAD

public static final int MAX_PAYLOAD
See Also:
Constant Field Values

TOTAL_RETRANS_ATTEMPTS

public static final int TOTAL_RETRANS_ATTEMPTS
See Also:
Constant Field Values

connection_state

public int connection_state

send_nxt

public long send_nxt

recv_nxt

public long recv_nxt

send_una

public long send_una

send_window

public int send_window

fin_seq_sent

public long fin_seq_sent

initial_sequence_num

public long initial_sequence_num

finReceived

public boolean finReceived

rto_msec

public long rto_msec

done

public boolean done

mCloseWaitStart

public long mCloseWaitStart

CLOSE_WAIT_MILLIS

public static final long CLOSE_WAIT_MILLIS
See Also:
Constant Field Values

local_port

public int local_port

remote_port

public int remote_port

local_address

public java.net.InetAddress local_address

remote_address

public java.net.InetAddress remote_address

mParent

public TCP mParent

PORT_FROM_NET

public static int PORT_FROM_NET

PORT_TO_NET

public static int PORT_TO_NET

PORT_INTERNAL_FROM_NET

public static int PORT_INTERNAL_FROM_NET

PORT_INTERNAL_TO_NET

public static int PORT_INTERNAL_TO_NET

NUM_PORTS

public static int NUM_PORTS

mSocket

public TCPSocket mSocket

mOrderPackets

public OrderPackets mOrderPackets

mProcessAck

public ProcessAck mProcessAck

mProcessSegment

public ProcessSegment mProcessSegment

mRecvWinCheck

public ReceiveWindowCheck mRecvWinCheck

mRetransmitter

public Retransmitter mRetransmitter

mSendWinCheck

public SendWindowCheck mSendWinCheck

mSetChecksum

public SetChecksum mSetChecksum

mValidateChecksum

public ValidateChecksum mValidateChecksum

mSendBuffer

public SockBuffer mSendBuffer

mRecvBuffer

public SockBuffer mRecvBuffer

mDataChangeEvent

public ClackComponentEvent mDataChangeEvent
Constructor Detail

TCB

public TCB(TCP parent,
           Router router,
           java.lang.String name)
Method Detail

connect_no_gui

public void connect_no_gui()
Method to connect all TCP subcomponents for this TCB.

These components are usually connected in HierarchicalComponent, but that is only if we are using the GUI. For testing, we may want to connect them using this method.


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

initiateConnection

public void initiateConnection(java.net.InetAddress r_addr,
                               int r_port)
Used to start a client connection to a remote host/port pair.

Parameters:
r_addr -
r_port -

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

getStateString

public static java.lang.String getStateString(int state)
Conveniance method to get a string value representing a TCP state integer value.

Parameters:
state -

notifySynReceived

public void notifySynReceived(VNSTCPPacket packet)
Initializes the state of a TCB for a server port based on the contents of a newly received SYN packet.

This TCB is the result of an accept() call on a server socket, creating a new child socket.

Parameters:
packet -