/** @file\r
Implementation of EFI_TCP4_PROTOCOL and EFI_TCP6_PROTOCOL.\r
\r
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
+ (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>\r
+ Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
UINT32 Len;\r
\r
for (Index = 0, Len = 0; Index < FragmentCount; Index++) {\r
+ if (FragmentTable[Index].FragmentBuffer == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
Len = Len + FragmentTable[Index].FragmentLength;\r
}\r
\r
if (NULL != TcpConfigData) {\r
\r
CopyMem (&Ip, &TcpConfigData->AccessPoint.RemoteAddress, sizeof (IP4_ADDR));\r
- if ((Ip != 0) && !NetIp4IsUnicast (NTOHL (Ip), 0)) {\r
+ if (IP4_IS_LOCAL_BROADCAST (NTOHL (Ip))) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
\r
CopyMem (&Ip, &TcpConfigData->AccessPoint.StationAddress, sizeof (IP4_ADDR));\r
CopyMem (&SubnetMask, &TcpConfigData->AccessPoint.SubnetMask, sizeof (IP4_ADDR));\r
- if (!NetIp4IsUnicast (NTOHL (Ip), 0) || !IP4_IS_VALID_NETMASK (NTOHL (SubnetMask))) {\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
Abort an asynchronous connection, listen, transmission or receive request.\r
\r
- @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.\r
- @param[in] Token Pointer to a token that has been issued by\r
- Connect(), Accept(), Transmit() or Receive(). If\r
- NULL, all pending tokens issued by the four\r
- functions listed above will be aborted.\r
-\r
- @retval EFI_UNSUPPORTED The operation is not supported in the current\r
- implementation.\r
+ @param This The pointer to the EFI_TCP4_PROTOCOL instance.\r
+ @param Token The pointer to a token that has been issued by\r
+ EFI_TCP4_PROTOCOL.Connect(),\r
+ EFI_TCP4_PROTOCOL.Accept(),\r
+ EFI_TCP4_PROTOCOL.Transmit() or\r
+ EFI_TCP4_PROTOCOL.Receive(). If NULL, all pending\r
+ tokens issued by above four functions will be aborted. Type\r
+ EFI_TCP4_COMPLETION_TOKEN is defined in\r
+ EFI_TCP4_PROTOCOL.Connect().\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't been configured.\r
+ @retval EFI_NO_MAPPING When using the default address, configuration\r
+ (DHCP, BOOTP,RARP, etc.) hasn't finished yet.\r
+ @retval EFI_NOT_FOUND The asynchronous I/O request isn't found in the\r
+ transmission or receive queue. It has either\r
+ completed or wasn't issued by Transmit() and Receive().\r
\r
**/\r
EFI_STATUS\r
IN EFI_TCP4_COMPLETION_TOKEN *Token OPTIONAL\r
)\r
{\r
- return EFI_UNSUPPORTED;\r
+ SOCKET *Sock;\r
+\r
+ if (NULL == This) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ Sock = SOCK_FROM_THIS (This);\r
+\r
+ return SockCancel (Sock, Token);\r
}\r
\r
/**\r
}\r
\r
/**\r
- Abort an asynchronous connection, listen, transmission, or receive request.\r
+ Abort an asynchronous connection, listen, transmission or receive request.\r
\r
- The Cancel() function aborts a pending connection, listen, transmit, or\r
+ The Cancel() function aborts a pending connection, listen, transmit or\r
receive request.\r
\r
- If Token is not NULL and the token is in the connection, listen, transmission,\r
+ If Token is not NULL and the token is in the connection, listen, transmission\r
or receive queue when it is being cancelled, its Token->Status will be set\r
- to EFI_ABORTED, and then Token->Event will be signaled.\r
+ to EFI_ABORTED and then Token->Event will be signaled.\r
\r
If the token is not in one of the queues, which usually means that the\r
asynchronous operation has completed, EFI_NOT_FOUND is returned.\r
\r
If Token is NULL all asynchronous token issued by Connect(), Accept(),\r
- Transmit(), and Receive() will be aborted.\r
+ Transmit() and Receive() will be aborted.\r
\r
@param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.\r
@param[in] Token Pointer to a token that has been issued by\r
EFI_TCP6_COMPLETION_TOKEN is defined in\r
EFI_TCP_PROTOCOL.Connect().\r
\r
- @retval EFI_UNSUPPORTED The implementation does not support this function.\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't been configured.\r
+ @retval EFI_NOT_FOUND The asynchronous I/O request isn't found in the transmission or\r
+ receive queue. It has either completed or wasn't issued by\r
+ Transmit() and Receive().\r
\r
**/\r
EFI_STATUS\r
IN EFI_TCP6_COMPLETION_TOKEN *Token OPTIONAL\r
)\r
{\r
- return EFI_UNSUPPORTED;\r
+ SOCKET *Sock;\r
+\r
+ if (NULL == This) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ Sock = SOCK_FROM_THIS (This);\r
+\r
+ return SockCancel (Sock, Token);\r
}\r
\r
/**\r