]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/Protocol/Tcp6.h
1. import Ip6.h, Ip6Config.h and Tcp6.h.
[mirror_edk2.git] / MdePkg / Include / Protocol / Tcp6.h
diff --git a/MdePkg/Include/Protocol/Tcp6.h b/MdePkg/Include/Protocol/Tcp6.h
new file mode 100644 (file)
index 0000000..d3f5382
--- /dev/null
@@ -0,0 +1,853 @@
+/** @file\r
+  EFI TCPv6(Transmission Control Protocol version 6) Protocol Definition\r
+  The EFI TCPv6 Service Binding Protocol is used to locate EFI TCPv6 Protocol drivers to create\r
+  and destroy child of the driver to communicate with other host using TCP protocol.\r
+  The EFI TCPv6 Protocol provides services to send and receive data stream.\r
+\r
+  Copyright (c) 2008 - 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
+\r
+**/\r
+\r
+#ifndef __EFI_TCP6_PROTOCOL_H__\r
+#define __EFI_TCP6_PROTOCOL_H__\r
+\r
+#include <Protocol/Snp.h>\r
+#include <Protocol/ManagedNetwork.h>\r
+#include <Protocol/Ip6.h>\r
+\r
+#define EFI_TCP6_SERVICE_BINDING_PROTOCOL_GUID \\r
+  { \\r
+    0xec20eb79, 0x6c1a, 0x4664, {0x9a, 0x0d, 0xd2, 0xe4, 0xcc, 0x16, 0xd6, 0x64 } \\r
+  }\r
+\r
+#define EFI_TCP6_PROTOCOL_GUID \\r
+  { \\r
+    0x46e44855, 0xbd60, 0x4ab7, {0xab, 0x0d, 0xa6, 0x79, 0xb9, 0x44, 0x7d, 0x77 } \\r
+  }\r
+\r
+\r
+typedef struct _EFI_TCP6_PROTOCOL EFI_TCP6_PROTOCOL;\r
+\r
+\r
+///\r
+/// EFI_TCP6_SERVICE_POINT\r
+///\r
+typedef struct {\r
+  ///\r
+  /// The EFI TCPv6 Protocol instance handle that is using this \r
+  /// address/port pair.\r
+  ///\r
+  EFI_HANDLE        InstanceHandle;\r
+  /// \r
+  /// The local IPv6 address to which this TCP instance is bound. Set \r
+  /// to 0::/128, if this TCP instance is configured to listen on all \r
+  /// available source addresses.\r
+  /// \r
+  EFI_IPv6_ADDRESS  LocalAddress;\r
+  /// \r
+  /// The local port number in host byte order.\r
+  /// \r
+  UINT16            LocalPort;\r
+  /// \r
+  /// The remote IPv6 address. It may be 0::/128 if this TCP instance is \r
+  /// not connected to any remote host. \r
+  /// \r
+  EFI_IPv6_ADDRESS  RemoteAddress;\r
+  /// \r
+  /// The remote port number in host byte order. It may be zero if this \r
+  /// TCP instance is not connected to any remote host.\r
+  /// \r
+  UINT16            RemotePort;\r
+} EFI_TCP6_SERVICE_POINT;\r
+\r
+/// \r
+/// EFI_TCP6_VARIABLE_DATA\r
+///\r
+typedef struct {\r
+  EFI_HANDLE             DriverHandle; ///< The handle of the driver that creates this entry.\r
+  UINT32                 ServiceCount; ///< The number of address/port pairs following this data structure.\r
+  EFI_TCP6_SERVICE_POINT Services[1];  ///< List of address/port pairs that are currently in use.\r
+} EFI_TCP6_VARIABLE_DATA;\r
+\r
+///\r
+/// EFI_TCP6_ACCESS_POINT\r
+///\r
+typedef struct {\r
+  /// \r
+  /// The local IP address assigned to this TCP instance. The EFI \r
+  /// TCPv6 driver will only deliver incoming packets whose \r
+  /// destination addresses exactly match the IP address. Set to zero to \r
+  /// let the underlying IPv6 driver choose a source address. If not zero \r
+  /// it must be one of the configured IP addresses in the underlying \r
+  /// IPv6 driver.\r
+  /// \r
+  EFI_IPv6_ADDRESS  StationAddress;\r
+  /// \r
+  /// The local port number to which this EFI TCPv6 Protocol instance \r
+  /// is bound. If the instance doesn't care the local port number, set \r
+  /// StationPort to zero to use an ephemeral port.\r
+  /// \r
+  UINT16            StationPort;\r
+  /// \r
+  /// The remote IP address to which this EFI TCPv6 Protocol instance \r
+  /// is connected. If ActiveFlag is FALSE (i.e. a passive TCPv6 \r
+  /// instance), the instance only accepts connections from the \r
+  /// RemoteAddress. If ActiveFlag is TRUE the instance will \r
+  /// connect to the RemoteAddress, i.e., outgoing segments will be \r
+  /// sent to this address and only segments from this address will be \r
+  /// delivered to the application. When ActiveFlag is FALSE, it \r
+  /// can be set to zero and means that incoming connection requests \r
+  /// from any address will be accepted.\r
+  /// \r
+  EFI_IPv6_ADDRESS  RemoteAddress;\r
+  /// \r
+  /// The remote port to which this EFI TCPv6 Protocol instance \r
+  /// connects or from which connection request will be accepted by \r
+  /// this EFI TCPv6 Protocol instance. If ActiveFlag is FALSE it \r
+  /// can be zero and means that incoming connection request from \r
+  /// any port will be accepted. Its value can not be zero when \r
+  /// ActiveFlag is TRUE.\r
+  /// \r
+  UINT16            RemotePort;\r
+  /// \r
+  /// Set it to TRUE to initiate an active open. Set it to FALSE to \r
+  /// initiate a passive open to act as a server.\r
+  /// \r
+  BOOLEAN           ActiveFlag;\r
+} EFI_TCP6_ACCESS_POINT;\r
+\r
+///\r
+/// EFI_TCP6_OPTION\r
+///\r
+typedef struct {\r
+  /// \r
+  /// The size of the TCP receive buffer.\r
+  /// \r
+  UINT32   ReceiveBufferSize;\r
+  /// \r
+  /// The size of the TCP send buffer.\r
+  /// \r
+  UINT32   SendBufferSize;\r
+  /// \r
+  /// The length of incoming connect request queue for a passive \r
+  /// instance. When set to zero, the value is implementation specific.\r
+  /// \r
+  UINT32   MaxSynBackLog;\r
+  /// \r
+  /// The maximum seconds a TCP instance will wait for before a TCP \r
+  /// connection established. When set to zero, the value is \r
+  /// implementation specific.\r
+  /// \r
+  UINT32   ConnectionTimeout;\r
+  ///\r
+  ///The number of times TCP will attempt to retransmit a packet on \r
+  ///an established connection. When set to zero, the value is \r
+  ///implementation specific.\r
+  ///\r
+  UINT32   DataRetries;\r
+  /// \r
+  /// How many seconds to wait in the FIN_WAIT_2 states for a final \r
+  /// FIN flag before the TCP instance is closed. This timeout is in \r
+  /// effective only if the application has called Close() to \r
+  /// disconnect the connection completely. It is also called \r
+  /// FIN_WAIT_2 timer in other implementations. When set to zero, \r
+  /// it should be disabled because the FIN_WAIT_2 timer itself is \r
+  /// against the standard. The default value is 60.\r
+  /// \r
+  UINT32   FinTimeout;\r
+  ///  \r
+  /// How many seconds to wait in TIME_WAIT state before the TCP \r
+  /// instance is closed. The timer is disabled completely to provide a \r
+  /// method to close the TCP connection quickly if it is set to zero. It \r
+  /// is against the related RFC documents.\r
+  /// \r
+  UINT32   TimeWaitTimeout;\r
+  /// \r
+  /// The maximum number of TCP keep-alive probes to send before \r
+  /// giving up and resetting the connection if no response from the \r
+  /// other end. Set to zero to disable keep-alive probe.\r
+  /// \r
+  UINT32   KeepAliveProbes;\r
+  /// \r
+  /// The number of seconds a connection needs to be idle before TCP \r
+  /// sends out periodical keep-alive probes. When set to zero, the \r
+  /// value is implementation specific. It should be ignored if keep-\r
+  /// alive probe is disabled.\r
+  /// \r
+  UINT32   KeepAliveTime;\r
+  /// \r
+  /// The number of seconds between TCP keep-alive probes after the \r
+  /// periodical keep-alive probe if no response. When set to zero, the \r
+  /// value is implementation specific. It should be ignored if keep-\r
+  /// alive probe is disabled.\r
+  /// \r
+  UINT32   KeepAliveInterval;\r
+  /// \r
+  /// Set it to TRUE to enable the Nagle algorithm as defined in \r
+  /// RFC896. Set it to FALSE to disable it.\r
+  /// \r
+  BOOLEAN  EnableNagle;\r
+  /// \r
+  /// Set it to TRUE to enable TCP timestamps option as defined in \r
+  /// RFC1323. Set to FALSE to disable it.\r
+  /// \r
+  BOOLEAN  EnableTimeStamp;\r
+  /// \r
+  /// Set it to TRUE to enable TCP window scale option as defined in \r
+  /// RFC1323. Set it to FALSE to disable it. \r
+  /// \r
+  BOOLEAN  EnableWindowScaling;\r
+  /// \r
+  /// Set it to TRUE to enable selective acknowledge mechanism \r
+  /// described in RFC 2018. Set it to FALSE to disable it. \r
+  /// Implementation that supports SACK can optionally support \r
+  /// DSAK as defined in RFC 2883.\r
+  /// \r
+  BOOLEAN  EnableSelectiveAck;\r
+  /// \r
+  /// Set it to TRUE to enable path MTU discovery as defined in \r
+  /// RFC 1191. Set to FALSE to disable it.\r
+  /// \r
+  BOOLEAN  EnablePathMtuDiscovery;\r
+} EFI_TCP6_OPTION;\r
+\r
+///\r
+/// EFI_TCP6_CONFIG_DATA\r
+///\r
+typedef struct {\r
+  ///\r
+  /// TrafficClass field in transmitted IPv6 packets.\r
+  ///\r
+  UINT8                 TrafficClass;\r
+  ///\r
+  /// HopLimit field in transmitted IPv6 packets.\r
+  ///\r
+  UINT8                 HopLimit;\r
+  ///\r
+  /// Used to specify TCP communication end settings for a TCP instance. \r
+  ///\r
+  EFI_TCP6_ACCESS_POINT AccessPoint;\r
+  ///\r
+  /// Used to configure the advance TCP option for a connection. If set \r
+  /// to NULL, implementation specific options for TCP connection will be used.\r
+  ///\r
+  EFI_TCP6_OPTION       *ControlOption;\r
+} EFI_TCP6_CONFIG_DATA;\r
+\r
+///\r
+/// EFI_TCP6_CONNECTION_STATE\r
+///\r
+typedef enum {\r
+  Tcp6StateClosed      = 0,\r
+  Tcp6StateListen      = 1,\r
+  Tcp6StateSynSent     = 2,\r
+  Tcp6StateSynReceived = 3,\r
+  Tcp6StateEstablished = 4,\r
+  Tcp6StateFinWait1    = 5,\r
+  Tcp6StateFinWait2    = 6,\r
+  Tcp6StateClosing     = 7,\r
+  Tcp6StateTimeWait    = 8,\r
+  Tcp6StateCloseWait   = 9,\r
+  Tcp6StateLastAck     = 10\r
+} EFI_TCP6_CONNECTION_STATE;\r
+\r
+///\r
+/// EFI_TCP6_COMPLETION_TOKEN\r
+/// is used as a common header for various asynchronous tokens. \r
+///\r
+typedef struct {\r
+  ///\r
+  /// The Event to signal after request is finished and Status field is \r
+  /// updated by the EFI TCPv6 Protocol driver. \r
+  /// \r
+  EFI_EVENT   Event;\r
+  ///\r
+  /// The result of the completed operation. \r
+  ///\r
+  EFI_STATUS  Status;\r
+} EFI_TCP6_COMPLETION_TOKEN;\r
+\r
+///\r
+/// EFI_TCP6_CONNECTION_TOKEN\r
+/// will be set if the active open succeeds or an unexpected\r
+/// error happens.\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 Tcp6StateEstablished.\r
+  /// EFI_CONNECTION_RESET:     The connect fails because the connection is reset\r
+  ///                           either by instance itself or the communication peer.\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 times \r
+  ///                           out and some other ICMP error is received.\r
+  /// EFI_DEVICE_ERROR:         An unexpected system or network error occurred.\r
+  /// EFI_SECURITY_VIOLATION:   The active open was failed because of IPSec policy check.\r
+  /// \r
+  EFI_TCP6_COMPLETION_TOKEN CompletionToken;\r
+} EFI_TCP6_CONNECTION_TOKEN;\r
+\r
+///\r
+/// EFI_TCP6_LISTEN_TOKEN\r
+/// returns when list operation finishes.\r
+///\r
+typedef struct {\r
+  ///\r
+  /// The Status in CompletionToken will be set to the \r
+  /// following value if accept finishes:\r
+  /// EFI_SUCCESS:            A remote peer has successfully established a \r
+  ///                         connection to this instance. A new TCP instance has also been \r
+  ///                         created for the connection.\r
+  /// EFI_CONNECTION_RESET:   The accept fails because the connection is reset either\r
+  ///                         by instance itself or communication peer.\r
+  /// EFI_ABORTED:            The accept request has been aborted.\r
+  /// EFI_SECURITY_VIOLATION: The accept operation was failed because of IPSec policy check.\r
+  ///\r
+  EFI_TCP6_COMPLETION_TOKEN CompletionToken;\r
+  EFI_HANDLE                NewChildHandle;\r
+} EFI_TCP6_LISTEN_TOKEN;\r
+\r
+///\r
+/// EFI_TCP6_FRAGMENT_DATA\r
+/// allows multiple receive or transmit buffers to be specified. The \r
+/// purpose of this structure is to provide scattered read and write.\r
+///\r
+typedef struct {\r
+  UINT32 FragmentLength;   ///< Length of data buffer in the fragment.\r
+  VOID   *FragmentBuffer;  ///< Pointer to the data buffer in the fragment.\r
+} EFI_TCP6_FRAGMENT_DATA;\r
+\r
+///\r
+/// EFI_TCP6_RECEIVE_DATA\r
+/// When TCPv6 driver wants to deliver received data to the application, \r
+/// it will pick up the first queued receiving token, update its\r
+/// Token->Packet.RxData then signal the Token->CompletionToken.Event.\r
+///\r
+typedef struct {\r
+  ///\r
+  /// Whether the data is urgent. When this flag is set, the instance is in \r
+  /// urgent mode. \r
+  ///\r
+  BOOLEAN                 UrgentFlag;\r
+  /// \r
+  /// When calling Receive() function, it is the byte counts of all \r
+  /// Fragmentbuffer in FragmentTable allocated by user. \r
+  /// When the token is signaled by TCPv6 driver it is the length of \r
+  /// received data in the fragments.\r
+  /// \r
+  UINT32                  DataLength;\r
+  /// \r
+  /// Number of fragments.\r
+  /// \r
+  UINT32                  FragmentCount;\r
+  /// \r
+  /// An array of fragment descriptors.\r
+  /// \r
+  EFI_TCP6_FRAGMENT_DATA  FragmentTable[1];\r
+} EFI_TCP6_RECEIVE_DATA;\r
+\r
+///\r
+/// EFI_TCP6_TRANSMIT_DATA\r
+/// The EFI TCPv6 Protocol user must fill this data structure before sending a packet.\r
+/// The packet may contain multiple buffers in non-continuous memory locations. \r
+///\r
+typedef struct {\r
+  /// \r
+  /// Push If TRUE, data must be transmitted promptly, and the PUSH bit in \r
+  /// the last TCP segment created will be set. If FALSE, data \r
+  /// transmission may be delayed to combine with data from \r
+  /// subsequent Transmit()s for efficiency.\r
+  /// \r
+  BOOLEAN                 Push;\r
+  /// \r
+  /// The data in the fragment table are urgent and urgent point is in \r
+  /// effect if TRUE. Otherwise those data are NOT considered urgent.\r
+  /// \r
+  BOOLEAN                 Urgent;\r
+  ///\r
+  /// Length of the data in the fragments. \r
+  ///\r
+  UINT32                  DataLength;\r
+  ///\r
+  /// Number of fragments.\r
+  /// \r
+  UINT32                  FragmentCount;\r
+  ///\r
+  /// An array of fragment descriptors.\r
+  ///\r
+  EFI_TCP6_FRAGMENT_DATA  FragmentTable[1];\r
+} EFI_TCP6_TRANSMIT_DATA;\r
+\r
+///\r
+/// EFI_TCP6_IO_TOKEN\r
+/// returns When transmission finishes or meets any unexpected error. \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_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_SECURITY_VIOLATION:   The receiving or transmission \r
+  ///                           operation was failed because of IPSec policy check\r
+  ///\r
+  EFI_TCP6_COMPLETION_TOKEN CompletionToken;\r
+  union {\r
+    ///\r
+    /// When this token is used for receiving, RxData is a pointer to \r
+    /// EFI_TCP6_RECEIVE_DATA.\r
+    ///\r
+    EFI_TCP6_RECEIVE_DATA   *RxData;\r
+    /// \r
+    /// When this token is used for transmitting, TxData is a pointer to \r
+    /// EFI_TCP6_TRANSMIT_DATA.\r
+    ///\r
+    EFI_TCP6_TRANSMIT_DATA  *TxData;\r
+  } Packet;\r
+} EFI_TCP6_IO_TOKEN;\r
+\r
+///\r
+/// EFI_TCP6_CLOSE_TOKEN\r
+/// returns when close operation finishes.\r
+///\r
+typedef struct {\r
+  ///\r
+  /// When close finishes or meets any unexpected error it will be set \r
+  /// to one of the following values:\r
+  /// EFI_SUCCESS:            The close operation completes successfully.\r
+  /// EFI_ABORTED:            User called configure with NULL without close stopping.\r
+  /// EFI_SECURITY_VIOLATION: The close operation was failed because of IPSec policy check.\r
+  /// \r
+  EFI_TCP6_COMPLETION_TOKEN CompletionToken;\r
+  /// \r
+  /// Abort the TCP connection on close instead of the standard TCP \r
+  /// close process when it is set to TRUE. This option can be used to \r
+  /// satisfy a fast disconnect.\r
+  /// \r
+  BOOLEAN                   AbortOnClose;\r
+} EFI_TCP6_CLOSE_TOKEN;\r
+\r
+/**\r
+  Get the current operational status.\r
+        \r
+  The GetModeData() function copies the current operational settings of this EFI TCPv6\r
+  Protocol instance into user-supplied buffers. This function can also be used to retrieve\r
+  the operational setting of underlying drivers such as IPv6, MNP, or SNP.\r
+\r
+  @param[in]  This              Pointer to the EFI_TCP6_PROTOCOL instance.\r
+  @param[out] Tcp6State         The buffer in which the current TCP state is returned.\r
+  @param[out] Tcp6ConfigData    The buffer in which the current TCP configuration is returned. \r
+  @param[out] Ip6ModeData       The buffer in which the current IPv6 configuration data used by \r
+                                the TCP instance is returned. \r
+  @param[out] MnpConfigData     The buffer in which the current MNP configuration data used \r
+                                indirectly by the TCP instance is returned.\r
+  @param[out] SnpModeData       The buffer in which the current SNP mode data used indirectly by \r
+                                the TCP instance is returned.\r
+\r
+  @retval EFI_SUCCESS           The mode data was read.\r
+  @retval EFI_NOT_STARTED       No configuration data is available because this instance hasn't\r
+                                been started.\r
+  @retval EFI_INVALID_PARAMETER This is NULL.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TCP6_GET_MODE_DATA) (\r
+  IN  EFI_TCP6_PROTOCOL                  *This,\r
+  OUT EFI_TCP6_CONNECTION_STATE          *Tcp6State OPTIONAL,\r
+  OUT EFI_TCP6_CONFIG_DATA               *Tcp6ConfigData OPTIONAL,\r
+  OUT EFI_IP6_MODE_DATA                  *Ip6ModeData 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 TCPv6 instance.\r
+\r
+  The Configure() function does the following:\r
+  - Initialize this TCP instance, i.e., initialize the communication end settings and\r
+    specify active open or passive open for an instance.\r
+  - Reset this TCP instance brutally, i.e., cancel all pending asynchronous tokens, flush \r
+    transmission and receiving buffer directly without informing the communication peer.\r
+\r
+  No other TCPv6 Protocol operation except Poll() can be executed by this instance until\r
+  it is configured properly. For an active TCP instance, after a proper configuration it\r
+  may call Connect() to initiates the three-way handshake. For a passive TCP instance, \r
+  its state will transit to Tcp6StateListen after configuration, and Accept() may be \r
+  called to listen the incoming TCP connection requests. If Tcp6ConfigData is set to NULL,\r
+  the instance is reset. Resetting process will be done brutally, the state machine will\r
+  be set to Tcp6StateClosed directly, the receive queue and transmit queue will be flushed,\r
+  and no traffic is allowed through this instance. \r
+\r
+  @param[in] This               Pointer to the EFI_TCP6_PROTOCOL instance.\r
+  @param[in] Tcp6ConfigData     Pointer to the configure data to configure the instance.\r
+                                If Tcp6ConfigData is set to NULL, the instance is reset.\r
+\r
+  @retval EFI_SUCCESS           The operational settings are set, changed, or reset\r
+                                successfully.\r
+  @retval EFI_NO_MAPPING        The underlying IPv6 driver was responsible for choosing a source \r
+                                address for this instance, but no source address was available for \r
+                                use.\r
+  @retval EFI_INVALID_PARAMETER One or more of the following conditions are TRUE:\r
+                                - This is NULL.\r
+                                - Tcp6ConfigData->AccessPoint.StationAddress is neither zero nor \r
+                                  one of the configured IP addresses in the underlying IPv6 driver.\r
+                                - Tcp6ConfigData->AccessPoint.RemoteAddress isn't a valid unicast \r
+                                  IPv6 address.\r
+                                - Tcp6ConfigData->AccessPoint.RemoteAddress is zero or \r
+                                  Tcp6ConfigData->AccessPoint.RemotePort is zero when \r
+                                  Tcp6ConfigData->AccessPoint.ActiveFlag is TRUE.\r
+                                - A same access point has been configured in other TCP \r
+                                  instance properly.\r
+  @retval EFI_ACCESS_DENIED     Configuring TCP instance when it is configured without\r
+                                calling Configure() with NULL to reset it.\r
+  @retval EFI_UNSUPPORTED       One or more of the control options are not supported in\r
+                                the implementation.\r
+  @retval EFI_OUT_OF_RESOURCES  Could not allocate enough system resources when\r
+                                executing Configure().\r
+  @retval EFI_DEVICE_ERROR      An unexpected network or system error occurred.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TCP6_CONFIGURE) (\r
+  IN EFI_TCP6_PROTOCOL        *This,\r
+  IN EFI_TCP6_CONFIG_DATA     *Tcp6ConfigData OPTIONAL\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 or\r
+  fails due to any error, the ConnectionToken->CompletionToken.Event will be signaled\r
+  and ConnectionToken->CompletionToken.Status will be updated accordingly. This \r
+  function can only be called for the TCP instance in Tcp6StateClosed state. The \r
+  instance will transfer into Tcp6StateSynSent if the function returns EFI_SUCCESS. \r
+  If TCP three-way handshake succeeds, its state will become Tcp6StateEstablished,\r
+  otherwise, the state will return to Tcp6StateClosed.\r
+\r
+  @param[in] This                Pointer to the EFI_TCP6_PROTOCOL instance.\r
+  @param[in] ConnectionToken     Pointer to the connection token to return when the TCP three\r
+                                 way handshake finishes.\r
+\r
+  @retval EFI_SUCCESS            The connection request is successfully initiated and the state of \r
+                                 this TCP instance has been changed to Tcp6StateSynSent.\r
+  @retval EFI_NOT_STARTED        This EFI TCPv6 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 instance is not in Tcp6StateClosed state.\r
+  @retval EFI_INVALID_PARAMETER  One or more of the following are TRUE:\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 active open.\r
+  @retval EFI_DEVICE_ERROR       An unexpected system or network error occurred.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TCP6_CONNECT) (\r
+  IN EFI_TCP6_PROTOCOL           *This,\r
+  IN EFI_TCP6_CONNECTION_TOKEN   *ConnectionToken\r
+  );\r
+\r
+/**\r
+  Listen on the passive instance to accept an incoming connection request. This is a \r
+  nonblocking operation.\r
\r
+  The Accept() function initiates an asynchronous accept request to wait for an incoming \r
+  connection on the passive TCP instance. If a remote peer successfully establishes a \r
+  connection with this instance, a new TCP instance will be created and its handle will\r
+  be returned in ListenToken->NewChildHandle. The newly created instance is configured\r
+  by inheriting the passive instance's configuration and is ready for use upon return.\r
+  The new instance is in the Tcp6StateEstablished state.\r
+\r
+  The ListenToken->CompletionToken.Event will be signaled when a new connection is \r
+  accepted, user aborts the listen or connection is reset. \r
+\r
+  This function only can be called when current TCP instance is in Tcp6StateListen state. \r
+\r
+  @param[in] This                Pointer to the EFI_TCP6_PROTOCOL instance.\r
+  @param[in] ListenToken         Pointer to the listen token to return when operation finishes.\r
+                                 \r
+                                 \r
+  @retval EFI_SUCCESS            The listen token has been queued successfully.\r
+  @retval EFI_NOT_STARTED        This EFI TCPv6 Protocol instance has not been configured.\r
+  @retval EFI_ACCESS_DENIED      One or more of the following are TRUE:\r
+                                 - This instance is not a passive instance.\r
+                                 - This instance is not in Tcp6StateListen state.\r
+                                 - The same listen token has already existed in the listen\r
+                                   token queue of this TCP instance.\r
+  @retval EFI_INVALID_PARAMETER  One or more of the following are TRUE:\r
+                                 - This is NULL.\r
+                                 - ListenToken is NULL.\r
+                                 - ListentToken->CompletionToken.Event is NULL.\r
+  @retval EFI_OUT_OF_RESOURCES   Could not allocate enough resource to finish the operation.\r
+  @retval EFI_DEVICE_ERROR       Any unexpected and not belonged to above category error.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TCP6_ACCEPT) (\r
+  IN EFI_TCP6_PROTOCOL             *This,\r
+  IN EFI_TCP6_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 TCP instance along with the\r
+  user data. The status of the token is updated and the event in the token will be \r
+  signaled once the data is sent out or some error occurs.\r
+\r
+  @param[in] This                 Pointer to the EFI_TCP6_PROTOCOL instance.\r
+  @param[in] Token                Pointer to the completion token to queue to the transmit queue.\r
+\r
+  @retval EFI_SUCCESS             The data has been queued for transmission.\r
+  @retval EFI_NOT_STARTED         This EFI TCPv6 Protocol instance has not been configured.\r
+  @retval EFI_NO_MAPPING          The underlying IPv6 driver was responsible for choosing a \r
+                                  source address for this instance, but no source address was \r
+                                  available for use.\r
+  @retval EFI_INVALID_PARAMETER   One or more of the following are TRUE:\r
+                                  - This is NULL.\r
+                                  - Token is NULL.\r
+                                  - Token->CompletionToken.Event is NULL.\r
+                                  - Token->Packet.TxData is NULL.\r
+                                  - Token->Packet.FragmentCount is zero.\r
+                                  - Token->Packet.DataLength is not equal to the sum of fragment lengths.\r
+  @retval EFI_ACCESS_DENIED       One or more of the following conditions are TRUE:\r
+                                  - A transmit completion token with the same Token-> \r
+                                    CompletionToken.Event was already in the \r
+                                    transmission queue.\r
+                                  - The current instance is in Tcp6StateClosed state.\r
+                                  - The current instance is a passive one and it is in \r
+                                    Tcp6StateListen state.\r
+                                  - User has called Close() to disconnect this connection.\r
+  @retval EFI_NOT_READY           The completion token could not be queued because the\r
+                                  transmit queue is full.\r
+  @retval EFI_OUT_OF_RESOURCES    Could not queue the transmit data because of resource\r
+                                  shortage.\r
+  @retval EFI_NETWORK_UNREACHABLE There is no route to the destination network or address.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TCP6_TRANSMIT) (\r
+  IN EFI_TCP6_PROTOCOL            *This,\r
+  IN EFI_TCP6_IO_TOKEN            *Token\r
+  );\r
+\r
+/**\r
+  Places an asynchronous receive request into the receiving queue.\r
+\r
+  The Receive() function places a completion token into the receive packet queue. This \r
+  function is always asynchronous. The caller must allocate the Token->CompletionToken.Event\r
+  and the FragmentBuffer used to receive data. The caller also must fill the DataLength which \r
+  represents the whole length of all FragmentBuffer. When the receive operation completes, the \r
+  EFI TCPv6 Protocol driver updates the Token->CompletionToken.Status and Token->Packet.RxData\r
+  fields and the Token->CompletionToken.Event is signaled. If got data the data and its length\r
+  will be copied into the FragmentTable, at the same time the full length of received data will\r
+  be recorded in the DataLength fields. Providing a proper notification function and context\r
+  for the event will enable the user to receive the notification and receiving status. That \r
+  notification function is guaranteed to not be re-entered.\r
+\r
+  @param[in] This               Pointer to the EFI_TCP6_PROTOCOL instance.\r
+  @param[in] Token              Pointer to a token that is associated with the receive data\r
+                                descriptor.\r
+\r
+  @retval EFI_SUCCESS            The receive completion token was cached.\r
+  @retval EFI_NOT_STARTED        This EFI TCPv6 Protocol instance has not been configured.\r
+  @retval EFI_NO_MAPPING         The underlying IPv6 driver was responsible for choosing a source \r
+                                 address for this instance, but no source address was available for use.\r
+  @retval EFI_INVALID_PARAMETER  One or more of the following conditions is TRUE:\r
+                                 - This is NULL.\r
+                                 - Token is NULL.\r
+                                 - Token->CompletionToken.Event is NULL.\r
+                                 - Token->Packet.RxData is NULL.\r
+                                 - Token->Packet.RxData->DataLength is 0.\r
+                                 - The Token->Packet.RxData->DataLength is not the \r
+                                   sum of all FragmentBuffer length in FragmentTable.\r
+  @retval EFI_OUT_OF_RESOURCES   The receive completion token could not be queued due to a lack of\r
+                                 system resources (usually memory).\r
+  @retval EFI_DEVICE_ERROR       An unexpected system or network error occurred. \r
+                                 The EFI TCPv6 Protocol instance has been reset 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 Token->CompletionToken.Event\r
+                                   was already in the receive queue.\r
+                                 - The current instance is in Tcp6StateClosed state.\r
+                                 - The current instance is a passive one and it is in \r
+                                   Tcp6StateListen state.\r
+                                 - User has called Close() to disconnect this connection.\r
+  @retval EFI_CONNECTION_FIN     The communication peer has closed the connection and there is no \r
+                                 any buffered data in the receive buffer of this instance\r
+  @retval EFI_NOT_READY          The receive request could not be queued because the receive queue is full.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TCP6_RECEIVE) (\r
+  IN EFI_TCP6_PROTOCOL           *This,\r
+  IN EFI_TCP6_IO_TOKEN           *Token\r
+  );\r
+\r
+/**\r
+  Disconnecting a TCP connection gracefully or reset a TCP connection. This function is a\r
+  nonblocking operation.\r
+\r
+  Initiate an asynchronous close token to TCP driver. After Close() is called, any buffered \r
+  transmission data will be sent by TCP driver and the current instance will have a graceful close \r
+  working flow described as RFC 793 if AbortOnClose is set to FALSE, otherwise, a rest packet \r
+  will be sent by TCP driver to fast disconnect this connection. When the close operation completes \r
+  successfully the TCP instance is in Tcp6StateClosed state, all pending asynchronous \r
+  operations are signaled and any buffers used for TCP network traffic are flushed.\r
+\r
+  @param[in] This                Pointer to the EFI_TCP6_PROTOCOL instance.\r
+  @param[in] CloseToken          Pointer to the close token to return when operation finishes.\r
+                                 \r
+  @retval EFI_SUCCESS            The Close() is called successfully.\r
+  @retval EFI_NOT_STARTED        This EFI TCPv6 Protocol instance has not been configured.\r
+  @retval EFI_ACCESS_DENIED      One or more of the following are TRUE:\r
+                                 - CloseToken or CloseToken->CompletionToken.Event is already in use.\r
+                                 - Previous Close() call on this instance has not finished.\r
+  @retval EFI_INVALID_PARAMETER  One or more of the following are TRUE:\r
+                                 - This is NULL.\r
+                                 - CloseToken is NULL.\r
+                                 - CloseToken->CompletionToken.Event is NULL.\r
+  @retval EFI_OUT_OF_RESOURCES   Could not allocate enough resource to finish the operation.\r
+  @retval EFI_DEVICE_ERROR       Any unexpected and not belonged to above category error.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TCP6_CLOSE) (\r
+  IN EFI_TCP6_PROTOCOL           *This,\r
+  IN EFI_TCP6_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 \r
+  receive request.\r
+\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
+\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
+\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_PROTOCOL.Connect(),\r
+                                 EFI_TCP6_PROTOCOL.Accept(),\r
+                                 EFI_TCP6_PROTOCOL.Transmit() or\r
+                                 EFI_TCP6_PROTOCOL.Receive(). If NULL, all pending\r
+                                 tokens issued by above four functions will be aborted. Type\r
+                                 EFI_TCP6_COMPLETION_TOKEN is defined in\r
+                                 EFI_TCP_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_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
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TCP6_CANCEL) (\r
+  IN EFI_TCP6_PROTOCOL           *This,\r
+  IN EFI_TCP6_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.\r
+\r
+  @param[in] This                Pointer to the EFI_TCP6_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 is processed.\r
+  @retval EFI_TIMEOUT            Data was dropped out of the transmission or receive queue.\r
+                                 Consider increasing the polling rate.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TCP6_POLL) (\r
+  IN EFI_TCP6_PROTOCOL        *This\r
+  );\r
+\r
+///\r
+/// EFI_TCP6_PROTOCOL \r
+/// defines the EFI TCPv6 Protocol child to be used by any network drivers or\r
+/// applications to send or receive data stream. It can either listen on a \r
+/// specified port as a service or actively connect to remote peer as a client.\r
+/// Each instance has its own independent settings. \r
+///\r
+typedef struct _EFI_TCP6_PROTOCOL {\r
+  EFI_TCP6_GET_MODE_DATA  GetModeData;\r
+  EFI_TCP6_CONFIGURE      Configure;\r
+  EFI_TCP6_CONNECT        Connect;\r
+  EFI_TCP6_ACCEPT         Accept;\r
+  EFI_TCP6_TRANSMIT       Transmit;\r
+  EFI_TCP6_RECEIVE        Receive;\r
+  EFI_TCP6_CLOSE          Close;\r
+  EFI_TCP6_CANCEL         Cancel;\r
+  EFI_TCP6_POLL           Poll;\r
+} EFI_TCP6_PROTOCOL;\r
+\r
+extern EFI_GUID gEfiTcp6ServiceBindingProtocolGuid;\r
+extern EFI_GUID gEfiTcp6ProtocolGuid;\r
+\r
+#endif\r
+\r