-/** @file
-
-Copyright (c) 2005 - 2006, 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.
-
-Module Name:
-
- Tcp4Main.h
-
-Abstract:
-
-
-**/
-
-#ifndef _TCP4_MAIN_H_
-#define _TCP4_MAIN_H_
-
-#include "Socket.h"
-
-#include "Tcp4Proto.h"
-#include "Tcp4Driver.h"
-
-
-extern UINT16 mTcp4RandomPort;
-
-//
-// Driver Produced Protocol Prototypes
-//
-//@MT:#include EFI_PROTOCOL_PRODUCER (Tcp4)
-
-#define TCP4_DEBUG_ERROR(PrintArg) NET_DEBUG_ERROR ("Tcp", PrintArg)
-#define TCP4_DEBUG_WARN(PrintArg) NET_DEBUG_WARNING ("Tcp", PrintArg)
-#define TCP4_DEBUG_TRACE(PrintArg) NET_DEBUG_TRACE ("Tcp", PrintArg)
-
-//
-// Function prototype for the Tcp4 socket request handler
-//
-EFI_STATUS
-Tcp4Dispatcher (
- IN SOCKET *Sock,
- IN SOCK_REQUEST Request,
- IN VOID *Data OPTIONAL
- );
-
-typedef struct _TCP4_MODE_DATA {
- EFI_TCP4_CONNECTION_STATE *Tcp4State;
- EFI_TCP4_CONFIG_DATA *Tcp4ConfigData;
- EFI_IP4_MODE_DATA *Ip4ModeData;
- EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData;
- EFI_SIMPLE_NETWORK_MODE *SnpModeData;
-} TCP4_MODE_DATA;
-
-typedef struct _TCP4_ROUTE_INFO {
- BOOLEAN DeleteRoute;
- EFI_IPv4_ADDRESS *SubnetAddress;
- EFI_IPv4_ADDRESS *SubnetMask;
- EFI_IPv4_ADDRESS *GatewayAddress;
-} TCP4_ROUTE_INFO;
-
-//
-// Get the mode data of a TCP instance
-//
-EFI_STATUS
-EFIAPI
-Tcp4GetModeData (
- IN CONST EFI_TCP4_PROTOCOL * This,
- OUT EFI_TCP4_CONNECTION_STATE * Tcp4State OPTIONAL,
- OUT EFI_TCP4_CONFIG_DATA * Tcp4ConfigData OPTIONAL,
- OUT EFI_IP4_MODE_DATA * Ip4ModeData OPTIONAL,
- OUT EFI_MANAGED_NETWORK_CONFIG_DATA * MnpConfigData OPTIONAL,
- OUT EFI_SIMPLE_NETWORK_MODE * SnpModeData OPTIONAL
- );
-
-//
-// Initialize or reset a TCP instance
-//
-EFI_STATUS
-EFIAPI
-Tcp4Configure (
- IN EFI_TCP4_PROTOCOL * This,
- IN EFI_TCP4_CONFIG_DATA * TcpConfigData OPTIONAL
- );
-
-//
-// Add a route entry to the route table
-//
-EFI_STATUS
-EFIAPI
-Tcp4Routes (
- IN EFI_TCP4_PROTOCOL *This,
- IN BOOLEAN DeleteRoute,
- IN EFI_IPv4_ADDRESS *SubnetAddress,
- IN EFI_IPv4_ADDRESS *SubnetMask,
- IN EFI_IPv4_ADDRESS *GatewayAddress
- );
-
-//
-// Issue an asynchronous connection establishment
-// request to the peer
-//
-EFI_STATUS
-EFIAPI
-Tcp4Connect (
- IN EFI_TCP4_PROTOCOL *This,
- IN EFI_TCP4_CONNECTION_TOKEN *ConnectionToken
- );
-
-//
-// Issue an asynchronous listent token to accept an
-// incoming connection reques
-//
-EFI_STATUS
-EFIAPI
-Tcp4Accept (
- IN EFI_TCP4_PROTOCOL *This,
- IN EFI_TCP4_LISTEN_TOKEN *ListenToken
- );
-
-//
-// Issue an asynchronous IO token to transmit some data
-// through this TCP instance
-//
-EFI_STATUS
-EFIAPI
-Tcp4Transmit (
- IN EFI_TCP4_PROTOCOL *This,
- IN EFI_TCP4_IO_TOKEN *Token
- );
-
-//
-// Issue an asynchronous IO token to receive some data
-// through this TCP instance
-//
-EFI_STATUS
-Tcp4Receive (
- IN EFI_TCP4_PROTOCOL *This,
- IN EFI_TCP4_IO_TOKEN *Token
- );
-
-//
-// Issue an asynchronous CloseToken to close a TCP
-// connection represented by instance
-//
-EFI_STATUS
-EFIAPI
-Tcp4Close (
- IN EFI_TCP4_PROTOCOL *This,
- IN EFI_TCP4_CLOSE_TOKEN *CloseToken
- );
-
-//
-// cancle an connect, listent or IO token
-//
-EFI_STATUS
-EFIAPI
-Tcp4Cancel (
- IN EFI_TCP4_PROTOCOL * This,
- IN EFI_TCP4_COMPLETION_TOKEN * Token OPTIONAL
- );
-
-//
-// poll data from NIC for receive
-//
-EFI_STATUS
-EFIAPI
-Tcp4Poll (
- IN EFI_TCP4_PROTOCOL *This
- );
-
-#endif
+/** @file\r
+ TCP4 protocol services header file.\r
+\r
+Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution. The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php<BR>\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef _TCP4_MAIN_H_\r
+#define _TCP4_MAIN_H_\r
+\r
+#include "Socket.h"\r
+\r
+#include "Tcp4Proto.h"\r
+#include "Tcp4Func.h"\r
+#include "Tcp4Driver.h"\r
+\r
+\r
+extern UINT16 mTcp4RandomPort;\r
+extern CHAR16 *mTcpStateName[];\r
+\r
+//\r
+// Driver Produced Protocol Prototypes\r
+//\r
+\r
+//\r
+// Function prototype for the Tcp4 socket request handler\r
+//\r
+/**\r
+ The procotol handler provided to the socket layer, used to\r
+ dispatch the socket level requests by calling the corresponding\r
+ TCP layer functions.\r
+\r
+ @param Sock Pointer to the socket of this TCP instance.\r
+ @param Request The code of this operation request.\r
+ @param Data Pointer to the operation specific data passed in\r
+ together with the operation request.\r
+\r
+ @retval EFI_SUCCESS The socket request is completed successfully.\r
+ @retval other The error status returned by the corresponding TCP\r
+ layer function.\r
+\r
+**/\r
+EFI_STATUS\r
+Tcp4Dispatcher (\r
+ IN SOCKET *Sock,\r
+ IN UINT8 Request,\r
+ IN VOID *Data OPTIONAL\r
+ );\r
+ \r
+///\r
+/// TCP mode data\r
+///\r
+typedef struct _TCP4_MODE_DATA {\r
+ EFI_TCP4_CONNECTION_STATE *Tcp4State;\r
+ EFI_TCP4_CONFIG_DATA *Tcp4ConfigData;\r
+ EFI_IP4_MODE_DATA *Ip4ModeData;\r
+ EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData;\r
+ EFI_SIMPLE_NETWORK_MODE *SnpModeData;\r
+} TCP4_MODE_DATA;\r
+\r
+///\r
+/// TCP route infomation data\r
+///\r
+typedef struct _TCP4_ROUTE_INFO {\r
+ BOOLEAN DeleteRoute;\r
+ EFI_IPv4_ADDRESS *SubnetAddress;\r
+ EFI_IPv4_ADDRESS *SubnetMask;\r
+ EFI_IPv4_ADDRESS *GatewayAddress;\r
+} TCP4_ROUTE_INFO;\r
+\r
+typedef struct {\r
+ EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;\r
+ UINTN NumberOfChildren;\r
+ EFI_HANDLE *ChildHandleBuffer;\r
+} TCP4_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT;\r
+\r
+/**\r
+ Get the current operational status of a TCP instance.\r
+ \r
+ The GetModeData() function copies the current operational settings of this \r
+ EFI TCPv4 Protocol instance into user-supplied buffers. This function can \r
+ also be used to retrieve the operational setting of underlying drivers \r
+ such as IPv4, MNP, or SNP.\r
+\r
+ @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
+ @param Tcp4State Pointer to the buffer to receive the current TCP\r
+ state.\r
+ @param Tcp4ConfigData Pointer to the buffer to receive the current TCP\r
+ configuration.\r
+ @param Ip4ModeData Pointer to the buffer to receive the current IPv4 \r
+ configuration data used by the TCPv4 instance.\r
+ @param MnpConfigData Pointer to the buffer to receive the current MNP\r
+ configuration data indirectly used by the TCPv4\r
+ Instance.\r
+ @param SnpModeData Pointer to the buffer to receive the current SNP\r
+ configuration data indirectly used by the TCPv4\r
+ Instance.\r
+\r
+ @retval EFI_SUCCESS The mode data was read.\r
+ @retval EFI_NOT_STARTED No configuration data is available because this\r
+ instance hasn't been started.\r
+ @retval EFI_INVALID_PARAMETER This is NULL.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+Tcp4GetModeData (\r
+ IN EFI_TCP4_PROTOCOL *This,\r
+ OUT EFI_TCP4_CONNECTION_STATE *Tcp4State OPTIONAL,\r
+ OUT EFI_TCP4_CONFIG_DATA *Tcp4ConfigData OPTIONAL,\r
+ OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL,\r
+ OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,\r
+ OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL\r
+ );\r
+\r
+\r
+/**\r
+ Initialize or brutally reset the operational parameters for\r
+ this EFI TCPv4 instance.\r
+ \r
+ The Configure() function does the following:\r
+ * Initialize this EFI TCPv4 instance, i.e., initialize the communication end \r
+ setting, specify active open or passive open for an instance.\r
+ * Reset this TCPv4 instance brutally, i.e., cancel all pending asynchronous \r
+ tokens, flush transmission and receiving buffer directly without informing \r
+ the communication peer.\r
+ No other TCPv4 Protocol operation can be executed by this instance \r
+ until it is configured properly. For an active TCP4 instance, after a proper \r
+ configuration it may call Connect() to initiates the three-way handshake. \r
+ For a passive TCP4 instance, its state will transit to Tcp4StateListen after \r
+ configuration, and Accept() may be called to listen the incoming TCP connection \r
+ request. If TcpConfigData is set to NULL, the instance is reset. Resetting \r
+ process will be done brutally, the state machine will be set to Tcp4StateClosed \r
+ directly, the receive queue and transmit queue will be flushed, and no traffic is \r
+ allowed through this instance.\r
+\r
+ @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
+ @param TcpConfigData Pointer to the configure data to configure the\r
+ instance.\r
+\r
+ @retval EFI_SUCCESS The operational settings are set, changed, or\r
+ reset successfully.\r
+ @retval EFI_NO_MAPPING When using a default address, configuration\r
+ (through DHCP, BOOTP, RARP, etc.) is not\r
+ finished.\r
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+ @retval EFI_ACCESS_DENIED Configuring TCP instance when it is already\r
+ configured.\r
+ @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.\r
+ @retval EFI_UNSUPPORTED One or more of the control options are not\r
+ supported in the implementation.\r
+ @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+Tcp4Configure (\r
+ IN EFI_TCP4_PROTOCOL *This,\r
+ IN EFI_TCP4_CONFIG_DATA *TcpConfigData OPTIONAL\r
+ );\r
+\r
+/**\r
+ Add or delete routing entries.\r
+ \r
+ The Routes() function adds or deletes a route from the instance's routing table.\r
+ The most specific route is selected by comparing the SubnetAddress with the \r
+ destination IP address's arithmetical AND to the SubnetMask.\r
+ The default route is added with both SubnetAddress and SubnetMask set to 0.0.0.0. \r
+ The default route matches all destination IP addresses if there is no more specific route.\r
+ Direct route is added with GatewayAddress set to 0.0.0.0. Packets are sent to \r
+ the destination host if its address can be found in the Address Resolution Protocol (ARP) \r
+ cache or it is on the local subnet. If the instance is configured to use default \r
+ address, a direct route to the local network will be added automatically.\r
+ Each TCP instance has its own independent routing table. Instance that uses the \r
+ default IP address will have a copy of the EFI_IP4_CONFIG_PROTOCOL's routing table. \r
+ The copy will be updated automatically whenever the IP driver reconfigures its \r
+ instance. As a result, the previous modification to the instance's local copy \r
+ will be lost. The priority of checking the route table is specific with IP \r
+ implementation and every IP implementation must comply with RFC 1122.\r
+\r
+ @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
+ @param DeleteRoute If TRUE, delete the specified route from routing\r
+ table; if FALSE, add the specified route to\r
+ routing table.\r
+ DestinationAddress and SubnetMask are used as \r
+ the keywords to search route entry.\r
+ @param SubnetAddress The destination network.\r
+ @param SubnetMask The subnet mask for the destination network.\r
+ @param GatewayAddress The gateway address for this route. \r
+ It must be on the same subnet with the station \r
+ address unless a direct route is specified.\r
+ \r
+ @retval EFI_SUCCESS The operation completed successfully.\r
+ @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance has not been\r
+ configured.\r
+ @retval EFI_NO_MAPPING When using a default address, configuration\r
+ (through DHCP, BOOTP, RARP, etc.) is not\r
+ finished.\r
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+ @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to add the\r
+ entry to the routing table.\r
+ @retval EFI_NOT_FOUND This route is not in the routing table.\r
+ @retval EFI_ACCESS_DENIED This route is already in the routing table.\r
+ @retval EFI_UNSUPPORTED The TCP driver does not support this operation.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+Tcp4Routes (\r
+ IN EFI_TCP4_PROTOCOL *This,\r
+ IN BOOLEAN DeleteRoute,\r
+ IN EFI_IPv4_ADDRESS *SubnetAddress,\r
+ IN EFI_IPv4_ADDRESS *SubnetMask,\r
+ IN EFI_IPv4_ADDRESS *GatewayAddress\r
+ );\r
+\r
+/**\r
+ Initiate a nonblocking TCP connection request for an active TCP instance.\r
+\r
+ The Connect() function will initiate an active open to the remote peer configured \r
+ in current TCP instance if it is configured active. If the connection succeeds \r
+ or fails due to any error, the ConnectionToken->CompletionToken.Event will be \r
+ signaled and ConnectionToken->CompletionToken.Status will be updated accordingly. \r
+ This function can only be called for the TCP instance in Tcp4StateClosed state. \r
+ The instance will transfer into Tcp4StateSynSent if the function returns EFI_SUCCESS. \r
+ If TCP three way handshake succeeds, its state will become Tcp4StateEstablished, \r
+ otherwise, the state will return to Tcp4StateClosed.\r
+ \r
+ @param This Pointer to the EFI_TCP4_PROTOCOL instance\r
+ @param ConnectionToken Pointer to the connection token to return when\r
+ the TCP three way handshake finishes.\r
+\r
+ @retval EFI_SUCCESS The connection request is successfully initiated \r
+ and the state of this TCPv4 instance has \r
+ been changed to Tcp4StateSynSent.\r
+ @retval EFI_NOT_STARTED This EFI_TCP4_PROTOCOL instance hasn't been\r
+ configured.\r
+ @retval EFI_ACCESS_DENIED The instance is not configured as an active one\r
+ or it is not in Tcp4StateClosed state.\r
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+ @retval EFI_OUT_OF_RESOURCES The driver can't allocate enough resource to\r
+ initiate the active open.\r
+ @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+Tcp4Connect (\r
+ IN EFI_TCP4_PROTOCOL *This,\r
+ IN EFI_TCP4_CONNECTION_TOKEN *ConnectionToken\r
+ );\r
+\r
+/**\r
+ Listen on the passive instance to accept an incoming connection request.\r
+\r
+ The Accept() function initiates an asynchronous accept request to wait for an \r
+ incoming connection on the passive TCP instance. If a remote peer successfully \r
+ establishes a connection with this instance, a new TCP instance will be created \r
+ and its handle will be returned in ListenToken->NewChildHandle. The newly created \r
+ instance is configured by inheriting the passive instance's configuration and is \r
+ ready for use upon return. The instance is in the Tcp4StateEstablished state.\r
+ The ListenToken->CompletionToken.Event will be signaled when a new connection \r
+ is accepted, user aborts the listen or connection is reset. This function only \r
+ can be called when current TCP instance is in Tcp4StateListen state.\r
+\r
+ @param This Pointer to the EFI_TCP4_PROTOCOL instance\r
+ @param ListenToken Pointer to the listen token to return when\r
+ operation finishes.\r
+\r
+ @retval EFI_SUCCESS The listen token has been queued successfully.\r
+ @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been\r
+ configured.\r
+ @retval EFI_ACCESS_DENIED The instatnce is not a passive one or it is not\r
+ in Tcp4StateListen state or a same listen token\r
+ has already existed in the listen token queue of\r
+ this TCP instance.\r
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+ @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to finish\r
+ the operation.\r
+ @retval EFI_DEVICE_ERROR Any unexpected and not belonged to above category error.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+Tcp4Accept (\r
+ IN EFI_TCP4_PROTOCOL *This,\r
+ IN EFI_TCP4_LISTEN_TOKEN *ListenToken\r
+ );\r
+\r
+/**\r
+ Queues outgoing data into the transmit queue.\r
+\r
+ The Transmit() function queues a sending request to this TCPv4 instance along \r
+ with the user data. The status of the token is updated and the event in the token \r
+ will be signaled once the data is sent out or some error occurs.\r
+\r
+ @param This Pointer to the EFI_TCP4_PROTOCOL instance\r
+ @param Token Pointer to the completion token to queue to the\r
+ transmit queue\r
+\r
+ @retval EFI_SUCCESS The data has been queued for transmission.\r
+ @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been\r
+ configured.\r
+ @retval EFI_NO_MAPPING When using a default address, configuration\r
+ (DHCP, BOOTP, RARP, etc.) is not finished yet.\r
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+ @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:\r
+ * A transmit completion token with the same\r
+ Token-> CompletionToken.Event was already in the\r
+ transmission queue. \r
+ * The current instance is in Tcp4StateClosed state \r
+ * The current instance is a passive one and \r
+ it is in Tcp4StateListen state. \r
+ * User has called Close() to disconnect this \r
+ connection.\r
+ @retval EFI_NOT_READY The completion token could not be queued because\r
+ the transmit queue is full.\r
+ @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data because of\r
+ resource shortage.\r
+ @retval EFI_NETWORK_UNREACHABLE There is no route to the destination network or\r
+ address.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+Tcp4Transmit (\r
+ IN EFI_TCP4_PROTOCOL *This,\r
+ IN EFI_TCP4_IO_TOKEN *Token\r
+ );\r
+\r
+/**\r
+ Place an asynchronous receive request into the receiving queue.\r
+\r
+ The Receive() function places a completion token into the receive packet queue. \r
+ This function is always asynchronous. The caller must allocate the \r
+ Token->CompletionToken.Event and the FragmentBuffer used to receive data. He also \r
+ must fill the DataLength which represents the whole length of all FragmentBuffer. \r
+ When the receive operation completes, the EFI TCPv4 Protocol driver updates the \r
+ Token->CompletionToken.Status and Token->Packet.RxData fields and the \r
+ Token->CompletionToken.Event is signaled. If got data the data and its length \r
+ will be copy into the FragmentTable, in the same time the full length of received \r
+ data will be recorded in the DataLength fields. Providing a proper notification \r
+ function and context for the event will enable the user to receive the notification \r
+ and receiving status. That notification function is guaranteed to not be re-entered.\r
+\r
+ @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
+ @param Token Pointer to a token that is associated with the\r
+ receive data descriptor.\r
+\r
+ @retval EFI_SUCCESS The receive completion token was cached.\r
+ @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been\r
+ configured.\r
+ @retval EFI_NO_MAPPING When using a default address, configuration\r
+ (DHCP, BOOTP, RARP, etc.) is not finished yet.\r
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+ @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued\r
+ due to a lack of system resources.\r
+ @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
+ The EFI TCPv4 Protocol instance has been reset \r
+ to startup defaults.\r
+ @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:\r
+ * A receive completion token with the same\r
+ Token->CompletionToken.Event was already in \r
+ the receive queue. \r
+ * The current instance is in Tcp4StateClosed state. \r
+ * The current instance is a passive one and it \r
+ is in Tcp4StateListen state. \r
+ * User has called Close() to disconnect this \r
+ connection.\r
+ @retval EFI_CONNECTION_FIN The communication peer has closed the connection\r
+ and there is no any buffered data in the receive\r
+ buffer of this instance.\r
+ @retval EFI_NOT_READY The receive request could not be queued because\r
+ the receive queue is full.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+Tcp4Receive (\r
+ IN EFI_TCP4_PROTOCOL *This,\r
+ IN EFI_TCP4_IO_TOKEN *Token\r
+ );\r
+\r
+/**\r
+ Disconnecting a TCP connection gracefully or reset a TCP connection.\r
+\r
+ Initiate an asynchronous close token to TCP driver. After Close() is called, \r
+ any buffered transmission data will be sent by TCP driver and the current \r
+ instance will have a graceful close working flow described as RFC 793 if \r
+ AbortOnClose is set to FALSE, otherwise, a rest packet will be sent by TCP \r
+ driver to fast disconnect this connection. When the close operation completes \r
+ successfully the TCP instance is in Tcp4StateClosed state, all pending \r
+ asynchronous operation is signaled and any buffers used for TCP network traffic \r
+ is flushed.\r
+\r
+ @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
+ @param CloseToken Pointer to the close token to return when\r
+ operation finishes.\r
+\r
+ @retval EFI_SUCCESS The operation completed successfully.\r
+ @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been\r
+ configured.\r
+ @retval EFI_ACCESS_DENIED One or more of the following are TRUE: \r
+ * Configure() has been called with TcpConfigData\r
+ set to NULL and this function has not returned.\r
+ * Previous Close() call on this instance has not\r
+ finished.\r
+ @retval EFI_INVALID_PARAMETER One ore more parameters are invalid.\r
+ @retval EFI_OUT_OF_RESOURCES Could not allocate enough resource to finish the\r
+ operation.\r
+ @retval EFI_DEVICE_ERROR Any unexpected and not belonged to above\r
+ category error.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+Tcp4Close (\r
+ IN EFI_TCP4_PROTOCOL *This,\r
+ IN EFI_TCP4_CLOSE_TOKEN *CloseToken\r
+ );\r
+\r
+/**\r
+ Abort an asynchronous connection, listen, transmission or receive request.\r
+\r
+ The Cancel() function aborts a pending connection, listen, transmit or receive \r
+ request. If Token is not NULL and the token is in the connection, listen, \r
+ transmission or receive queue when it is being cancelled, its Token->Status \r
+ will be set to EFI_ABORTED and then Token->Event will be signaled. If the token \r
+ is not in one of the queues, which usually means that the asynchronous operation \r
+ has completed, EFI_NOT_FOUND is returned. If Token is NULL all asynchronous token \r
+ issued by Connect(), Accept(), Transmit() and Receive()will be aborted.\r
+ NOTE: It has not been implemented currently.\r
+ \r
+ @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
+ @param Token Pointer to a token that has been issued by\r
+ Connect(), Accept(), Transmit() or Receive(). If\r
+ NULL, all pending tokens issued by above four\r
+ functions will be aborted.\r
+ \r
+ @retval EFI_SUCCESS The asynchronous I/O request is aborted and Token->Event\r
+ is signaled.\r
+ @retval EFI_INVALID_PARAMETER This is NULL.\r
+ @retval EFI_NOT_STARTED This instance hasn's been configured.\r
+ @retval EFI_NO_MAPPING When using the default address, configuration\r
+ (DHCP, BOOTP,RARP, etc.) hasn's finished yet.\r
+ @retval EFI_NOT_FOUND The asynchronous I/O request isn's found in the \r
+ transmission or receive queue. It has either \r
+ completed or wasn's issued by Transmit() and Receive().\r
+ @retval EFI_UNSUPPORTED The operation is not supported in current\r
+ implementation.\r
+ \r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+Tcp4Cancel (\r
+ IN EFI_TCP4_PROTOCOL *This,\r
+ IN EFI_TCP4_COMPLETION_TOKEN *Token OPTIONAL\r
+ );\r
+\r
+/**\r
+ Poll to receive incoming data and transmit outgoing segments.\r
+\r
+ The Poll() function increases the rate that data is moved between the network \r
+ and application and can be called when the TCP instance is created successfully. \r
+ Its use is optional. In some implementations, the periodical timer in the MNP \r
+ driver may not poll the underlying communications device fast enough to avoid \r
+ drop packets. Drivers and applications that are experiencing packet loss should \r
+ try calling the Poll() function in a high frequency.\r
+\r
+ @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
+\r
+ @retval EFI_SUCCESS Incoming or outgoing data was processed.\r
+ @retval EFI_INVALID_PARAMETER This is NULL.\r
+ @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
+ @retval EFI_NOT_READY No incoming or outgoing data was processed.\r
+ @retval EFI_TIMEOUT Data was dropped out of the transmission or\r
+ receive queue. Consider increasing the polling\r
+ rate.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+Tcp4Poll (\r
+ IN EFI_TCP4_PROTOCOL *This\r
+ );\r
+\r
+#endif\r