/* Compute the value to fill in the window size field of the outgoing segment. */
UINT16 TcpComputeWnd(IN OUT TCP_CB *Tcb, IN BOOLEAN Syn)
/* Compute the value to fill in the window size field of the outgoing segment. */
UINT16 TcpComputeWnd(IN OUT TCP_CB *Tcb, IN BOOLEAN Syn)
{
  UINT32  Wnd;
  if (Syn) {
    Wnd = GET_RCV_BUFFSIZE (Tcb->Sk);
  } else {
    Wnd = TcpRcvWinNow (Tcb);
    Tcb->RcvWnd = Wnd;
  }
  Wnd = MIN (Wnd >> Tcb->RcvWndScale, 0xffff);
  return NTOHS ((UINT16)Wnd);
}