]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Main.c
MdeModulePkg: Delete Tcp4Dxe in MdeModulePkg.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Tcp4Dxe / Tcp4Main.c
diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Main.c b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Main.c
deleted file mode 100644 (file)
index d8fc68c..0000000
+++ /dev/null
@@ -1,674 +0,0 @@
-/** @file\r
-  Implementation of TCP4 protocol services.\r
-\r
-Copyright (c) 2005 - 2018, 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
-\r
-#include "Tcp4Main.h"\r
-\r
-\r
-/**\r
-  Check the integrity of the data buffer.\r
-\r
-  @param  DataLen                  The total length of the data buffer.\r
-  @param  FragmentCount            The fragment count of the fragment table.\r
-  @param  FragmentTable            Pointer to the fragment table of the data\r
-                                   buffer.\r
-\r
-  @retval EFI_SUCCESS              The integrity check is passed.\r
-  @retval EFI_INVALID_PARAMETER    The integrity check is failed.\r
-\r
-**/\r
-EFI_STATUS\r
-Tcp4ChkDataBuf (\r
-  IN UINT32                 DataLen,\r
-  IN UINT32                 FragmentCount,\r
-  IN EFI_TCP4_FRAGMENT_DATA *FragmentTable\r
-  )\r
-{\r
-  UINT32 Index;\r
-\r
-  UINT32 Len;\r
-\r
-  for (Index = 0, Len = 0; Index < FragmentCount; Index++) {\r
-    Len = Len + (UINT32) FragmentTable[Index].FragmentLength;\r
-  }\r
-\r
-  if (DataLen != Len) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-\r
-/**\r
-  Get the current operational status.\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
-  TCP4_MODE_DATA  TcpMode;\r
-  SOCKET          *Sock;\r
-\r
-  if (NULL == This) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  Sock                    = SOCK_FROM_THIS (This);\r
-\r
-  TcpMode.Tcp4State       = Tcp4State;\r
-  TcpMode.Tcp4ConfigData  = Tcp4ConfigData;\r
-  TcpMode.Ip4ModeData     = Ip4ModeData;\r
-  TcpMode.MnpConfigData   = MnpConfigData;\r
-  TcpMode.SnpModeData     = SnpModeData;\r
-\r
-  return SockGetMode (Sock, &TcpMode);\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
-  EFI_TCP4_OPTION  *Option;\r
-  SOCKET           *Sock;\r
-  EFI_STATUS       Status;\r
-  IP4_ADDR         Ip;\r
-  IP4_ADDR         SubnetMask;\r
-\r
-  if (NULL == This) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  //\r
-  // Tcp protocol related parameter check will be conducted here\r
-  //\r
-  if (NULL != TcpConfigData) {\r
-\r
-    CopyMem (&Ip, &TcpConfigData->AccessPoint.RemoteAddress, sizeof (IP4_ADDR));\r
-    if (IP4_IS_LOCAL_BROADCAST (NTOHL (Ip))) {\r
-      return EFI_INVALID_PARAMETER;\r
-    }\r
-\r
-    if (TcpConfigData->AccessPoint.ActiveFlag &&\r
-      (0 == TcpConfigData->AccessPoint.RemotePort || (Ip == 0))) {\r
-      return EFI_INVALID_PARAMETER;\r
-    }\r
-\r
-    if (!TcpConfigData->AccessPoint.UseDefaultAddress) {\r
-\r
-      CopyMem (&Ip, &TcpConfigData->AccessPoint.StationAddress, sizeof (IP4_ADDR));\r
-      CopyMem (&SubnetMask, &TcpConfigData->AccessPoint.SubnetMask, sizeof (IP4_ADDR));\r
-      if (!IP4_IS_VALID_NETMASK (NTOHL (SubnetMask)) ||\r
-          (SubnetMask != 0 && !NetIp4IsUnicast (NTOHL (Ip), NTOHL (SubnetMask)))) {\r
-        return EFI_INVALID_PARAMETER;\r
-      }\r
-    }\r
-\r
-    Option = TcpConfigData->ControlOption;\r
-    if ((NULL != Option) &&\r
-        (Option->EnableSelectiveAck || Option->EnablePathMtuDiscovery)) {\r
-      return EFI_UNSUPPORTED;\r
-    }\r
-  }\r
-\r
-  Sock = SOCK_FROM_THIS (This);\r
-\r
-  if (NULL == TcpConfigData) {\r
-    return SockFlush (Sock);\r
-  }\r
-\r
-  Status = SockConfigure (Sock, TcpConfigData);\r
-\r
-  if (EFI_NO_MAPPING == Status) {\r
-    Sock->ConfigureState = SO_NO_MAPPING;\r
-  }\r
-\r
-  return Status;\r
-}\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
-  SOCKET          *Sock;\r
-  TCP4_ROUTE_INFO RouteInfo;\r
-\r
-  if (NULL == This) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  Sock                      = SOCK_FROM_THIS (This);\r
-\r
-  RouteInfo.DeleteRoute     = DeleteRoute;\r
-  RouteInfo.SubnetAddress   = SubnetAddress;\r
-  RouteInfo.SubnetMask      = SubnetMask;\r
-  RouteInfo.GatewayAddress  = GatewayAddress;\r
-\r
-  return SockRoute (Sock, &RouteInfo);\r
-}\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
-  SOCKET  *Sock;\r
-\r
-  if (NULL == This ||\r
-      NULL == ConnectionToken ||\r
-      NULL == ConnectionToken->CompletionToken.Event) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  Sock = SOCK_FROM_THIS (This);\r
-\r
-  return SockConnect (Sock, ConnectionToken);\r
-}\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
-  SOCKET  *Sock;\r
-\r
-  if (NULL == This ||\r
-      NULL == ListenToken ||\r
-      NULL == ListenToken->CompletionToken.Event) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  Sock = SOCK_FROM_THIS (This);\r
-\r
-  return SockAccept (Sock, ListenToken);\r
-}\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
-  SOCKET      *Sock;\r
-  EFI_STATUS  Status;\r
-\r
-  if (NULL == This ||\r
-      NULL == Token ||\r
-      NULL == Token->CompletionToken.Event ||\r
-      NULL == Token->Packet.TxData ||\r
-      0 == Token->Packet.TxData->FragmentCount ||\r
-      0 == Token->Packet.TxData->DataLength\r
-      ) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  Status = Tcp4ChkDataBuf (\r
-            (UINT32) Token->Packet.TxData->DataLength,\r
-            (UINT32) Token->Packet.TxData->FragmentCount,\r
-            Token->Packet.TxData->FragmentTable\r
-            );\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
-  }\r
-\r
-  Sock = SOCK_FROM_THIS (This);\r
-\r
-  return SockSend (Sock, Token);\r
-\r
-}\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
-  SOCKET      *Sock;\r
-  EFI_STATUS  Status;\r
-\r
-  if (NULL == This ||\r
-      NULL == Token ||\r
-      NULL == Token->CompletionToken.Event ||\r
-      NULL == Token->Packet.RxData ||\r
-      0 == Token->Packet.RxData->FragmentCount ||\r
-      0 == Token->Packet.RxData->DataLength\r
-      ) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  Status = Tcp4ChkDataBuf (\r
-            (UINT32) Token->Packet.RxData->DataLength,\r
-            (UINT32) Token->Packet.RxData->FragmentCount,\r
-            Token->Packet.RxData->FragmentTable\r
-            );\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
-  }\r
-\r
-  Sock = SOCK_FROM_THIS (This);\r
-\r
-  return SockRcv (Sock, Token);\r
-\r
-}\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
-  SOCKET  *Sock;\r
-\r
-  if (NULL == This ||\r
-      NULL == CloseToken ||\r
-      NULL == CloseToken->CompletionToken.Event) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  Sock = SOCK_FROM_THIS (This);\r
-\r
-  return SockClose (Sock, CloseToken, CloseToken->AbortOnClose);\r
-}\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
-  return EFI_UNSUPPORTED;\r
-}\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
-  SOCKET      *Sock;\r
-  EFI_STATUS  Status;\r
-\r
-  if (NULL == This) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  Sock    = SOCK_FROM_THIS (This);\r
-\r
-  Status  = Sock->ProtoHandler (Sock, SOCK_POLL, NULL);\r
-\r
-  return Status;\r
-}\r