/** @file\r
- EFI TCPv4 Protocol Definition\r
+ EFI TCPv4(Transmission Control Protocol version 4) Protocol Definition\r
The EFI TCPv4 Service Binding Protocol is used to locate EFI TCPv4 Protocol drivers to create\r
- and destroy child of the driver to communicate with other host using TCP protocol. \r
- The EFI TCPv4 Protocol provides services to send and receive data stream. \r
+ and destroy child of the driver to communicate with other host using TCP protocol.\r
+ The EFI TCPv4 Protocol provides services to send and receive data stream.\r
\r
- Copyright (c) 2006, Intel Corporation \r
- All rights reserved. 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 \r
+ Copyright (c) 2006 - 2009, Intel Corporation\r
+ All rights reserved. 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\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
+ 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
- Module Name: Tcp4.h\r
+ @par Revision Reference: \r
+ This Protocol is introduced in UEFI Specification 2.0\r
\r
**/\r
\r
#ifndef __EFI_TCP4_PROTOCOL_H__\r
#define __EFI_TCP4_PROTOCOL_H__\r
\r
+#include <Protocol/Ip4.h>\r
+\r
#define EFI_TCP4_SERVICE_BINDING_PROTOCOL_GUID \\r
{ \\r
0x00720665, 0x67EB, 0x4a99, {0xBA, 0xF7, 0xD3, 0xC3, 0x3A, 0x1C, 0x7C, 0xC9 } \\r
typedef struct _EFI_TCP4_PROTOCOL EFI_TCP4_PROTOCOL;\r
\r
typedef struct {\r
+ EFI_HANDLE InstanceHandle;\r
EFI_IPv4_ADDRESS LocalAddress;\r
UINT16 LocalPort;\r
EFI_IPv4_ADDRESS RemoteAddress;\r
\r
typedef struct {\r
EFI_HANDLE DriverHandle;\r
- UINTN ServiceCount;\r
+ UINT32 ServiceCount;\r
EFI_TCP4_SERVICE_POINT Services[1];\r
} EFI_TCP4_VARIABLE_DATA;\r
\r
} EFI_TCP4_ACCESS_POINT;\r
\r
typedef struct {\r
- UINTN ReceiveBufferSize;\r
- UINTN SendBufferSize;\r
- UINTN MaxSynBackLog;\r
- UINTN ConnectionTimeout;\r
- UINTN DataRetries;\r
- UINTN FinTimeout;\r
- UINTN TimeWaitTimeout;\r
- UINTN KeepAliveProbes;\r
- UINTN KeepAliveTime;\r
- UINTN KeepAliveInterval;\r
+ UINT32 ReceiveBufferSize;\r
+ UINT32 SendBufferSize;\r
+ UINT32 MaxSynBackLog;\r
+ UINT32 ConnectionTimeout;\r
+ UINT32 DataRetries;\r
+ UINT32 FinTimeout;\r
+ UINT32 TimeWaitTimeout;\r
+ UINT32 KeepAliveProbes;\r
+ UINT32 KeepAliveTime;\r
+ UINT32 KeepAliveInterval;\r
BOOLEAN EnableNagle;\r
BOOLEAN EnableTimeStamp;\r
BOOLEAN EnableWindowScaling;\r
// Access Point\r
//\r
EFI_TCP4_ACCESS_POINT AccessPoint;\r
- \r
- // \r
- // TCP Control Options \r
- // \r
+\r
+ //\r
+ // TCP Control Options\r
+ //\r
EFI_TCP4_OPTION *ControlOption;\r
} EFI_TCP4_CONFIG_DATA;\r
\r
+///\r
+/// TCP4 connnection state\r
+///\r
typedef enum {\r
Tcp4StateClosed = 0,\r
Tcp4StateListen = 1,\r
} EFI_TCP4_COMPLETION_TOKEN;\r
\r
typedef struct {\r
+ ///\r
+ /// The Status in the CompletionToken will be set to one of \r
+ /// the following values if the active open succeeds or an unexpected \r
+ /// error happens:\r
+ /// EFI_SUCCESS: The active open succeeds and the instance's \r
+ /// state is Tcp4StateEstablished.\r
+ /// EFI_CONNECTION_RESET: The connect fails because the connection is reset\r
+ /// either by instance itself or the communication peer.\r
+ /// EFI_CONNECTION_REFUSED: The connect fails because this connection is initiated with\r
+ /// an active open and the connection is refused.\r
+ /// Note: It is not defined in UEFI 2.3 Specification.\r
+ /// EFI_ABORTED: The active open is aborted.\r
+ /// EFI_TIMEOUT: The connection establishment timer expires and \r
+ /// no more specific information is available.\r
+ /// EFI_NETWORK_UNREACHABLE: The active open fails because \r
+ /// an ICMP network unreachable error is received. \r
+ /// EFI_HOST_UNREACHABLE: The active open fails because an \r
+ /// ICMP host unreachable error is received. \r
+ /// EFI_PROTOCOL_UNREACHABLE: The active open fails \r
+ /// because an ICMP protocol unreachable error is received.\r
+ /// EFI_PORT_UNREACHABLE: The connection establishment \r
+ /// timer times out and an ICMP port unreachable error is received.\r
+ /// EFI_ICMP_ERROR: The connection establishment timer timeout and some other ICMP\r
+ /// error is received.\r
+ /// EFI_DEVICE_ERROR: An unexpected system or network error occurred.\r
+ /// \r
EFI_TCP4_COMPLETION_TOKEN CompletionToken;\r
} EFI_TCP4_CONNECTION_TOKEN;\r
\r
} EFI_TCP4_LISTEN_TOKEN;\r
\r
typedef struct {\r
- UINTN FragmentLength;\r
- VOID *FragmentBuffer;\r
+ UINT32 FragmentLength;\r
+ VOID *FragmentBuffer;\r
} EFI_TCP4_FRAGMENT_DATA;\r
\r
typedef struct {\r
BOOLEAN UrgentFlag;\r
- IN OUT UINTN DataLength;\r
- UINTN FragmentCount;\r
+ UINT32 DataLength;\r
+ UINT32 FragmentCount;\r
EFI_TCP4_FRAGMENT_DATA FragmentTable[1];\r
-} EFI_TCP4_RECEIVE_DATA; \r
+} EFI_TCP4_RECEIVE_DATA;\r
\r
-typedef struct { \r
+typedef struct {\r
BOOLEAN Push;\r
BOOLEAN Urgent;\r
- UINTN DataLength;\r
- UINTN FragmentCount;\r
+ UINT32 DataLength;\r
+ UINT32 FragmentCount;\r
EFI_TCP4_FRAGMENT_DATA FragmentTable[1];\r
} EFI_TCP4_TRANSMIT_DATA;\r
\r
typedef struct {\r
+ /// \r
+ /// When transmission finishes or meets any unexpected error it will \r
+ /// be set to one of the following values:\r
+ /// EFI_SUCCESS: The receiving or transmission operation \r
+ /// completes successfully.\r
+ /// EFI_CONNECTION_FIN: The receiving operation fails because the communication peer \r
+ /// has closed the connection and there is no more data in the \r
+ /// receive buffer of the instance.\r
+ /// Note: It is not defined in UEFI 2.3 Specification.\r
+ /// EFI_CONNECTION_RESET: The receiving or transmission operation fails\r
+ /// because this connection is reset either by instance \r
+ /// itself or the communication peer.\r
+ /// EFI_ABORTED: The receiving or transmission is aborted.\r
+ /// EFI_TIMEOUT: The transmission timer expires and no more \r
+ /// specific information is available.\r
+ /// EFI_NETWORK_UNREACHABLE: The transmission fails \r
+ /// because an ICMP network unreachable error is received. \r
+ /// EFI_HOST_UNREACHABLE: The transmission fails because an \r
+ /// ICMP host unreachable error is received. \r
+ /// EFI_PROTOCOL_UNREACHABLE: The transmission fails \r
+ /// because an ICMP protocol unreachable error is received. \r
+ /// EFI_PORT_UNREACHABLE: The transmission fails and an \r
+ /// ICMP port unreachable error is received. \r
+ /// EFI_ICMP_ERROR: The transmission fails and some other \r
+ /// ICMP error is received. \r
+ /// EFI_DEVICE_ERROR: An unexpected system or network error occurs.\r
+ /// EFI_NO_MEDIA: There was a media error.\r
+ ///\r
EFI_TCP4_COMPLETION_TOKEN CompletionToken;\r
union {\r
+ ///\r
+ /// When this token is used for receiving, RxData is a pointer to EFI_TCP4_RECEIVE_DATA.\r
+ ///\r
EFI_TCP4_RECEIVE_DATA *RxData;\r
+ ///\r
+ /// When this token is used for transmitting, TxData is a pointer to EFI_TCP4_TRANSMIT_DATA.\r
+ ///\r
EFI_TCP4_TRANSMIT_DATA *TxData;\r
} Packet;\r
} EFI_TCP4_IO_TOKEN;\r
\r
@retval EFI_SUCCESS The mode data was read.\r
@retval EFI_INVALID_PARAMETER This is NULL.\r
- @retval EFI_NOT_STARTED No configuration data is available because this instance hasn¡¯t\r
+ @retval EFI_NOT_STARTED No configuration data is available because this instance hasn't\r
been started.\r
\r
**/\r
typedef\r
EFI_STATUS\r
-(EFIAPI *EFI_TCP4_GET_MODE_DATA) (\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
+(EFIAPI *EFI_TCP4_GET_MODE_DATA)(\r
+ IN CONST 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
Initialize or brutally reset the operational parameters for this EFI TCPv4 instance.\r
\r
**/\r
typedef\r
EFI_STATUS\r
-(EFIAPI *EFI_TCP4_CONFIGURE) (\r
+(EFIAPI *EFI_TCP4_CONFIGURE)(\r
IN EFI_TCP4_PROTOCOL *This,\r
IN EFI_TCP4_CONFIG_DATA *TcpConfigData OPTIONAL\r
- )\r
-;\r
- \r
+ );\r
+\r
\r
/**\r
Add or delete a route entry to the route table\r
**/\r
typedef\r
EFI_STATUS\r
-(EFIAPI *EFI_TCP4_ROUTES) (\r
+(EFIAPI *EFI_TCP4_ROUTES)(\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
\r
/**\r
Initiate a nonblocking TCP connection request for an active TCP instance.\r
@param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
@param ConnectionToken Pointer to the connection token to return when the TCP three\r
way handshake finishes.\r
- \r
+\r
@retval EFI_SUCCESS The connection request is successfully initiated and the state\r
- - of this TCPv4 instance has been changed to\r
- - Tcp4StateSynSent.\r
+ of this TCPv4 instance has been changed to Tcp4StateSynSent.\r
@retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.\r
@retval EFI_ACCESS_DENIED One or more of the following conditions are TRUE:\r
- This instance is not configured as an active one.\r
- This is NULL.\r
- ConnectionToken is NULL.\r
- ConnectionToken->CompletionToken.Event is NULL.\r
- @retval EFI_OUT_OF_RESOURCES The driver can¡¯t allocate enough resource to initiate the activeopen.\r
+ @retval EFI_OUT_OF_RESOURCES The driver can't allocate enough resource to initiate the activ eopen.\r
@retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
\r
**/\r
typedef\r
EFI_STATUS\r
-(EFIAPI *EFI_TCP4_CONNECT) (\r
+(EFIAPI *EFI_TCP4_CONNECT)(\r
IN EFI_TCP4_PROTOCOL *This,\r
IN EFI_TCP4_CONNECTION_TOKEN *ConnectionToken\r
- )\r
-; \r
- \r
+ );\r
+\r
\r
/**\r
Listen on the passive instance to accept an incoming connection request. This is a nonblocking operation.\r
**/\r
typedef\r
EFI_STATUS\r
-(EFIAPI *EFI_TCP4_ACCEPT) (\r
+(EFIAPI *EFI_TCP4_ACCEPT)(\r
IN EFI_TCP4_PROTOCOL *This,\r
IN EFI_TCP4_LISTEN_TOKEN *ListenToken\r
- )\r
-; \r
+ );\r
\r
/**\r
Queues outgoing data into the transmit queue.\r
**/\r
typedef\r
EFI_STATUS\r
-(EFIAPI *EFI_TCP4_TRANSMIT) (\r
+(EFIAPI *EFI_TCP4_TRANSMIT)(\r
IN EFI_TCP4_PROTOCOL *This,\r
IN EFI_TCP4_IO_TOKEN *Token\r
- )\r
-; \r
+ );\r
\r
\r
/**\r
**/\r
typedef\r
EFI_STATUS\r
-(EFIAPI *EFI_TCP4_RECEIVE) (\r
+(EFIAPI *EFI_TCP4_RECEIVE)(\r
IN EFI_TCP4_PROTOCOL *This,\r
IN EFI_TCP4_IO_TOKEN *Token\r
- )\r
-; \r
- \r
+ );\r
+\r
/**\r
Disconnecting a TCP connection gracefully or reset a TCP connection. This function is a\r
- nonblocking operation. \r
+ nonblocking operation.\r
\r
@param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
@param CloseToken Pointer to the close token to return when operation finishes.\r
**/\r
typedef\r
EFI_STATUS\r
-(EFIAPI *EFI_TCP4_CLOSE) (\r
+(EFIAPI *EFI_TCP4_CLOSE)(\r
IN EFI_TCP4_PROTOCOL *This,\r
IN EFI_TCP4_CLOSE_TOKEN *CloseToken\r
- )\r
-; \r
+ );\r
\r
/**\r
Abort an asynchronous connection, listen, transmission or receive request.\r
EFI_TCP4_COMPLETION_TOKEN is defined in\r
EFI_TCP4_PROTOCOL.Connect().\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 is processed.\r
- @retval EFI_TIMEOUT Data was dropped out of the transmission or receive queue.\r
- Consider increasing the polling rate.\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
+ @retval EFI_UNSUPPORTED The implementation does not support this function.\r
+ Note: It is not defined in UEFI 2.3 Specification.\r
\r
**/\r
typedef\r
EFI_STATUS\r
-(EFIAPI *EFI_TCP4_CANCEL) (\r
+(EFIAPI *EFI_TCP4_CANCEL)(\r
IN EFI_TCP4_PROTOCOL *This,\r
IN EFI_TCP4_COMPLETION_TOKEN *Token OPTIONAL\r
- )\r
-; \r
+ );\r
\r
\r
/**\r
**/\r
typedef\r
EFI_STATUS\r
-(EFIAPI *EFI_TCP4_POLL) (\r
+(EFIAPI *EFI_TCP4_POLL)(\r
IN EFI_TCP4_PROTOCOL *This\r
- )\r
-; \r
-\r
+ );\r
+\r
+///\r
+/// The EFI_TCP4_PROTOCOL defines the EFI TCPv4 Protocol child to be used by \r
+/// any network drivers or applications to send or receive data stream. \r
+/// It can either listen on a specified port as a service or actively connected \r
+/// to remote peer as a client. Each instance has its own independent settings, \r
+/// such as the routing table.\r
+///\r
struct _EFI_TCP4_PROTOCOL {\r
EFI_TCP4_GET_MODE_DATA GetModeData;\r
EFI_TCP4_CONFIGURE Configure;\r
EFI_TCP4_POLL Poll;\r
};\r
\r
-#define EFI_CONNECTION_FIN EFIERR (104)\r
-#define EFI_CONNECTION_RESET EFIERR (105)\r
-#define EFI_CONNECTION_REFUSED EFIERR (106)\r
-\r
extern EFI_GUID gEfiTcp4ServiceBindingProtocolGuid;\r
extern EFI_GUID gEfiTcp4ProtocolGuid;\r
\r