This library is used to share code between UEFI network stack modules.\r
It provides the helper routines to access TCP service.\r
\r
-Copyright (c) 2010 - 2011, 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<BR>\r
-http://opensource.org/licenses/bsd-license.php\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
-**/
-
-#ifndef _TCP_IO_H_
+Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#ifndef _TCP_IO_H_\r
#define _TCP_IO_H_\r
\r
\r
#include <Protocol/Tcp4.h>\r
#include <Protocol/Tcp6.h>\r
\r
-#include <Library/NetLib.h>
+#include <Library/NetLib.h>\r
\r
#define TCP_VERSION_4 IP_VERSION_4\r
#define TCP_VERSION_6 IP_VERSION_6\r
\r
-///
-/// 10 seconds
-///
+///\r
+/// 10 seconds\r
+///\r
#define TCP_GET_MAPPING_TIMEOUT 100000000U\r
\r
\r
EFI_IPv4_ADDRESS RemoteIp;\r
UINT16 RemotePort;\r
BOOLEAN ActiveFlag;\r
-} TCP4_IO_CONFIG_DATA;
+} TCP4_IO_CONFIG_DATA;\r
\r
-typedef struct {
+typedef struct {\r
UINT16 StationPort;\r
EFI_IPv6_ADDRESS RemoteIp;\r
- UINT16 RemotePort;
+ UINT16 RemotePort;\r
BOOLEAN ActiveFlag;\r
} TCP6_IO_CONFIG_DATA;\r
\r
EFI_HANDLE Image;\r
EFI_HANDLE Controller;\r
EFI_HANDLE Handle;\r
- \r
+\r
TCP_IO_PROTOCOL Tcp;\r
TCP_IO_PROTOCOL NewTcp;\r
TCP_IO_CONNECTION_TOKEN ConnToken;\r
TCP_IO_IO_TOKEN RxToken;\r
TCP_IO_CLOSE_TOKEN CloseToken;\r
TCP_IO_LISTEN_TOKEN ListenToken;\r
- \r
+\r
BOOLEAN IsConnDone;\r
BOOLEAN IsTxDone;\r
BOOLEAN IsRxDone;\r
} TCP_IO;\r
\r
/**\r
- Create a TCP socket with the specified configuration data. \r
+ Create a TCP socket with the specified configuration data.\r
\r
@param[in] Image The handle of the driver image.\r
@param[in] Controller The handle of the controller.\r
@param[in] TcpVersion The version of Tcp, TCP_VERSION_4 or TCP_VERSION_6.\r
@param[in] ConfigData The Tcp configuration data.\r
@param[out] TcpIo The TcpIo.\r
- \r
+\r
@retval EFI_SUCCESS The TCP socket is created and configured.\r
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
- @retval EFI_UNSUPPORTED One or more of the control options are not
+ @retval EFI_UNSUPPORTED One or more of the control options are not\r
supported in the implementation.\r
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
@retval Others Failed to create the TCP socket or configure it.\r
**/\r
EFI_STATUS\r
EFIAPI\r
-TcpIoCreateSocket (
- IN EFI_HANDLE Image,
+TcpIoCreateSocket (\r
+ IN EFI_HANDLE Image,\r
IN EFI_HANDLE Controller,\r
- IN UINT8 TcpVersion,
- IN TCP_IO_CONFIG_DATA *ConfigData,
- OUT TCP_IO *TcpIo
- );
-
-/**
- Destroy the socket.
-
- @param[in] TcpIo The TcpIo which wraps the socket to be destroyed.
-
-**/
-VOID
+ IN UINT8 TcpVersion,\r
+ IN TCP_IO_CONFIG_DATA *ConfigData,\r
+ OUT TCP_IO *TcpIo\r
+ );\r
+\r
+/**\r
+ Destroy the socket.\r
+\r
+ @param[in] TcpIo The TcpIo which wraps the socket to be destroyed.\r
+\r
+**/\r
+VOID\r
EFIAPI\r
-TcpIoDestroySocket (
- IN TCP_IO *TcpIo
- );
-
+TcpIoDestroySocket (\r
+ IN TCP_IO *TcpIo\r
+ );\r
+\r
/**\r
Connect to the other endpoint of the TCP socket.\r
\r
@param[in, out] TcpIo The TcpIo wrapping the TCP socket.\r
- @param[in] Timeout The time to wait for connection done.\r
- \r
+ @param[in] Timeout The time to wait for connection done. Set to NULL for infinite wait.\r
+\r
@retval EFI_SUCCESS Connect to the other endpoint of the TCP socket\r
successfully.\r
@retval EFI_TIMEOUT Failed to connect to the other endpoint of the\r
@retval Others Other errors as indicated.\r
\r
**/\r
-EFI_STATUS
+EFI_STATUS\r
EFIAPI\r
-TcpIoConnect (
- IN OUT TCP_IO *TcpIo,
- IN EFI_EVENT Timeout
- );
+TcpIoConnect (\r
+ IN OUT TCP_IO *TcpIo,\r
+ IN EFI_EVENT Timeout OPTIONAL\r
+ );\r
\r
/**\r
Accept the incomding request from the other endpoint of the TCP socket.\r
\r
@param[in, out] TcpIo The TcpIo wrapping the TCP socket.\r
- @param[in] Timeout The time to wait for connection done.\r
+ @param[in] Timeout The time to wait for connection done. Set to NULL for infinite wait.\r
+\r
\r
- \r
@retval EFI_SUCCESS Connect to the other endpoint of the TCP socket\r
successfully.\r
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
EFIAPI\r
TcpIoAccept (\r
IN OUT TCP_IO *TcpIo,\r
- IN EFI_EVENT Timeout\r
+ IN EFI_EVENT Timeout OPTIONAL\r
);\r
-
-/**
- Reset the socket.
-
- @param[in, out] TcpIo The TcpIo wrapping the TCP socket.
-
-**/
-VOID
+\r
+/**\r
+ Reset the socket.\r
+\r
+ @param[in, out] TcpIo The TcpIo wrapping the TCP socket.\r
+\r
+**/\r
+VOID\r
EFIAPI\r
-TcpIoReset (
- IN OUT TCP_IO *TcpIo
- );
-
+TcpIoReset (\r
+ IN OUT TCP_IO *TcpIo\r
+ );\r
+\r
/**\r
Transmit the Packet to the other endpoint of the socket.\r
\r
@param[in] TcpIo The TcpIo wrapping the TCP socket.\r
@param[in] Packet The packet to transmit.\r
- \r
+\r
@retval EFI_SUCCESS The packet is trasmitted.\r
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
@retval EFI_UNSUPPORTED One or more of the control options are not\r
@retval Others Other errors as indicated.\r
\r
**/\r
-EFI_STATUS
+EFI_STATUS\r
EFIAPI\r
-TcpIoTransmit (
- IN TCP_IO *TcpIo,
- IN NET_BUF *Packet
- );
-
+TcpIoTransmit (\r
+ IN TCP_IO *TcpIo,\r
+ IN NET_BUF *Packet\r
+ );\r
+\r
/**\r
Receive data from the socket.\r
\r
@param[in] Packet The buffer to hold the data copy from the socket rx buffer.\r
@param[in] AsyncMode Is this receive asyncronous or not.\r
@param[in] Timeout The time to wait for receiving the amount of data the Packet\r
- can hold.\r
+ can hold. Set to NULL for infinite wait.\r
\r
@retval EFI_SUCCESS The required amount of data is received from the socket.\r
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
@retval Others Other errors as indicated.\r
\r
**/\r
-EFI_STATUS
+EFI_STATUS\r
EFIAPI\r
-TcpIoReceive (
- IN OUT TCP_IO *TcpIo,
- IN NET_BUF *Packet,
- IN BOOLEAN AsyncMode,
- IN EFI_EVENT Timeout
- );
+TcpIoReceive (\r
+ IN OUT TCP_IO *TcpIo,\r
+ IN NET_BUF *Packet,\r
+ IN BOOLEAN AsyncMode,\r
+ IN EFI_EVENT Timeout OPTIONAL\r
+ );\r
\r
#endif\r
\r