NetworkPkg/TcpDxe/TcpOutput.c File Reference


Functions

UINT32 TcpRcvWinOld (IN TCP_CB *Tcb)
UINT32 TcpRcvWinNow (IN TCP_CB *Tcb)
UINT16 TcpComputeWnd (IN OUT TCP_CB *Tcb, IN BOOLEAN Syn)
TCP_SEQNO TcpGetMaxSndNxt (IN TCP_CB *Tcb)
UINT32 TcpDataToSend (IN TCP_CB *Tcb, IN INTN Force)
INTN TcpTransmitSegment (IN OUT TCP_CB *Tcb, IN NET_BUF *Nbuf)
NET_BUF * TcpGetSegmentSndQue (IN TCP_CB *Tcb, IN TCP_SEQNO Seq, IN UINT32 Len)
NET_BUF * TcpGetSegmentSock (IN TCP_CB *Tcb, IN TCP_SEQNO Seq, IN UINT32 Len)
NET_BUF * TcpGetSegment (IN TCP_CB *Tcb, IN TCP_SEQNO Seq, IN UINT32 Len)
INTN TcpRetransmit (IN TCP_CB *Tcb, IN TCP_SEQNO Seq)
INTN TcpCheckSndQue (IN LIST_ENTRY *Head)
INTN TcpToSendData (IN OUT TCP_CB *Tcb, IN INTN Force)
VOID TcpSendAck (IN OUT TCP_CB *Tcb)
INTN TcpSendZeroProbe (IN OUT TCP_CB *Tcb)
VOID TcpToSendAck (IN OUT TCP_CB *Tcb)
INTN TcpSendReset (IN TCP_CB *Tcb, IN TCP_HEAD *Head, IN INT32 Len, IN EFI_IP_ADDRESS *Local, IN EFI_IP_ADDRESS *Remote, IN UINT8 Version)
INTN TcpVerifySegment (IN NET_BUF *Nbuf)

Variables

UINT8 mTcpOutFlag []

Detailed Description

TCP output process routines.

Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.

This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php.

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.


Function Documentation

INTN TcpCheckSndQue ( IN LIST_ENTRY *  Head  ) 

Verify that all the segments in SndQue are in good shape.

Parameters:
[in] Head Pointer to the head node of the SndQue.
Return values:
0 At least one segment is broken.
1 All segments in the specific queue are in good shape.

References TCPSEG_NETBUF, and TcpVerifySegment().

Referenced by TcpToSendData().

UINT16 TcpComputeWnd ( IN OUT TCP_CB Tcb,
IN BOOLEAN  Syn 
)

Compute the value to fill in the window size field of the outgoing segment.

Parameters:
[in,out] Tcb Pointer to the TCP_CB of this TCP instance.
[in] Syn The flag to indicate whether the outgoing segment is a SYN segment.
Returns:
The value of the local receive window size used to fill the outgoing segment.

References GET_RCV_BUFFSIZE, and TcpRcvWinNow().

Referenced by TcpTransmitSegment().

UINT32 TcpDataToSend ( IN TCP_CB Tcb,
IN INTN  Force 
)

Compute how much data to send.

Parameters:
[in] Tcb Pointer to the TCP_CB of this TCP instance.
[in] Force If TRUE, to ignore the sender's SWS avoidance algorithm and send out data by force.
Returns:
The length of the data can be sent. If 0, no data can be sent.

References GET_SND_DATASIZE, TCP_CTRL_NO_NAGLE, TCP_FLG_ON, TCP_SEQ_GT, TCP_SUB_SEQ, TCP_TIMER_ON, TCP_TIMER_REXMIT, TcpGetMaxSndNxt(), and TcpSetProbeTimer().

Referenced by TcpProbeTimeout(), and TcpToSendData().

TCP_SEQNO TcpGetMaxSndNxt ( IN TCP_CB Tcb  ) 

Get the maximum SndNxt.

Parameters:
[in] Tcb Pointer to the TCP_CB of this TCP instance.
Returns:
The sequence number of the maximum SndNxt.

References TCP_SEQ_GEQ, and TCPSEG_NETBUF.

Referenced by TcpDataToSend(), TcpDispatcher(), TcpGetSegment(), and TcpToSendData().

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.

Parameters:
[in] Tcb Pointer to the TCP_CB of this TCP instance.
[in] Seq The sequence number of the segment.
[in] Len The maximum length of the segment.
Returns:
Pointer to the segment. If NULL, some error occurred.

References TCP_SEQ_LT, TcpGetMaxSndNxt(), TcpGetSegmentSndQue(), TcpGetSegmentSock(), and TcpVerifySegment().

Referenced by TcpToSendData().

NET_BUF* TcpGetSegmentSndQue ( IN TCP_CB Tcb,
IN TCP_SEQNO  Seq,
IN UINT32  Len 
)

Get a segment from the Tcb's SndQue.

Parameters:
[in] Tcb Pointer to the TCP_CB of this TCP instance.
[in] Seq The sequence number of the segment.
[in] Len The maximum length of the segment.
Returns:
Pointer to the segment. If NULL, some error occurred.

References _TCP_SEG::End, _TCP_SEG::Flag, _TCP_SEG::Seq, TCP_CLEAR_FLG, TCP_FLG_FIN, TCP_FLG_ON, TCP_FLG_SYN, TCP_MAX_HEAD, TCP_SEQ_LEQ, TCP_SEQ_LT, TCP_SUB_SEQ, and TCPSEG_NETBUF.

Referenced by TcpGetSegment(), and TcpRetransmit().

NET_BUF* TcpGetSegmentSock ( IN TCP_CB Tcb,
IN TCP_SEQNO  Seq,
IN UINT32  Len 
)

Get a segment from the Tcb's socket buffer.

Parameters:
[in] Tcb Pointer to the TCP_CB of this TCP instance.
[in] Seq The sequence number of the segment.
[in] Len The maximum length of the segment.
Returns:
Pointer to the segment. If NULL, some error occurred.

References SockDataSent(), SockGetDataToSend(), TCP_MAX_HEAD, and TCPSEG_NETBUF.

Referenced by TcpGetSegment().

UINT32 TcpRcvWinNow ( IN TCP_CB Tcb  ) 

Compute the current receive window.

Parameters:
[in] Tcb Pointer to the TCP_CB of this TCP instance.
Returns:
The size of the current receive window, in bytes.

References GET_RCV_BUFFSIZE, SOCK_RCV_BUF, SockGetFreeSpace(), and TcpRcvWinOld().

Referenced by TcpComputeWnd(), TcpOnAppConsume(), and TcpToSendAck().

UINT32 TcpRcvWinOld ( IN TCP_CB Tcb  ) 

Compute the sequence space left in the old receive window.

Parameters:
[in] Tcb Pointer to the TCP_CB of this TCP instance.
Returns:
The sequence space left in the old receive window.

References TCP_SEQ_GT, and TCP_SUB_SEQ.

Referenced by TcpOnAppConsume(), TcpRcvWinNow(), and TcpToSendAck().

INTN TcpRetransmit ( IN TCP_CB Tcb,
IN TCP_SEQNO  Seq 
)

Retransmit the segment from sequence Seq.

Parameters:
[in] Tcb Pointer to the TCP_CB of this TCP instance.
[in] Seq The sequence number of the segment to be retransmitted.
Return values:
0 Retransmission succeeded.
-1 Error condition occurred.

References TCP_SEQ_LT, TCP_SUB_SEQ, TcpGetSegmentSndQue(), TcpTransmitSegment(), and TcpVerifySegment().

Referenced by TcpFastLossRecover(), TcpFastRecover(), and TcpRexmitTimeout().

VOID TcpSendAck ( IN OUT TCP_CB Tcb  ) 

Send an ACK immediately.

Parameters:
[in,out] Tcb Pointer to the TCP_CB of this TCP instance.

References _TCP_SEG::End, _TCP_SEG::Flag, _TCP_SEG::Seq, TCP_CLEAR_FLG, TCP_CTRL_ACK_NOW, TCP_FLG_ACK, TCP_MAX_HEAD, TCPSEG_NETBUF, and TcpTransmitSegment().

Referenced by TcpDeliverData(), TcpInput(), TcpOnAppConsume(), TcpTickingDpc(), and TcpToSendAck().

INTN TcpSendReset ( IN TCP_CB Tcb,
IN TCP_HEAD *  Head,
IN INT32  Len,
IN EFI_IP_ADDRESS *  Local,
IN EFI_IP_ADDRESS *  Remote,
IN UINT8  Version 
)

Send a RESET segment in response to the segment received.

Parameters:
[in] Tcb Pointer to the TCP_CB of this TCP instance. May be NULL.
[in] Head TCP header of the segment that triggers the reset.
[in] Len Length of the segment that triggers the reset.
[in] Local Local IP address.
[in] Remote Remote peer's IP address.
[in] Version IP_VERSION_4 indicates TCP is running on IP4 stack, IP_VERSION_6 indicates TCP is running on IP6 stack.
Return values:
0 A reset was sent or there is no need to send it.
-1 No reset is sent.

References TCP_FLG_ACK, TCP_FLG_ON, TCP_FLG_RST, TCP_MAX_HEAD, TCP_SET_FLG, TcpChecksum(), and TcpSendIpPacket().

Referenced by TcpInput().

INTN TcpSendZeroProbe ( IN OUT TCP_CB Tcb  ) 

Send a zero probe segment. It can be used by keepalive and zero window probe.

Parameters:
[in,out] Tcb Pointer to the TCP_CB of this TCP instance.
Return values:
0 The zero probe segment was sent out successfully.
other An error condition occurred.

References _TCP_SEG::End, _TCP_SEG::Flag, _TCP_SEG::Seq, TCP_FLG_ACK, TCP_MAX_HEAD, TCPSEG_NETBUF, and TcpTransmitSegment().

Referenced by TcpKeepaliveTimeout(), and TcpProbeTimeout().

VOID TcpToSendAck ( IN OUT TCP_CB Tcb  ) 

Check whether to send an ACK or delayed ACK.

Parameters:
[in,out] Tcb Pointer to the TCP_CB of this TCP instance.

References TCP_CTRL_ACK_NOW, TCP_FLG_ON, TcpRcvWinNow(), TcpRcvWinOld(), and TcpSendAck().

Referenced by TcpInput().

INTN TcpToSendData ( IN OUT TCP_CB Tcb,
IN INTN  Force 
)

Check whether to send data/SYN/FIN and piggyback an ACK.

Parameters:
[in,out] Tcb Pointer to the TCP_CB of this TCP instance.
[in] Force If TRUE, ignore the sender's SWS avoidance algorithm and send out data by force.
Returns:
The number of bytes sent.

References _TCP_SEG::End, _TCP_SEG::Flag, GET_SND_DATASIZE, mTcpOutFlag, mTcpStateName, _TCP_SEG::Seq, TCP_CLEAR_FLG, TCP_CLOSED, TCP_CONGEST_OPEN, TCP_CTRL_FIN_SENT, TCP_CTRL_RTT_ON, TCP_FLG_FIN, TCP_FLG_ON, TCP_FLG_SYN, TCP_LISTEN, TCP_SEQ_GT, TCP_SEQ_LT, TCP_SET_FLG, TCP_SUB_SEQ, TCP_TIMER_ON, TCP_TIMER_REXMIT, TcpCheckSndQue(), TcpDataToSend(), TcpGetMaxSndNxt(), TcpGetSegment(), TCPSEG_NETBUF, TcpSetTimer(), TcpTransmitSegment(), and TcpVerifySegment().

Referenced by TcpInput(), TcpOnAppClose(), TcpOnAppConnect(), TcpOnAppSend(), and TcpProbeTimeout().

INTN TcpTransmitSegment ( IN OUT TCP_CB Tcb,
IN NET_BUF *  Nbuf 
)

Build the TCP header of the TCP segment and transmit the segment by IP.

Parameters:
[in,out] Tcb Pointer to the TCP_CB of this TCP instance.
[in] Nbuf Pointer to the buffer containing the segment to be sent out.
Return values:
0 The segment was sent out successfully.
-1 An error condition occurred.

References _TCP_SEG::End, _TCP_SEG::Flag, GET_SND_DATASIZE, _TCP_SEG::Seq, TCP_CLEAR_FLG, TCP_CTRL_SND_PSH, TCP_CTRL_SND_URG, TCP_FLG_ON, TCP_FLG_PSH, TCP_FLG_SYN, TCP_FLG_URG, TCP_SEQ_BETWEEN, TCP_SEQ_LEQ, TCP_SEQ_LT, TCP_SET_FLG, TCP_SUB_SEQ, TcpBuildOption(), TcpChecksum(), TcpComputeWnd(), TCPSEG_NETBUF, TcpSendIpPacket(), TcpSynBuildOption(), TcpVerifySegment(), and _TCP_SEG::Urg.

Referenced by TcpRetransmit(), TcpSendAck(), TcpSendZeroProbe(), and TcpToSendData().

INTN TcpVerifySegment ( IN NET_BUF *  Nbuf  ) 

Verify that the segment is in good shape.

Parameters:
[in] Nbuf The buffer that contains the segment to be checked.
Return values:
0 The segment is broken.
1 The segment is in good shape.

References _TCP_SEG::End, _TCP_SEG::Flag, _TCP_SEG::Seq, TCP_FLG_FIN, TCP_FLG_ON, TCP_FLG_SYN, and TCPSEG_NETBUF.

Referenced by TcpCheckSndQue(), TcpDeliverData(), TcpGetSegment(), TcpRetransmit(), TcpToSendData(), TcpTransmitSegment(), and TcpTrimSegment().


Variable Documentation

UINT8 mTcpOutFlag[]

Initial value:

 {
  0,                          
  0,                          
  TCP_FLG_SYN,                
  TCP_FLG_SYN | TCP_FLG_ACK,  
  TCP_FLG_ACK,                
  TCP_FLG_FIN | TCP_FLG_ACK,  
  TCP_FLG_ACK,                
  TCP_FLG_ACK | TCP_FLG_FIN,  
  TCP_FLG_ACK,                
  TCP_FLG_ACK,                
  TCP_FLG_FIN | TCP_FLG_ACK   
}

Referenced by TcpToSendData().


Generated on Mon Sep 28 08:49:06 2015 for NetworkPkg[ALL] by  doxygen 1.5.7.1