Functions | |
VOID | TcpInitTcbLocal (IN OUT TCP_CB *Tcb) |
VOID | TcpInitTcbPeer (IN OUT TCP_CB *Tcb, IN TCP_SEG *Seg, IN TCP_OPTION *Opt) |
BOOLEAN | TcpIsIpEqual (IN EFI_IP_ADDRESS *Ip1, IN EFI_IP_ADDRESS *Ip2, IN UINT8 Version) |
BOOLEAN | TcpIsIpZero (IN EFI_IP_ADDRESS *Ip, IN UINT8 Version) |
TCP_CB * | TcpLocateListenTcb (IN TCP_PEER *Local, IN TCP_PEER *Remote, IN UINT8 Version) |
BOOLEAN | TcpFindTcbByPeer (IN EFI_IP_ADDRESS *Addr, IN TCP_PORTNO Port, IN UINT8 Version) |
TCP_CB * | TcpLocateTcb (IN TCP_PORTNO LocalPort, IN EFI_IP_ADDRESS *LocalIp, IN TCP_PORTNO RemotePort, IN EFI_IP_ADDRESS *RemoteIp, IN UINT8 Version, IN BOOLEAN Syn) |
INTN | TcpInsertTcb (IN TCP_CB *Tcb) |
TCP_CB * | TcpCloneTcb (IN TCP_CB *Tcb) |
TCP_SEQNO | TcpGetIss (VOID) |
UINT16 | TcpGetRcvMss (IN SOCKET *Sock) |
VOID | TcpSetState (IN TCP_CB *Tcb, IN UINT8 State) |
UINT16 | TcpChecksum (IN NET_BUF *Nbuf, IN UINT16 HeadSum) |
TCP_SEG * | TcpFormatNetbuf (IN TCP_CB *Tcb, IN OUT NET_BUF *Nbuf) |
VOID | TcpOnAppConnect (IN OUT TCP_CB *Tcb) |
VOID | TcpOnAppClose (IN OUT TCP_CB *Tcb) |
INTN | TcpOnAppSend (IN OUT TCP_CB *Tcb) |
VOID | TcpOnAppConsume (IN TCP_CB *Tcb) |
VOID | TcpOnAppAbort (IN TCP_CB *Tcb) |
VOID | TcpResetConnection (IN TCP_CB *Tcb) |
EFI_STATUS | TcpInstallDevicePath (IN SOCKET *Sock) |
Variables | |
LIST_ENTRY | mTcpRunQue |
LIST_ENTRY | mTcpListenQue |
TCP_SEQNO | mTcpGlobalIss = TCP_BASE_ISS |
CHAR16 * | mTcpStateName [] |
(C) Copyright 2014 Hewlett-Packard Development Company, L.P.
Copyright (c) 2009 - 2015, 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.
UINT16 TcpChecksum | ( | IN NET_BUF * | Nbuf, | |
IN UINT16 | HeadSum | |||
) |
Compute the TCP segment's checksum.
[in] | Nbuf | Pointer to the buffer that contains the TCP segment. |
[in] | HeadSum | The checksum value of the fixed part of pseudo header. |
Referenced by TcpInput(), TcpResetConnection(), TcpSendReset(), and TcpTransmitSegment().
Clone a TCP_CB from Tcb.
[in] | Tcb | Pointer to the TCP_CB to be cloned. |
References _TCP_CONTROL_BLOCK::List, _TCP_SOCKET::ProtoReserved, _TCP_CONTROL_BLOCK::RcvQue, _TCP_CONTROL_BLOCK::Sk, _TCP_CONTROL_BLOCK::SndQue, and SockClone().
Referenced by TcpInput().
BOOLEAN TcpFindTcbByPeer | ( | IN EFI_IP_ADDRESS * | Addr, | |
IN TCP_PORTNO | Port, | |||
IN UINT8 | Version | |||
) |
Try to find one Tcb whose <Ip, Port> equals to <IN Addr, IN Port>.
[in] | Addr | Pointer to the IP address needs to match. |
[in] | Port | The port number needs to match. |
[in] | Version | IP_VERSION_4 indicates TCP is running on IP4 stack, IP_VERSION_6 indicates TCP is running on IP6 stack. |
TRUE | The Tcb which matches the <Addr port>=""> pair exists. | |
FALSE | Otherwise |
References _TCP_PEER::Ip, _TCP_SOCKET::IpVersion, _TCP_CONTROL_BLOCK::LocalEnd, mTcpListenQue, mTcpRunQue, _TCP_PEER::Port, _TCP_CONTROL_BLOCK::Sk, and TcpIsIpEqual().
Referenced by TcpBind().
Translate the information from the head of the received TCP segment Nbuf contents and fill it into a TCP_SEG structure.
[in] | Tcb | Pointer to the TCP_CB of this TCP instance. |
[in,out] | Nbuf | Pointer to the buffer contains the TCP segment. |
References _TCP_SEG::Ack, _TCP_SEG::End, _TCP_SEG::Flag, _TCP_SEG::Seq, TCP_FLG_FIN, TCP_FLG_ON, TCP_FLG_SYN, TCPSEG_NETBUF, _TCP_SEG::Urg, and _TCP_SEG::Wnd.
Referenced by TcpInput().
TCP_SEQNO TcpGetIss | ( | VOID | ) |
Compute an ISS to be used by a new connection.
References mTcpGlobalIss, and TCP_ISS_INCREMENT_1.
Referenced by TcpInitTcbLocal().
UINT16 TcpGetRcvMss | ( | IN SOCKET * | Sock | ) |
Get the local mss.
[in] | Sock | Pointer to the socket to get mss. |
References _TCP_SERVICE_DATA::IpIo, and _TCP_PROTO_DATA::TcpService.
Referenced by TcpConfigurePcb(), and TcpInitTcbPeer().
VOID TcpInitTcbLocal | ( | IN OUT TCP_CB * | Tcb | ) |
Initialize the Tcb local related members.
[in,out] | Tcb | Pointer to the TCP_CB of this TCP instance. |
References GET_RCV_BUFFSIZE, and TcpGetIss().
Referenced by TcpInput(), and TcpOnAppConnect().
VOID TcpInitTcbPeer | ( | IN OUT TCP_CB * | Tcb, | |
IN TCP_SEG * | Seg, | |||
IN TCP_OPTION * | Opt | |||
) |
Initialize the peer related members.
[in,out] | Tcb | Pointer to the TCP_CB of this TCP instance. |
[in] | Seg | Pointer to the segment that contains the peer's intial info. |
[in] | Opt | Pointer to the options announced by the peer. |
References TCP_CTRL_NO_TS, TCP_CTRL_NO_WS, TCP_CTRL_RCVD_TS, TCP_CTRL_RCVD_WS, TCP_CTRL_SND_TS, TCP_FLG_ACK, TCP_FLG_ON, TCP_FLG_SYN, TCP_OPTION_RCVD_MSS, TCP_OPTION_RCVD_TS, TCP_OPTION_RCVD_WS, TCP_OPTION_TS_ALIGNED_LEN, TCP_SET_FLG, TcpComputeScale(), and TcpGetRcvMss().
Referenced by TcpInput().
INTN TcpInsertTcb | ( | IN TCP_CB * | Tcb | ) |
Insert a Tcb into the proper queue.
[in] | Tcb | Pointer to the TCP_CB to be inserted. |
0 | The Tcb was inserted successfully. | |
-1 | Error condition occurred. |
References _TCP_CONTROL_BLOCK::LocalEnd, mTcpListenQue, mTcpRunQue, _TCP_CONTROL_BLOCK::RemoteEnd, TCP_CLOSED, TCP_LISTEN, TCP_PEER_EQUAL, TCP_SYN_RCVD, and TCP_SYN_SENT.
Referenced by TcpConfigurePcb(), and TcpInput().
EFI_STATUS TcpInstallDevicePath | ( | IN SOCKET * | Sock | ) |
Install the device path protocol on the TCP instance.
[in] | Sock | Pointer to the socket representing the TCP instance. |
EFI_SUCCESS | The device path protocol was installed. | |
other | Failed to install the device path protocol. |
References _TCP_SERVICE_DATA::ControllerHandle, _TCP_PEER::Ip, _TCP_CONTROL_BLOCK::LocalEnd, _TCP_PEER::Port, _TCP_CONTROL_BLOCK::RemoteEnd, _TCP_CONTROL_BLOCK::SubnetMask, _TCP_PROTO_DATA::TcpPcb, _TCP_PROTO_DATA::TcpService, and _TCP_CONTROL_BLOCK::UseDefaultAddr.
Referenced by TcpConfigurePcb(), and TcpSetState().
BOOLEAN TcpIsIpEqual | ( | IN EFI_IP_ADDRESS * | Ip1, | |
IN EFI_IP_ADDRESS * | Ip2, | |||
IN UINT8 | Version | |||
) |
Check whether one IP address equals the other.
[in] | Ip1 | Pointer to IP address to be checked. |
[in] | Ip2 | Pointer to IP address to be checked. |
[in] | Version | IP_VERSION_4 indicates the IP address is an IPv4 address, IP_VERSION_6 indicates the IP address is an IPv6 address. |
TRUE | Ip1 equals Ip2. | |
FALSE | Ip1 does not equal Ip2. |
Referenced by TcpFindTcbByPeer().
BOOLEAN TcpIsIpZero | ( | IN EFI_IP_ADDRESS * | Ip, | |
IN UINT8 | Version | |||
) |
Check whether one IP address is filled with ZERO.
[in] | Ip | Pointer to the IP address to be checked. |
[in] | Version | IP_VERSION_4 indicates the IP address is an IPv4 address, IP_VERSION_6 indicates the IP address is an IPv6 address. |
TRUE | Ip is all zero address. | |
FALSE | Ip is not all zero address. |
Referenced by TcpLocateListenTcb().
Locate a listen TCB that matchs the Local and Remote.
[in] | Local | Pointer to the local (IP, Port). |
[in] | Remote | Pointer to the remote (IP, Port). |
[in] | Version | IP_VERSION_4 indicates TCP is running on IP4 stack, IP_VERSION_6 indicates TCP is running on IP6 stack. |
References _TCP_PEER::Ip, _TCP_SOCKET::IpVersion, _TCP_CONTROL_BLOCK::LocalEnd, mTcpListenQue, _TCP_PEER::Port, _TCP_CONTROL_BLOCK::RemoteEnd, _TCP_CONTROL_BLOCK::Sk, TCP_PEER_MATCH, and TcpIsIpZero().
Referenced by TcpLocateTcb().
TCP_CB* TcpLocateTcb | ( | IN TCP_PORTNO | LocalPort, | |
IN EFI_IP_ADDRESS * | LocalIp, | |||
IN TCP_PORTNO | RemotePort, | |||
IN EFI_IP_ADDRESS * | RemoteIp, | |||
IN UINT8 | Version, | |||
IN BOOLEAN | Syn | |||
) |
Locate the TCP_CB related to the socket pair.
[in] | LocalPort | The local port number. |
[in] | LocalIp | The local IP address. |
[in] | RemotePort | The remote port number. |
[in] | RemoteIp | The remote IP address. |
[in] | Version | IP_VERSION_4 indicates TCP is running on IP4 stack, IP_VERSION_6 indicates TCP is running on IP6 stack. |
[in] | Syn | If TRUE, the listen sockets are searched. |
References _TCP_PEER::Ip, _TCP_SOCKET::IpVersion, _TCP_CONTROL_BLOCK::List, _TCP_CONTROL_BLOCK::LocalEnd, mTcpRunQue, _TCP_PEER::Port, _TCP_CONTROL_BLOCK::RemoteEnd, _TCP_CONTROL_BLOCK::Sk, TCP_PEER_EQUAL, and TcpLocateListenTcb().
Referenced by TcpIcmpInput(), and TcpInput().
VOID TcpOnAppAbort | ( | IN TCP_CB * | Tcb | ) |
Abort the connection by sending a reset segment. Called when the application wants to abort the connection.
[in] | Tcb | Pointer to the TCP_CB of the TCP instance. |
References TCP_CLOSE_WAIT, TCP_CLOSED, TCP_ESTABLISHED, TCP_FIN_WAIT_1, TCP_FIN_WAIT_2, TCP_SYN_RCVD, TcpResetConnection(), and TcpSetState().
Referenced by TcpDispatcher().
VOID TcpOnAppClose | ( | IN OUT TCP_CB * | Tcb | ) |
Initiate the connection close procedure, called when applications want to close the connection.
[in,out] | Tcb | Pointer to the TCP_CB of this TCP instance. |
References GET_RCV_DATASIZE, TCP_CLOSE_WAIT, TCP_CLOSED, TCP_ESTABLISHED, TCP_FIN_WAIT_1, TCP_LAST_ACK, TCP_LISTEN, TCP_SYN_RCVD, TCP_SYN_SENT, TcpClose(), TcpResetConnection(), TcpSetState(), and TcpToSendData().
Referenced by TcpDispatcher().
VOID TcpOnAppConnect | ( | IN OUT TCP_CB * | Tcb | ) |
Initialize an active connection.
[in,out] | Tcb | Pointer to the TCP_CB that wants to initiate a connection. |
References TCP_SYN_SENT, TCP_TIMER_CONNECT, TcpInitTcbLocal(), TcpSetState(), TcpSetTimer(), and TcpToSendData().
Referenced by TcpDispatcher().
VOID TcpOnAppConsume | ( | IN TCP_CB * | Tcb | ) |
Application has consumed some data. Check whether to send a window update ack or a delayed ack.
[in] | Tcb | Pointer to the TCP_CB of this TCP instance. |
References TCP_ESTABLISHED, TcpRcvWinNow(), TcpRcvWinOld(), and TcpSendAck().
Referenced by TcpDispatcher().
INTN TcpOnAppSend | ( | IN OUT TCP_CB * | Tcb | ) |
Check whether the application's newly delivered data can be sent out.
[in,out] | Tcb | Pointer to the TCP_CB of this TCP instance. |
0 | The data has been sent out successfully. | |
-1 | The Tcb is not in a state that data is permitted to be sent out. |
References TCP_CLOSE_WAIT, TCP_CLOSED, TCP_CLOSING, TCP_ESTABLISHED, TCP_FIN_WAIT_1, TCP_FIN_WAIT_2, TCP_LAST_ACK, TCP_LISTEN, TCP_SYN_RCVD, TCP_SYN_SENT, TCP_TIME_WAIT, and TcpToSendData().
Referenced by TcpDispatcher().
VOID TcpResetConnection | ( | IN TCP_CB * | Tcb | ) |
Reset the connection related with Tcb.
[in] | Tcb | Pointer to the TCP_CB of the connection to be reset. |
References TCP_FLG_RST, TCP_MAX_HEAD, TcpChecksum(), and TcpSendIpPacket().
Referenced by TcpConnectTimeout(), TcpOnAppAbort(), and TcpOnAppClose().
VOID TcpSetState | ( | IN TCP_CB * | Tcb, | |
IN UINT8 | State | |||
) |
Set the Tcb's state.
[in] | Tcb | Pointer to the TCP_CB of this TCP instance. |
[in] | State | The state to be set. |
References mTcpStateName, SockConnClosed(), SockConnEstablished(), TCP_CLOSED, TCP_ESTABLISHED, and TcpInstallDevicePath().
Referenced by TcpClose(), TcpConfigurePcb(), TcpDeliverData(), TcpInput(), TcpOnAppAbort(), TcpOnAppClose(), and TcpOnAppConnect().
TCP_SEQNO mTcpGlobalIss = TCP_BASE_ISS |
Referenced by TcpDriverEntryPoint(), TcpGetIss(), and TcpTickingDpc().
LIST_ENTRY mTcpListenQue |
Initial value:
{ &mTcpListenQue, &mTcpListenQue }
Referenced by TcpFindTcbByPeer(), TcpInsertTcb(), and TcpLocateListenTcb().
LIST_ENTRY mTcpRunQue |
Initial value:
{ &mTcpRunQue, &mTcpRunQue }
Referenced by TcpFindTcbByPeer(), TcpInsertTcb(), TcpLocateTcb(), and TcpTickingDpc().
CHAR16* mTcpStateName[] |
Initial value:
{ L"TCP_CLOSED", L"TCP_LISTEN", L"TCP_SYN_SENT", L"TCP_SYN_RCVD", L"TCP_ESTABLISHED", L"TCP_FIN_WAIT_1", L"TCP_FIN_WAIT_2", L"TCP_CLOSING", L"TCP_TIME_WAIT", L"TCP_CLOSE_WAIT", L"TCP_LAST_ACK" }
Referenced by TcpSetState(), and TcpToSendData().