/* Check whether the application's newly delivered data can be sent out. */
INTN TcpOnAppSend(IN OUT TCP_CB *Tcb)
/* Check whether the application's newly delivered data can be sent out. */
INTN TcpOnAppSend(IN OUT TCP_CB *Tcb)
{
  switch (Tcb->State) {
    case TCP_CLOSED:
      return -1;
    case TCP_LISTEN:
      return -1;
    case TCP_SYN_SENT:
    case TCP_SYN_RCVD:
      return 0;
    case TCP_ESTABLISHED:
    case TCP_CLOSE_WAIT:
      TcpToSendData (Tcb, 0);
      return 0;
    case TCP_FIN_WAIT_1:
    case TCP_FIN_WAIT_2:
    case TCP_CLOSING:
    case TCP_LAST_ACK:
    case TCP_TIME_WAIT:
      return -1;
    default:
      break;
  }
  return 0;
}