SSF.OS.TCP
Class Rcv_WndManager

java.lang.Object
  |
  +--SSF.OS.TCP.Rcv_WndManager

public class Rcv_WndManager
extends java.lang.Object

Receive window manager keeps a record of the receive window parameters and change their value accordingly when it receives a new message and sends an ACK. It maintains the receive buffer and keeps all the messages in order before they are read by upper layer Application.


Field Summary
 int AdvertisedWnd
          Size of the advertised window
protected  int GapPosition
          Index of the first out-of-sequence packet in the Receive Buffer
protected  long LastRcvd
          Sequence number of the last received packet
protected  long LastRead
          Sequence number of the last packet read by application
 int MAX_RCV_WND
          Default maximum receive window size
 long maxAdvertised
           
 int MSS
           
protected  long NextExpected
          Sequence number of the next expected packet to receive ( = ACK number).
protected  tcpSession owner
          Reference to the owner of this receive window manager
protected  TCP_Message[] Rcv_Buffer
          Receive buffer for the received messages, including out of order messages.
static int SIZE
          Maximum number of packets in receive buffer
protected  TCP_Header tcpHdr
          template of the reply message
 
Method Summary
 void Calc_AdvertisedWindow()
          Calculate the size of the advertised window which indicate the maximum number of bytes that can be received in the buffer.
 void push_Process()
          push all received and ordered virtual data to upper layer protocol session
 void Rcv_DataProcess(ProtocolMessage message)
          Process receives a data message, sorts messages in sequence number order, sends acknowledgment message with next expected sequence number and advertised window size, checks if the message contains flags indicating the end of data transmission.
 void Rcv_WndInit(TCP_Message data)
          Initialize the receive window according to message received.
 void ReassembleMessage()
          Sort the messages by sequence number, discard the message if it's duplicated, increase the next expected sequence number if needed.
 void Send_Ack_Process()
          Send ACK for the received in-sequence packet with the highest sequence number.
 void setACK(TCP_Message tcpMsg)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

owner

protected tcpSession owner
Reference to the owner of this receive window manager


NextExpected

protected long NextExpected
Sequence number of the next expected packet to receive ( = ACK number).


LastRead

protected long LastRead
Sequence number of the last packet read by application


LastRcvd

protected long LastRcvd
Sequence number of the last received packet


GapPosition

protected int GapPosition
Index of the first out-of-sequence packet in the Receive Buffer


AdvertisedWnd

public int AdvertisedWnd
Size of the advertised window


maxAdvertised

public long maxAdvertised

MAX_RCV_WND

public int MAX_RCV_WND
Default maximum receive window size


SIZE

public static final int SIZE
Maximum number of packets in receive buffer

See Also:
Constant Field Values

MSS

public int MSS

tcpHdr

protected TCP_Header tcpHdr
template of the reply message


Rcv_Buffer

protected TCP_Message[] Rcv_Buffer
Receive buffer for the received messages, including out of order messages.

Method Detail

Calc_AdvertisedWindow

public void Calc_AdvertisedWindow()
Calculate the size of the advertised window which indicate the maximum number of bytes that can be received in the buffer.


ReassembleMessage

public void ReassembleMessage()
Sort the messages by sequence number, discard the message if it's duplicated, increase the next expected sequence number if needed. Push in-order (virtual) data segments to the reading socket buffer.


Rcv_WndInit

public void Rcv_WndInit(TCP_Message data)
Initialize the receive window according to message received. Set the value of receive window variable and TCP header of the replying message, send acknowledgment message in reply to the connection request. Called by tcpSession.push() upon receiving SYN or SYN-ACK.


Rcv_DataProcess

public void Rcv_DataProcess(ProtocolMessage message)
                     throws TCPException
Process receives a data message, sorts messages in sequence number order, sends acknowledgment message with next expected sequence number and advertised window size, checks if the message contains flags indicating the end of data transmission. Note: dose not check if have a silly window syndrome.

Parameters:
message - received TCP message
TCPException

Send_Ack_Process

public void Send_Ack_Process()
Send ACK for the received in-sequence packet with the highest sequence number.


setACK

public void setACK(TCP_Message tcpMsg)

push_Process

public void push_Process()
push all received and ordered virtual data to upper layer protocol session