2 Declaration of protocol interfaces in EFI_TCP4_PROTOCOL and EFI_TCP6_PROTOCOL.
3 It is the common head file for all Tcp*.c in TCP driver.
5 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
7 This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php.
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
20 #include <Protocol/ServiceBinding.h>
21 #include <Protocol/DriverBinding.h>
22 #include <Library/IpIoLib.h>
23 #include <Library/DevicePathLib.h>
24 #include <Library/PrintLib.h>
28 #include "TcpDriver.h"
31 extern UINT16 mTcp4RandomPort
;
32 extern UINT16 mTcp6RandomPort
;
33 extern CHAR16
*mTcpStateName
[];
34 extern EFI_COMPONENT_NAME_PROTOCOL gTcpComponentName
;
35 extern EFI_COMPONENT_NAME2_PROTOCOL gTcpComponentName2
;
36 extern EFI_UNICODE_STRING_TABLE
*gTcpControllerNameTable
;
38 extern LIST_ENTRY mTcpRunQue
;
39 extern LIST_ENTRY mTcpListenQue
;
40 extern TCP_SEQNO mTcpGlobalIss
;
41 extern UINT32 mTcpTick
;
46 #define TCP6_KEEP_NEIGHBOR_TIME 30
48 /// 5 seconds, since 1 tick equals 200ms.
50 #define TCP6_REFRESH_NEIGHBOR_TICK 25
52 #define TCP_EXPIRE_TIME 65535
55 /// The implementation selects the initial send sequence number and the unit to
56 /// be added when it is increased.
58 #define TCP_BASE_ISS 0x4d7e980b
59 #define TCP_ISS_INCREMENT_1 2048
60 #define TCP_ISS_INCREMENT_2 100
63 EFI_TCP4_CONFIG_DATA Tcp4CfgData
;
64 EFI_TCP6_CONFIG_DATA Tcp6CfgData
;
68 EFI_TCP4_ACCESS_POINT Tcp4Ap
;
69 EFI_TCP6_ACCESS_POINT Tcp6Ap
;
72 typedef struct _TCP4_MODE_DATA
{
73 EFI_TCP4_CONNECTION_STATE
*Tcp4State
;
74 EFI_TCP4_CONFIG_DATA
*Tcp4ConfigData
;
75 EFI_IP4_MODE_DATA
*Ip4ModeData
;
76 EFI_MANAGED_NETWORK_CONFIG_DATA
*MnpConfigData
;
77 EFI_SIMPLE_NETWORK_MODE
*SnpModeData
;
80 typedef struct _TCP6_MODE_DATA
{
81 EFI_TCP6_CONNECTION_STATE
*Tcp6State
;
82 EFI_TCP6_CONFIG_DATA
*Tcp6ConfigData
;
83 EFI_IP6_MODE_DATA
*Ip6ModeData
;
84 EFI_MANAGED_NETWORK_CONFIG_DATA
*MnpConfigData
;
85 EFI_SIMPLE_NETWORK_MODE
*SnpModeData
;
88 typedef struct _TCP4_ROUTE_INFO
{
90 EFI_IPv4_ADDRESS
*SubnetAddress
;
91 EFI_IPv4_ADDRESS
*SubnetMask
;
92 EFI_IPv4_ADDRESS
*GatewayAddress
;
96 EFI_SERVICE_BINDING_PROTOCOL
*ServiceBinding
;
97 UINTN NumberOfChildren
;
98 EFI_HANDLE
*ChildHandleBuffer
;
99 } TCP_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT
;
102 // EFI_TCP4_PROTOCOL definitions.
106 Get the current operational status.
108 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.
109 @param[out] Tcp4State Pointer to the buffer to receive the current TCP
110 state. Optional parameter that may be NULL.
111 @param[out] Tcp4ConfigData Pointer to the buffer to receive the current TCP
112 configuration. Optional parameter that may be NULL.
113 @param[out] Ip4ModeData Pointer to the buffer to receive the current
114 IPv4 configuration. Optional parameter that may be NULL.
115 @param[out] MnpConfigData Pointer to the buffer to receive the current MNP
116 configuration data indirectly used by the TCPv4
117 Instance. Optional parameter that may be NULL.
118 @param[out] SnpModeData Pointer to the buffer to receive the current SNP
119 configuration data indirectly used by the TCPv4
120 Instance. Optional parameter that may be NULL.
122 @retval EFI_SUCCESS The mode data was read.
123 @retval EFI_NOT_STARTED No configuration data is available because this
124 instance hasn't been started.
125 @retval EFI_INVALID_PARAMETER This is NULL.
131 IN EFI_TCP4_PROTOCOL
*This
,
132 OUT EFI_TCP4_CONNECTION_STATE
*Tcp4State OPTIONAL
,
133 OUT EFI_TCP4_CONFIG_DATA
*Tcp4ConfigData OPTIONAL
,
134 OUT EFI_IP4_MODE_DATA
*Ip4ModeData OPTIONAL
,
135 OUT EFI_MANAGED_NETWORK_CONFIG_DATA
*MnpConfigData OPTIONAL
,
136 OUT EFI_SIMPLE_NETWORK_MODE
*SnpModeData OPTIONAL
140 Initialize or brutally reset the operational parameters for
141 this EFI TCPv4 instance.
143 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.
144 @param[in] TcpConfigData Pointer to the configure data to configure the
145 instance. Optional parameter that may be NULL.
147 @retval EFI_SUCCESS The operational settings are set, changed, or
149 @retval EFI_NO_MAPPING When using a default address, configuration
150 (through DHCP, BOOTP, RARP, etc.) is not
152 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
153 @retval EFI_ACCESS_DENIED Configuring the TCP instance when it is already
155 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.
156 @retval EFI_UNSUPPORTED One or more of the control options are not
157 supported in the implementation.
158 @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources.
164 IN EFI_TCP4_PROTOCOL
* This
,
165 IN EFI_TCP4_CONFIG_DATA
* TcpConfigData OPTIONAL
169 Add or delete routing entries.
171 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.
172 @param[in] DeleteRoute If TRUE, delete the specified route from routing
173 table; if FALSE, add the specified route to
175 @param[in] SubnetAddress The destination network.
176 @param[in] SubnetMask The subnet mask for the destination network.
177 @param[in] GatewayAddress The gateway address for this route.
179 @retval EFI_SUCCESS The operation completed successfully.
180 @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance has not been
182 @retval EFI_NO_MAPPING When using a default address, configuration
183 (through DHCP, BOOTP, RARP, etc.) is not
185 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
186 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to add the
187 entry to the routing table.
188 @retval EFI_NOT_FOUND This route is not in the routing table.
189 @retval EFI_ACCESS_DENIED This route is already in the routing table.
190 @retval EFI_UNSUPPORTED The TCP driver does not support this operation.
196 IN EFI_TCP4_PROTOCOL
*This
,
197 IN BOOLEAN DeleteRoute
,
198 IN EFI_IPv4_ADDRESS
*SubnetAddress
,
199 IN EFI_IPv4_ADDRESS
*SubnetMask
,
200 IN EFI_IPv4_ADDRESS
*GatewayAddress
204 Initiate a nonblocking TCP connection request for an active TCP instance.
206 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.
207 @param[in] ConnectionToken Pointer to the connection token to return when
208 the TCP three way handshake finishes.
210 @retval EFI_SUCCESS The connection request is successfully
212 @retval EFI_NOT_STARTED This EFI_TCP4_PROTOCOL instance hasn't been
214 @retval EFI_ACCESS_DENIED The instance is not configured as an active one
215 or it is not in Tcp4StateClosed state.
216 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
217 @retval EFI_OUT_OF_RESOURCES The driver can't allocate enough resources to
218 initiate the active open.
219 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
225 IN EFI_TCP4_PROTOCOL
*This
,
226 IN EFI_TCP4_CONNECTION_TOKEN
*ConnectionToken
230 Listen on the passive instance to accept an incoming connection request.
232 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.
233 @param[in] ListenToken Pointer to the listen token to return when
236 @retval EFI_SUCCESS The listen token has been queued successfully.
237 @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been
239 @retval EFI_ACCESS_DENIED The instatnce is not a passive one or it is not
240 in Tcp4StateListen state, or a same listen token
241 has already existed in the listen token queue of
243 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
244 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to finish
246 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
252 IN EFI_TCP4_PROTOCOL
*This
,
253 IN EFI_TCP4_LISTEN_TOKEN
*ListenToken
257 Queues outgoing data into the transmit queue
259 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance
260 @param[in] Token Pointer to the completion token to queue to the
263 @retval EFI_SUCCESS The data has been queued for transmission
264 @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been
266 @retval EFI_NO_MAPPING When using a default address, configuration
267 (DHCP, BOOTP, RARP, etc.) is not finished yet.
268 @retval EFI_INVALID_PARAMETER One or more parameters are invalid
269 @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:
270 * A transmit completion token with the same
271 Token-> CompletionToken.Event was already in the
272 transmission queue. * The current instance is in
273 Tcp4StateClosed state * The current instance is
274 a passive one and it is in Tcp4StateListen
275 state. * User has called Close() to disconnect
277 @retval EFI_NOT_READY The completion token could not be queued because
278 the transmit queue is full.
279 @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data because of a
281 @retval EFI_NETWORK_UNREACHABLE There is no route to the destination network or
288 IN EFI_TCP4_PROTOCOL
*This
,
289 IN EFI_TCP4_IO_TOKEN
*Token
293 Place an asynchronous receive request into the receiving queue.
295 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.
296 @param[in] Token Pointer to a token that is associated with the
297 receive data descriptor.
299 @retval EFI_SUCCESS The receive completion token was cached.
300 @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been
302 @retval EFI_NO_MAPPING When using a default address, configuration
303 (DHCP, BOOTP, RARP, etc.) is not finished yet.
304 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
305 @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued
306 due to a lack of system resources.
307 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
308 @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:
309 * A receive completion token with the same
310 Token->CompletionToken.Event was already in the
311 receive queue. * The current instance is in
312 Tcp4StateClosed state. * The current instance is
313 a passive one and it is in Tcp4StateListen
314 state. * User has called Close() to disconnect
316 @retval EFI_CONNECTION_FIN The communication peer has closed the connection
317 and there is no buffered data in the receive
318 buffer of this instance.
319 @retval EFI_NOT_READY The receive request could not be queued because
320 the receive queue is full.
326 IN EFI_TCP4_PROTOCOL
*This
,
327 IN EFI_TCP4_IO_TOKEN
*Token
331 Disconnecting a TCP connection gracefully or reset a TCP connection.
333 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.
334 @param[in] CloseToken Pointer to the close token to return when
337 @retval EFI_SUCCESS The operation completed successfully.
338 @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been
340 @retval EFI_ACCESS_DENIED One or more of the following are TRUE: *
341 Configure() has been called with TcpConfigData
342 set to NULL and this function has not returned.
343 * Previous Close() call on this instance has not
345 @retval EFI_INVALID_PARAMETER One ore more parameters are invalid.
346 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to finish the
348 @retval EFI_DEVICE_ERROR Any unexpected error not belonging to the error
349 categories given above.
355 IN EFI_TCP4_PROTOCOL
*This
,
356 IN EFI_TCP4_CLOSE_TOKEN
*CloseToken
360 Abort an asynchronous connection, listen, transmission or receive request.
362 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.
363 @param[in] Token Pointer to a token that has been issued by
364 Connect(), Accept(), Transmit() or Receive(). If
365 NULL, all pending tokens issued by the above four
366 functions will be aborted.
368 @retval EFI_UNSUPPORTED The operation is not supported in the current
375 IN EFI_TCP4_PROTOCOL
*This
,
376 IN EFI_TCP4_COMPLETION_TOKEN
*Token OPTIONAL
380 Poll to receive incoming data and transmit outgoing segments.
382 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.
384 @retval EFI_SUCCESS Incoming or outgoing data was processed.
385 @retval EFI_INVALID_PARAMETER This is NULL.
386 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
387 @retval EFI_NOT_READY No incoming or outgoing data was processed.
388 @retval EFI_TIMEOUT Data was dropped out of the transmission or
389 receive queue. Consider increasing the polling
396 IN EFI_TCP4_PROTOCOL
*This
400 // EFI_TCP6_PROTOCOL definitions.
404 Get the current operational status.
406 The GetModeData() function copies the current operational settings of this EFI TCPv6
407 Protocol instance into user-supplied buffers. This function can also be used to retrieve
408 the operational setting of underlying drivers such as IPv6, MNP, or SNP.
410 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.
411 @param[out] Tcp6State The buffer in which the current TCP state is
412 returned. Optional parameter that may be NULL.
413 @param[out] Tcp6ConfigData The buffer in which the current TCP configuration
414 is returned. Optional parameter that may be NULL.
415 @param[out] Ip6ModeData The buffer in which the current IPv6 configuration
416 data used by the TCP instance is returned.
417 Optional parameter that may be NULL.
418 @param[out] MnpConfigData The buffer in which the current MNP configuration
419 data used indirectly by the TCP instance is returned.
420 Optional parameter that may be NULL.
421 @param[out] SnpModeData The buffer in which the current SNP mode data
422 used indirectly by the TCP instance is returned.
423 Optional parameter that may be NULL.
425 @retval EFI_SUCCESS The mode data was read.
426 @retval EFI_NOT_STARTED No configuration data is available because this instance hasn't
428 @retval EFI_INVALID_PARAMETER This is NULL.
434 IN EFI_TCP6_PROTOCOL
*This
,
435 OUT EFI_TCP6_CONNECTION_STATE
*Tcp6State OPTIONAL
,
436 OUT EFI_TCP6_CONFIG_DATA
*Tcp6ConfigData OPTIONAL
,
437 OUT EFI_IP6_MODE_DATA
*Ip6ModeData OPTIONAL
,
438 OUT EFI_MANAGED_NETWORK_CONFIG_DATA
*MnpConfigData OPTIONAL
,
439 OUT EFI_SIMPLE_NETWORK_MODE
*SnpModeData OPTIONAL
443 Initialize or brutally reset the operational parameters for this EFI TCPv6 instance.
445 The Configure() function does the following:
446 - Initialize this TCP instance, i.e., initialize the communication end settings and
447 specify active open or passive open for an instance.
448 - Reset this TCP instance brutally, i.e., cancel all pending asynchronous tokens, flush
449 transmission and receiving buffer directly without informing the communication peer.
451 No other TCPv6 Protocol operation except Poll() can be executed by this instance until
452 it is configured properly. For an active TCP instance, after a proper configuration it
453 may call Connect() to initiates the three-way handshake. For a passive TCP instance,
454 its state will transit to Tcp6StateListen after configuration, and Accept() may be
455 called to listen the incoming TCP connection requests. If Tcp6ConfigData is set to NULL,
456 the instance is reset. Resetting process will be done brutally, the state machine will
457 be set to Tcp6StateClosed directly, the receive queue and transmit queue will be flushed,
458 and no traffic is allowed through this instance.
460 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.
461 @param[in] Tcp6ConfigData Pointer to the configure data to configure the instance.
462 If Tcp6ConfigData is set to NULL, the instance is reset.
464 @retval EFI_SUCCESS The operational settings were set, changed, or reset
466 @retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a source
467 address for this instance, but no source address was available for
469 @retval EFI_INVALID_PARAMETER One or more of the following conditions are TRUE:
471 - Tcp6ConfigData->AccessPoint.StationAddress is neither zero nor
472 one of the configured IP addresses in the underlying IPv6 driver.
473 - Tcp6ConfigData->AccessPoint.RemoteAddress isn't a valid unicast
475 - Tcp6ConfigData->AccessPoint.RemoteAddress is zero or
476 Tcp6ConfigData->AccessPoint.RemotePort is zero when
477 Tcp6ConfigData->AccessPoint.ActiveFlag is TRUE.
478 - A same access point has been configured in other TCP
480 @retval EFI_ACCESS_DENIED Configuring TCP instance when it is configured without
481 calling Configure() with NULL to reset it.
482 @retval EFI_UNSUPPORTED One or more of the control options are not supported in
484 @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources when
485 executing Configure().
486 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.
492 IN EFI_TCP6_PROTOCOL
*This
,
493 IN EFI_TCP6_CONFIG_DATA
*Tcp6ConfigData OPTIONAL
497 Initiate a nonblocking TCP connection request for an active TCP instance.
499 The Connect() function will initiate an active open to the remote peer configured
500 in current TCP instance if it is configured active. If the connection succeeds or
501 fails due to an error, the ConnectionToken->CompletionToken.Event will be signaled,
502 and ConnectionToken->CompletionToken.Status will be updated accordingly. This
503 function can only be called for the TCP instance in Tcp6StateClosed state. The
504 instance will transfer into Tcp6StateSynSent if the function returns EFI_SUCCESS.
505 If TCP three-way handshake succeeds, its state will become Tcp6StateEstablished;
506 otherwise, the state will return to Tcp6StateClosed.
508 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.
509 @param[in] ConnectionToken Pointer to the connection token to return when the TCP
510 three-way handshake finishes.
512 @retval EFI_SUCCESS The connection request successfully initiated and the state of
513 this TCP instance has been changed to Tcp6StateSynSent.
514 @retval EFI_NOT_STARTED This EFI TCPv6 Protocol instance has not been configured.
515 @retval EFI_ACCESS_DENIED One or more of the following conditions are TRUE:
516 - This instance is not configured as an active instance.
517 - This instance is not in Tcp6StateClosed state.
518 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
520 - ConnectionToken is NULL.
521 - ConnectionToken->CompletionToken.Event is NULL.
522 @retval EFI_OUT_OF_RESOURCES The driver can't allocate enough resources to initiate the active open.
523 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
529 IN EFI_TCP6_PROTOCOL
*This
,
530 IN EFI_TCP6_CONNECTION_TOKEN
*ConnectionToken
534 Listen on the passive instance to accept an incoming connection request. This is a
535 nonblocking operation.
537 The Accept() function initiates an asynchronous accept request to wait for an incoming
538 connection on the passive TCP instance. If a remote peer successfully establishes a
539 connection with this instance, a new TCP instance will be created and its handle will
540 be returned in ListenToken->NewChildHandle. The newly created instance is configured
541 by inheriting the passive instance's configuration, and is ready for use upon return.
542 The new instance is in the Tcp6StateEstablished state.
544 The ListenToken->CompletionToken.Event will be signaled when a new connection is
545 accepted, user aborts the listen or connection is reset.
547 This function only can be called when the current TCP instance is in Tcp6StateListen state.
549 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.
550 @param[in] ListenToken Pointer to the listen token to return when the operation finishes.
553 @retval EFI_SUCCESS The listen token was been queued successfully.
554 @retval EFI_NOT_STARTED This EFI TCPv6 Protocol instance has not been configured.
555 @retval EFI_ACCESS_DENIED One or more of the following are TRUE:
556 - This instance is not a passive instance.
557 - This instance is not in Tcp6StateListen state.
558 - The same listen token has already existed in the listen
559 token queue of this TCP instance.
560 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
562 - ListenToken is NULL.
563 - ListentToken->CompletionToken.Event is NULL.
564 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to finish the operation.
565 @retval EFI_DEVICE_ERROR Any unexpected error not belonging to the error
566 categories given above.
572 IN EFI_TCP6_PROTOCOL
*This
,
573 IN EFI_TCP6_LISTEN_TOKEN
*ListenToken
577 Queues outgoing data into the transmit queue.
579 The Transmit() function queues a sending request to this TCP instance along with the
580 user data. The status of the token is updated and the event in the token will be
581 signaled once the data is sent out or some error occurs.
583 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.
584 @param[in] Token Pointer to the completion token to queue to the transmit queue.
586 @retval EFI_SUCCESS The data has been queued for transmission.
587 @retval EFI_NOT_STARTED This EFI TCPv6 Protocol instance has not been configured.
588 @retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a
589 source address for this instance, but no source address was
591 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
594 - Token->CompletionToken.Event is NULL.
595 - Token->Packet.TxData is NULL.
596 - Token->Packet.FragmentCount is zero.
597 - Token->Packet.DataLength is not equal to the sum of fragment lengths.
598 @retval EFI_ACCESS_DENIED One or more of the following conditions are TRUE:
599 - A transmit completion token with the same Token->
600 CompletionToken.Event was already in the
602 - The current instance is in Tcp6StateClosed state.
603 - The current instance is a passive one and it is in
604 Tcp6StateListen state.
605 - User has called Close() to disconnect this connection.
606 @retval EFI_NOT_READY The completion token could not be queued because the
607 transmit queue is full.
608 @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data because of a resource
610 @retval EFI_NETWORK_UNREACHABLE There is no route to the destination network or address.
616 IN EFI_TCP6_PROTOCOL
*This
,
617 IN EFI_TCP6_IO_TOKEN
*Token
621 Places an asynchronous receive request into the receiving queue.
623 The Receive() function places a completion token into the receive packet queue. This
624 function is always asynchronous. The caller must allocate the Token->CompletionToken.Event
625 and the FragmentBuffer used to receive data. The caller also must fill the DataLength, which
626 represents the whole length of all FragmentBuffer. When the receive operation completes, the
627 EFI TCPv6 Protocol driver updates the Token->CompletionToken.Status and Token->Packet.RxData
628 fields, and the Token->CompletionToken.Event is signaled. If data is obtained, the data and its length
629 will be copied into the FragmentTable. At the same time the full length of received data will
630 be recorded in the DataLength fields. Providing a proper notification function and context
631 for the event enables the user to receive the notification and receiving status. That
632 notification function is guaranteed to not be re-entered.
634 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.
635 @param[in] Token Pointer to a token that is associated with the receive data
638 @retval EFI_SUCCESS The receive completion token was cached.
639 @retval EFI_NOT_STARTED This EFI TCPv6 Protocol instance has not been configured.
640 @retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a source
641 address for this instance, but no source address was available for use.
642 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
645 - Token->CompletionToken.Event is NULL.
646 - Token->Packet.RxData is NULL.
647 - Token->Packet.RxData->DataLength is 0.
648 - The Token->Packet.RxData->DataLength is not the
649 sum of all FragmentBuffer length in FragmentTable.
650 @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued due to a lack of
651 system resources (usually memory).
652 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
653 The EFI TCPv6 Protocol instance has been reset to startup defaults.
654 @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:
655 - A receive completion token with the same Token->CompletionToken.Event
656 was already in the receive queue.
657 - The current instance is in Tcp6StateClosed state.
658 - The current instance is a passive one and it is in
659 Tcp6StateListen state.
660 - The user has called Close() to disconnect this connection.
661 @retval EFI_CONNECTION_FIN The communication peer has closed the connection, and there is no
662 buffered data in the receive buffer of this instance.
663 @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.
669 IN EFI_TCP6_PROTOCOL
*This
,
670 IN EFI_TCP6_IO_TOKEN
*Token
674 Disconnecting a TCP connection gracefully or reset a TCP connection. This function is a
675 nonblocking operation.
677 Initiate an asynchronous close token to the TCP driver. After Close() is called, any buffered
678 transmission data will be sent by the TCP driver, and the current instance will have a graceful close
679 working flow described as RFC 793 if AbortOnClose is set to FALSE, otherwise, a rest packet
680 will be sent by TCP driver to fast disconnect this connection. When the close operation completes
681 successfully the TCP instance is in Tcp6StateClosed state, all pending asynchronous
682 operations are signaled, and any buffers used for TCP network traffic are flushed.
684 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.
685 @param[in] CloseToken Pointer to the close token to return when operation finishes.
687 @retval EFI_SUCCESS The Close() was called successfully.
688 @retval EFI_NOT_STARTED This EFI TCPv6 Protocol instance has not been configured.
689 @retval EFI_ACCESS_DENIED One or more of the following are TRUE:
690 - CloseToken or CloseToken->CompletionToken.Event is already in use.
691 - Previous Close() call on this instance has not finished.
692 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
694 - CloseToken is NULL.
695 - CloseToken->CompletionToken.Event is NULL.
696 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to finish the operation.
697 @retval EFI_DEVICE_ERROR Any unexpected error not belonging to the error categories given above.
703 IN EFI_TCP6_PROTOCOL
*This
,
704 IN EFI_TCP6_CLOSE_TOKEN
*CloseToken
708 Abort an asynchronous connection, listen, transmission or receive request.
710 The Cancel() function aborts a pending connection, listen, transmit or
713 If Token is not NULL and the token is in the connection, listen, transmission
714 or receive queue when it is being cancelled, its Token->Status will be set
715 to EFI_ABORTED and then Token->Event will be signaled.
717 If the token is not in one of the queues, which usually means that the
718 asynchronous operation has completed, EFI_NOT_FOUND is returned.
720 If Token is NULL all asynchronous token issued by Connect(), Accept(),
721 Transmit() and Receive() will be aborted.
723 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.
724 @param[in] Token Pointer to a token that has been issued by
725 EFI_TCP6_PROTOCOL.Connect(),
726 EFI_TCP6_PROTOCOL.Accept(),
727 EFI_TCP6_PROTOCOL.Transmit() or
728 EFI_TCP6_PROTOCOL.Receive(). If NULL, all pending
729 tokens issued by above four functions will be aborted. Type
730 EFI_TCP6_COMPLETION_TOKEN is defined in
731 EFI_TCP_PROTOCOL.Connect().
733 @retval EFI_UNSUPPORTED The implementation does not support this function.
739 IN EFI_TCP6_PROTOCOL
*This
,
740 IN EFI_TCP6_COMPLETION_TOKEN
*Token OPTIONAL
744 Poll to receive incoming data and transmit outgoing segments.
746 The Poll() function increases the rate that data is moved between the network
747 and application and can be called when the TCP instance is created successfully.
750 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.
752 @retval EFI_SUCCESS Incoming or outgoing data was processed.
753 @retval EFI_INVALID_PARAMETER This is NULL.
754 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
755 @retval EFI_NOT_READY No incoming or outgoing data is processed.
756 @retval EFI_TIMEOUT Data was dropped out of the transmission or receive queue.
757 Consider increasing the polling rate.
763 IN EFI_TCP6_PROTOCOL
*This