SSF.OS.TCP
Class Send_WndManager

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

public class Send_WndManager
extends java.lang.Object

Send window manager manages sending data messages and receives ACKs. It maintains a send queue and the send window parameters, calculates RTTs, implements fast retransmission, fast recovery and slow start algorithms.


Field Summary
 int AdvertisedWnd
          Advertised Window Size of Receiver contained in ACK message.
 boolean FINsent
          indicate if a FIN message has been put into the send queue
 long FirstUnACKed
          The first unacknowledged sequence number.
 long InitSEQno
          Initial send sequence number.
 long LastSent
          The highest sequence number that has been sent.
 long LastWritten
          The sequence number of the last packet written by application (reserved).
 int maxSendWnd
           
 int MSS
          the maximum segment size of one TCP packet
 SSF.OS.TCP.SendQueue SendBuffer
          Send Queue for this TCP session.
 long SendNext
          The sequence number to be send next.
 
Constructor Summary
Send_WndManager(tcpSession sessHlp, tcpSessionMaster init)
          Initialize the send window parameters
 
Method Summary
 int calc_EffectiveWnd()
          Calculates the effective size of send window.
 void calc_RTT()
          Collect new round-trip time estimate and update averages and current timeout.
 void calc_ssthresh()
          Set slow start thresh to the half of the flight size when loss begins, min(conWnd, AdvertisedWnd)/2, but no less than 2*MSS.
 void Dup_Ack_Process()
          process called when receiving the 3rd duplicated ACKs, implement fast retransmission and fast recovery
 void Rcv_Ack_Process(TCP_Message msg)
          Process ACKs, if not duplicate ACKs cancel the retransmission timer otherwise retransmits the lost packet.
 void Rexmit()
          Retransmition process when rexit timer expires.
 void Send_Data_Process()
          calculate the send window size and send that number of bytes of data if send queue has enough data to be sent or send out whatever in the send queue, set retransmission timer for each packet.
 int TCP_REXMTVAL()
          calculate RTO by scaled value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

InitSEQno

public long InitSEQno
Initial send sequence number.


LastSent

public long LastSent
The highest sequence number that has been sent.


SendNext

public long SendNext
The sequence number to be send next.


LastWritten

public long LastWritten
The sequence number of the last packet written by application (reserved).


FirstUnACKed

public long FirstUnACKed
The first unacknowledged sequence number.


AdvertisedWnd

public int AdvertisedWnd
Advertised Window Size of Receiver contained in ACK message.


SendBuffer

public SSF.OS.TCP.SendQueue SendBuffer
Send Queue for this TCP session.


maxSendWnd

public int maxSendWnd

MSS

public int MSS
the maximum segment size of one TCP packet


FINsent

public boolean FINsent
indicate if a FIN message has been put into the send queue

Constructor Detail

Send_WndManager

public Send_WndManager(tcpSession sessHlp,
                       tcpSessionMaster init)
Initialize the send window parameters

Method Detail

TCP_REXMTVAL

public int TCP_REXMTVAL()
calculate RTO by scaled value


Rcv_Ack_Process

public void Rcv_Ack_Process(TCP_Message msg)
Process ACKs, if not duplicate ACKs cancel the retransmission timer otherwise retransmits the lost packet. Calculate congestion control window size, set the threshold parameter of the Fast recovery and Slow start algorithm.


Dup_Ack_Process

public void Dup_Ack_Process()
process called when receiving the 3rd duplicated ACKs, implement fast retransmission and fast recovery


Send_Data_Process

public void Send_Data_Process()
calculate the send window size and send that number of bytes of data if send queue has enough data to be sent or send out whatever in the send queue, set retransmission timer for each packet.


Rexmit

public void Rexmit()
Retransmition process when rexit timer expires. Tests if the number of consecutive retransmissions reached the maximum of TCP_MAXRXTSHIFT = 12; if yes drop the connection.

With Karn's algorithm, two retransmissions are considered consecutive (see rexShift) if there was no RTT calculation between these two retransmissions. In other words if a segment was retransmitted, and either the same segment is retransmitted again, or the next segment is again retransmitted, these are two consecutive retransmissions.

Thus a case of the 12 consecutive retransmissions may occur when the same segment is retrasmitted 12 times; but also when 12 consecutive segments are sent and each of them is retransmitted once, etc.

Otherwise, enter slow start.


calc_ssthresh

public void calc_ssthresh()
Set slow start thresh to the half of the flight size when loss begins, min(conWnd, AdvertisedWnd)/2, but no less than 2*MSS.


calc_RTT

public void calc_RTT()
Collect new round-trip time estimate and update averages and current timeout. (Ported from BSD TCP function tcp_xmit_timer()) Jacobson algorithm for the calculation of the RTT value and Retransmition timeout value. M is measured RTT, A is smothed RTT, D is the smothed mean deviation.

Err = M - A

A <- A + g * Err -- g = 0.125

D <- D + h * (|Err| - D) -- h = 0.25

RTO = A + 4 * D


calc_EffectiveWnd

public int calc_EffectiveWnd()
Calculates the effective size of send window.