The usable send window at any time is given by the function window(). It returns the minimum of the congestion window and the variable wnd_, which represents the receiver's advertised window.
opencwnd() - this function opens the congestion window. It is invoked when a new ACK arrives. When in slow-start, the function merely increments cwnd_ by each ACK received. When in congestion avoidance, the standard configuration increments cwnd_ by its reciprocal. Other window growth options are supported during congestion avoidance, but they are experimental (and not documented; contact Sally Floyd for details).
closecwnd(int how) - this function reduces the congestion window. It may be invoked in several ways: when entering fast retransmit, due to a timer expiration, or due to a congestion notification (ECN bit set). Its argument how indicates how the congestion window should be reduced. The value 0 is used for retransmission timeouts and fast retransmit in Tahoe TCP. It typically causes the TCP to enter slow-start and reduce ssthresh_ to half the current window. The value 1 is used by Reno TCP for implementing fast recovery (which avoids returning to slow-start). The value 2 is used for reducing the window due to an ECN indication. It resets the congestion window to its initial value (usually causing slow-start), but does not alter ssthresh_.