/* Get a segment starting from sequence Seq of a maximum length of Len. */
NET_BUF* TcpGetSegment(IN TCP_CB *Tcb, IN TCP_SEQNO Seq, IN UINT32 Len)
/* Get a segment starting from sequence Seq of a maximum length of Len. */
NET_BUF* TcpGetSegment(IN TCP_CB *Tcb, IN TCP_SEQNO Seq, IN UINT32 Len)
{
  NET_BUF  *Nbuf;
  ASSERT (Tcb != NULL);
  if ((Len != 0) && TCP_SEQ_LT (Seq, TcpGetMaxSndNxt (Tcb))) {
    Nbuf = TcpGetSegmentSndQue (Tcb, Seq, Len);
  } else {
    Nbuf = TcpGetSegmentSock (Tcb, Seq, Len);
  }
  if (TcpVerifySegment (Nbuf) == 0) {
    NetbufFree (Nbuf);
    return NULL;
  }
  return Nbuf;
}