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 - 2010, 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>
27 #include "TcpDriver.h"
30 extern UINT16 mTcp4RandomPort
;
31 extern UINT16 mTcp6RandomPort
;
32 extern CHAR16
*mTcpStateName
[];
33 extern EFI_COMPONENT_NAME_PROTOCOL gTcpComponentName
;
34 extern EFI_COMPONENT_NAME2_PROTOCOL gTcpComponentName2
;
36 extern LIST_ENTRY mTcpRunQue
;
37 extern LIST_ENTRY mTcpListenQue
;
38 extern TCP_SEQNO mTcpGlobalIss
;
39 extern UINT32 mTcpTick
;
44 #define TCP6_KEEP_NEIGHBOR_TIME 30
46 /// 5 seconds, since 1 tick equals 200ms.
48 #define TCP6_REFRESH_NEIGHBOR_TICK 25
50 #define TCP_EXPIRE_TIME 65535
53 /// The implementation selects the initial send sequence number and the unit to
54 /// be added when it is increased.
56 #define TCP_BASE_ISS 0x4d7e980b
57 #define TCP_ISS_INCREMENT_1 2048
58 #define TCP_ISS_INCREMENT_2 100
61 EFI_TCP4_CONFIG_DATA Tcp4CfgData
;
62 EFI_TCP6_CONFIG_DATA Tcp6CfgData
;
66 EFI_TCP4_ACCESS_POINT Tcp4Ap
;
67 EFI_TCP6_ACCESS_POINT Tcp6Ap
;
70 typedef struct _TCP4_MODE_DATA
{
71 EFI_TCP4_CONNECTION_STATE
*Tcp4State
;
72 EFI_TCP4_CONFIG_DATA
*Tcp4ConfigData
;
73 EFI_IP4_MODE_DATA
*Ip4ModeData
;
74 EFI_MANAGED_NETWORK_CONFIG_DATA
*MnpConfigData
;
75 EFI_SIMPLE_NETWORK_MODE
*SnpModeData
;
78 typedef struct _TCP6_MODE_DATA
{
79 EFI_TCP6_CONNECTION_STATE
*Tcp6State
;
80 EFI_TCP6_CONFIG_DATA
*Tcp6ConfigData
;
81 EFI_IP6_MODE_DATA
*Ip6ModeData
;
82 EFI_MANAGED_NETWORK_CONFIG_DATA
*MnpConfigData
;
83 EFI_SIMPLE_NETWORK_MODE
*SnpModeData
;
86 typedef struct _TCP4_ROUTE_INFO
{
88 EFI_IPv4_ADDRESS
*SubnetAddress
;
89 EFI_IPv4_ADDRESS
*SubnetMask
;
90 EFI_IPv4_ADDRESS
*GatewayAddress
;
94 // EFI_TCP4_PROTOCOL definitions.
98 Get the current operational status.
100 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.
101 @param[out] Tcp4State Pointer to the buffer to receive the current TCP
102 state. Optional parameter that may be NULL.
103 @param[out] Tcp4ConfigData Pointer to the buffer to receive the current TCP
104 configuration. Optional parameter that may be NULL.
105 @param[out] Ip4ModeData Pointer to the buffer to receive the current
106 IPv4 configuration. Optional parameter that may be NULL.
107 @param[out] MnpConfigData Pointer to the buffer to receive the current MNP
108 configuration data indirectly used by the TCPv4
109 Instance. Optional parameter that may be NULL.
110 @param[out] SnpModeData Pointer to the buffer to receive the current SNP
111 configuration data indirectly used by the TCPv4
112 Instance. Optional parameter that may be NULL.
114 @retval EFI_SUCCESS The mode data was read.
115 @retval EFI_NOT_STARTED No configuration data is available because this
116 instance hasn't been started.
117 @retval EFI_INVALID_PARAMETER This is NULL.
123 IN CONST EFI_TCP4_PROTOCOL
*This
,
124 OUT EFI_TCP4_CONNECTION_STATE
*Tcp4State OPTIONAL
,
125 OUT EFI_TCP4_CONFIG_DATA
*Tcp4ConfigData OPTIONAL
,
126 OUT EFI_IP4_MODE_DATA
*Ip4ModeData OPTIONAL
,
127 OUT EFI_MANAGED_NETWORK_CONFIG_DATA
*MnpConfigData OPTIONAL
,
128 OUT EFI_SIMPLE_NETWORK_MODE
*SnpModeData OPTIONAL
132 Initialize or brutally reset the operational parameters for
133 this EFI TCPv4 instance.
135 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.
136 @param[in] TcpConfigData Pointer to the configure data to configure the
137 instance. Optional parameter that may be NULL.
139 @retval EFI_SUCCESS The operational settings are set, changed, or
141 @retval EFI_NO_MAPPING When using a default address, configuration
142 (through DHCP, BOOTP, RARP, etc.) is not
144 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
145 @retval EFI_ACCESS_DENIED Configuring the TCP instance when it is already
147 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.
148 @retval EFI_UNSUPPORTED One or more of the control options are not
149 supported in the implementation.
150 @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources.
156 IN EFI_TCP4_PROTOCOL
* This
,
157 IN EFI_TCP4_CONFIG_DATA
* TcpConfigData OPTIONAL
161 Add or delete routing entries.
163 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.
164 @param[in] DeleteRoute If TRUE, delete the specified route from routing
165 table; if FALSE, add the specified route to
167 @param[in] SubnetAddress The destination network.
168 @param[in] SubnetMask The subnet mask for the destination network.
169 @param[in] GatewayAddress The gateway address for this route.
171 @retval EFI_SUCCESS The operation completed successfully.
172 @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance has not been
174 @retval EFI_NO_MAPPING When using a default address, configuration
175 (through DHCP, BOOTP, RARP, etc.) is not
177 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
178 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to add the
179 entry to the routing table.
180 @retval EFI_NOT_FOUND This route is not in the routing table.
181 @retval EFI_ACCESS_DENIED This route is already in the routing table.
182 @retval EFI_UNSUPPORTED The TCP driver does not support this operation.
188 IN EFI_TCP4_PROTOCOL
*This
,
189 IN BOOLEAN DeleteRoute
,
190 IN EFI_IPv4_ADDRESS
*SubnetAddress
,
191 IN EFI_IPv4_ADDRESS
*SubnetMask
,
192 IN EFI_IPv4_ADDRESS
*GatewayAddress
196 Initiate a nonblocking TCP connection request for an active TCP instance.
198 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.
199 @param[in] ConnectionToken Pointer to the connection token to return when
200 the TCP three way handshake finishes.
202 @retval EFI_SUCCESS The connection request is successfully
204 @retval EFI_NOT_STARTED This EFI_TCP4_PROTOCOL instance hasn't been
206 @retval EFI_ACCESS_DENIED The instance is not configured as an active one
207 or it is not in Tcp4StateClosed state.
208 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
209 @retval EFI_OUT_OF_RESOURCES The driver can't allocate enough resources to
210 initiate the active open.
211 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
217 IN EFI_TCP4_PROTOCOL
*This
,
218 IN EFI_TCP4_CONNECTION_TOKEN
*ConnectionToken
222 Listen on the passive instance to accept an incoming connection request.
224 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.
225 @param[in] ListenToken Pointer to the listen token to return when
228 @retval EFI_SUCCESS The listen token has been queued successfully.
229 @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been
231 @retval EFI_ACCESS_DENIED The instatnce is not a passive one or it is not
232 in Tcp4StateListen state, or a same listen token
233 has already existed in the listen token queue of
235 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
236 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to finish
238 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
244 IN EFI_TCP4_PROTOCOL
*This
,
245 IN EFI_TCP4_LISTEN_TOKEN
*ListenToken
249 Queues outgoing data into the transmit queue
251 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance
252 @param[in] Token Pointer to the completion token to queue to the
255 @retval EFI_SUCCESS The data has been queued for transmission
256 @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been
258 @retval EFI_NO_MAPPING When using a default address, configuration
259 (DHCP, BOOTP, RARP, etc.) is not finished yet.
260 @retval EFI_INVALID_PARAMETER One or more parameters are invalid
261 @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:
262 * A transmit completion token with the same
263 Token-> CompletionToken.Event was already in the
264 transmission queue. * The current instance is in
265 Tcp4StateClosed state * The current instance is
266 a passive one and it is in Tcp4StateListen
267 state. * User has called Close() to disconnect
269 @retval EFI_NOT_READY The completion token could not be queued because
270 the transmit queue is full.
271 @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data because of a
273 @retval EFI_NETWORK_UNREACHABLE There is no route to the destination network or
280 IN EFI_TCP4_PROTOCOL
*This
,
281 IN EFI_TCP4_IO_TOKEN
*Token
285 Place an asynchronous receive request into the receiving queue.
287 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.
288 @param[in] Token Pointer to a token that is associated with the
289 receive data descriptor.
291 @retval EFI_SUCCESS The receive completion token was cached.
292 @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been
294 @retval EFI_NO_MAPPING When using a default address, configuration
295 (DHCP, BOOTP, RARP, etc.) is not finished yet.
296 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
297 @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued
298 due to a lack of system resources.
299 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
300 @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:
301 * A receive completion token with the same
302 Token->CompletionToken.Event was already in the
303 receive queue. * The current instance is in
304 Tcp4StateClosed state. * The current instance is
305 a passive one and it is in Tcp4StateListen
306 state. * User has called Close() to disconnect
308 @retval EFI_CONNECTION_FIN The communication peer has closed the connection
309 and there is no buffered data in the receive
310 buffer of this instance.
311 @retval EFI_NOT_READY The receive request could not be queued because
312 the receive queue is full.
318 IN EFI_TCP4_PROTOCOL
*This
,
319 IN EFI_TCP4_IO_TOKEN
*Token
323 Disconnecting a TCP connection gracefully or reset a TCP connection.
325 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.
326 @param[in] CloseToken Pointer to the close token to return when
329 @retval EFI_SUCCESS The operation completed successfully.
330 @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been
332 @retval EFI_ACCESS_DENIED One or more of the following are TRUE: *
333 Configure() has been called with TcpConfigData
334 set to NULL and this function has not returned.
335 * Previous Close() call on this instance has not
337 @retval EFI_INVALID_PARAMETER One ore more parameters are invalid.
338 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to finish the
340 @retval EFI_DEVICE_ERROR Any unexpected error not belonging to the error
341 categories given above.
347 IN EFI_TCP4_PROTOCOL
*This
,
348 IN EFI_TCP4_CLOSE_TOKEN
*CloseToken
352 Abort an asynchronous connection, listen, transmission or receive request.
354 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.
355 @param[in] Token Pointer to a token that has been issued by
356 Connect(), Accept(), Transmit() or Receive(). If
357 NULL, all pending tokens issued by the above four
358 functions will be aborted.
360 @retval EFI_UNSUPPORTED The operation is not supported in the current
367 IN EFI_TCP4_PROTOCOL
*This
,
368 IN EFI_TCP4_COMPLETION_TOKEN
*Token OPTIONAL
372 Poll to receive incoming data and transmit outgoing segments.
374 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.
376 @retval EFI_SUCCESS Incoming or outgoing data was processed.
377 @retval EFI_INVALID_PARAMETER This is NULL.
378 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
379 @retval EFI_NOT_READY No incoming or outgoing data was processed.
380 @retval EFI_TIMEOUT Data was dropped out of the transmission or
381 receive queue. Consider increasing the polling
388 IN EFI_TCP4_PROTOCOL
*This
392 // EFI_TCP6_PROTOCOL definitions.
396 Get the current operational status.
398 The GetModeData() function copies the current operational settings of this EFI TCPv6
399 Protocol instance into user-supplied buffers. This function can also be used to retrieve
400 the operational setting of underlying drivers such as IPv6, MNP, or SNP.
402 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.
403 @param[out] Tcp6State The buffer in which the current TCP state is
404 returned. Optional parameter that may be NULL.
405 @param[out] Tcp6ConfigData The buffer in which the current TCP configuration
406 is returned. Optional parameter that may be NULL.
407 @param[out] Ip6ModeData The buffer in which the current IPv6 configuration
408 data used by the TCP instance is returned.
409 Optional parameter that may be NULL.
410 @param[out] MnpConfigData The buffer in which the current MNP configuration
411 data used indirectly by the TCP instance is returned.
412 Optional parameter that may be NULL.
413 @param[out] SnpModeData The buffer in which the current SNP mode data
414 used indirectly by the TCP instance is returned.
415 Optional parameter that may be NULL.
417 @retval EFI_SUCCESS The mode data was read.
418 @retval EFI_NOT_STARTED No configuration data is available because this instance hasn't
420 @retval EFI_INVALID_PARAMETER This is NULL.
426 IN EFI_TCP6_PROTOCOL
*This
,
427 OUT EFI_TCP6_CONNECTION_STATE
*Tcp6State OPTIONAL
,
428 OUT EFI_TCP6_CONFIG_DATA
*Tcp6ConfigData OPTIONAL
,
429 OUT EFI_IP6_MODE_DATA
*Ip6ModeData OPTIONAL
,
430 OUT EFI_MANAGED_NETWORK_CONFIG_DATA
*MnpConfigData OPTIONAL
,
431 OUT EFI_SIMPLE_NETWORK_MODE
*SnpModeData OPTIONAL
435 Initialize or brutally reset the operational parameters for this EFI TCPv6 instance.
437 The Configure() function does the following:
438 - Initialize this TCP instance, i.e., initialize the communication end settings and
439 specify active open or passive open for an instance.
440 - Reset this TCP instance brutally, i.e., cancel all pending asynchronous tokens, flush
441 transmission and receiving buffer directly without informing the communication peer.
443 No other TCPv6 Protocol operation except Poll() can be executed by this instance until
444 it is configured properly. For an active TCP instance, after a proper configuration it
445 may call Connect() to initiates the three-way handshake. For a passive TCP instance,
446 its state will transit to Tcp6StateListen after configuration, and Accept() may be
447 called to listen the incoming TCP connection requests. If Tcp6ConfigData is set to NULL,
448 the instance is reset. Resetting process will be done brutally, the state machine will
449 be set to Tcp6StateClosed directly, the receive queue and transmit queue will be flushed,
450 and no traffic is allowed through this instance.
452 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.
453 @param[in] Tcp6ConfigData Pointer to the configure data to configure the instance.
454 If Tcp6ConfigData is set to NULL, the instance is reset.
456 @retval EFI_SUCCESS The operational settings were set, changed, or reset
458 @retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a source
459 address for this instance, but no source address was available for
461 @retval EFI_INVALID_PARAMETER One or more of the following conditions are TRUE:
463 - Tcp6ConfigData->AccessPoint.StationAddress is neither zero nor
464 one of the configured IP addresses in the underlying IPv6 driver.
465 - Tcp6ConfigData->AccessPoint.RemoteAddress isn't a valid unicast
467 - Tcp6ConfigData->AccessPoint.RemoteAddress is zero or
468 Tcp6ConfigData->AccessPoint.RemotePort is zero when
469 Tcp6ConfigData->AccessPoint.ActiveFlag is TRUE.
470 - A same access point has been configured in other TCP
472 @retval EFI_ACCESS_DENIED Configuring TCP instance when it is configured without
473 calling Configure() with NULL to reset it.
474 @retval EFI_UNSUPPORTED One or more of the control options are not supported in
476 @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources when
477 executing Configure().
478 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.
484 IN EFI_TCP6_PROTOCOL
*This
,
485 IN EFI_TCP6_CONFIG_DATA
*Tcp6ConfigData OPTIONAL
489 Initiate a nonblocking TCP connection request for an active TCP instance.
491 The Connect() function will initiate an active open to the remote peer configured
492 in current TCP instance if it is configured active. If the connection succeeds or
493 fails due to an error, the ConnectionToken->CompletionToken.Event will be signaled,
494 and ConnectionToken->CompletionToken.Status will be updated accordingly. This
495 function can only be called for the TCP instance in Tcp6StateClosed state. The
496 instance will transfer into Tcp6StateSynSent if the function returns EFI_SUCCESS.
497 If TCP three-way handshake succeeds, its state will become Tcp6StateEstablished;
498 otherwise, the state will return to Tcp6StateClosed.
500 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.
501 @param[in] ConnectionToken Pointer to the connection token to return when the TCP
502 three-way handshake finishes.
504 @retval EFI_SUCCESS The connection request successfully initiated and the state of
505 this TCP instance has been changed to Tcp6StateSynSent.
506 @retval EFI_NOT_STARTED This EFI TCPv6 Protocol instance has not been configured.
507 @retval EFI_ACCESS_DENIED One or more of the following conditions are TRUE:
508 - This instance is not configured as an active instance.
509 - This instance is not in Tcp6StateClosed state.
510 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
512 - ConnectionToken is NULL.
513 - ConnectionToken->CompletionToken.Event is NULL.
514 @retval EFI_OUT_OF_RESOURCES The driver can't allocate enough resources to initiate the active open.
515 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
521 IN EFI_TCP6_PROTOCOL
*This
,
522 IN EFI_TCP6_CONNECTION_TOKEN
*ConnectionToken
526 Listen on the passive instance to accept an incoming connection request. This is a
527 nonblocking operation.
529 The Accept() function initiates an asynchronous accept request to wait for an incoming
530 connection on the passive TCP instance. If a remote peer successfully establishes a
531 connection with this instance, a new TCP instance will be created and its handle will
532 be returned in ListenToken->NewChildHandle. The newly created instance is configured
533 by inheriting the passive instance's configuration, and is ready for use upon return.
534 The new instance is in the Tcp6StateEstablished state.
536 The ListenToken->CompletionToken.Event will be signaled when a new connection is
537 accepted, user aborts the listen or connection is reset.
539 This function only can be called when the current TCP instance is in Tcp6StateListen state.
541 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.
542 @param[in] ListenToken Pointer to the listen token to return when the operation finishes.
545 @retval EFI_SUCCESS The listen token was been queued successfully.
546 @retval EFI_NOT_STARTED This EFI TCPv6 Protocol instance has not been configured.
547 @retval EFI_ACCESS_DENIED One or more of the following are TRUE:
548 - This instance is not a passive instance.
549 - This instance is not in Tcp6StateListen state.
550 - The same listen token has already existed in the listen
551 token queue of this TCP instance.
552 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
554 - ListenToken is NULL.
555 - ListentToken->CompletionToken.Event is NULL.
556 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to finish the operation.
557 @retval EFI_DEVICE_ERROR Any unexpected error not belonging to the error
558 categories given above.
564 IN EFI_TCP6_PROTOCOL
*This
,
565 IN EFI_TCP6_LISTEN_TOKEN
*ListenToken
569 Queues outgoing data into the transmit queue.
571 The Transmit() function queues a sending request to this TCP instance along with the
572 user data. The status of the token is updated and the event in the token will be
573 signaled once the data is sent out or some error occurs.
575 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.
576 @param[in] Token Pointer to the completion token to queue to the transmit queue.
578 @retval EFI_SUCCESS The data has been queued for transmission.
579 @retval EFI_NOT_STARTED This EFI TCPv6 Protocol instance has not been configured.
580 @retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a
581 source address for this instance, but no source address was
583 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
586 - Token->CompletionToken.Event is NULL.
587 - Token->Packet.TxData is NULL.
588 - Token->Packet.FragmentCount is zero.
589 - Token->Packet.DataLength is not equal to the sum of fragment lengths.
590 @retval EFI_ACCESS_DENIED One or more of the following conditions are TRUE:
591 - A transmit completion token with the same Token->
592 CompletionToken.Event was already in the
594 - The current instance is in Tcp6StateClosed state.
595 - The current instance is a passive one and it is in
596 Tcp6StateListen state.
597 - User has called Close() to disconnect this connection.
598 @retval EFI_NOT_READY The completion token could not be queued because the
599 transmit queue is full.
600 @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data because of a resource
602 @retval EFI_NETWORK_UNREACHABLE There is no route to the destination network or address.
608 IN EFI_TCP6_PROTOCOL
*This
,
609 IN EFI_TCP6_IO_TOKEN
*Token
613 Places an asynchronous receive request into the receiving queue.
615 The Receive() function places a completion token into the receive packet queue. This
616 function is always asynchronous. The caller must allocate the Token->CompletionToken.Event
617 and the FragmentBuffer used to receive data. The caller also must fill the DataLength, which
618 represents the whole length of all FragmentBuffer. When the receive operation completes, the
619 EFI TCPv6 Protocol driver updates the Token->CompletionToken.Status and Token->Packet.RxData
620 fields, and the Token->CompletionToken.Event is signaled. If data is obtained, the data and its length
621 will be copied into the FragmentTable. At the same time the full length of received data will
622 be recorded in the DataLength fields. Providing a proper notification function and context
623 for the event enables the user to receive the notification and receiving status. That
624 notification function is guaranteed to not be re-entered.
626 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.
627 @param[in] Token Pointer to a token that is associated with the receive data
630 @retval EFI_SUCCESS The receive completion token was cached.
631 @retval EFI_NOT_STARTED This EFI TCPv6 Protocol instance has not been configured.
632 @retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a source
633 address for this instance, but no source address was available for use.
634 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
637 - Token->CompletionToken.Event is NULL.
638 - Token->Packet.RxData is NULL.
639 - Token->Packet.RxData->DataLength is 0.
640 - The Token->Packet.RxData->DataLength is not the
641 sum of all FragmentBuffer length in FragmentTable.
642 @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued due to a lack of
643 system resources (usually memory).
644 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
645 The EFI TCPv6 Protocol instance has been reset to startup defaults.
646 @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:
647 - A receive completion token with the same Token->CompletionToken.Event
648 was already in the receive queue.
649 - The current instance is in Tcp6StateClosed state.
650 - The current instance is a passive one and it is in
651 Tcp6StateListen state.
652 - The user has called Close() to disconnect this connection.
653 @retval EFI_CONNECTION_FIN The communication peer has closed the connection, and there is no
654 buffered data in the receive buffer of this instance.
655 @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.
661 IN EFI_TCP6_PROTOCOL
*This
,
662 IN EFI_TCP6_IO_TOKEN
*Token
666 Disconnecting a TCP connection gracefully or reset a TCP connection. This function is a
667 nonblocking operation.
669 Initiate an asynchronous close token to the TCP driver. After Close() is called, any buffered
670 transmission data will be sent by the TCP driver, and the current instance will have a graceful close
671 working flow described as RFC 793 if AbortOnClose is set to FALSE, otherwise, a rest packet
672 will be sent by TCP driver to fast disconnect this connection. When the close operation completes
673 successfully the TCP instance is in Tcp6StateClosed state, all pending asynchronous
674 operations are signaled, and any buffers used for TCP network traffic are flushed.
676 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.
677 @param[in] CloseToken Pointer to the close token to return when operation finishes.
679 @retval EFI_SUCCESS The Close() was called successfully.
680 @retval EFI_NOT_STARTED This EFI TCPv6 Protocol instance has not been configured.
681 @retval EFI_ACCESS_DENIED One or more of the following are TRUE:
682 - CloseToken or CloseToken->CompletionToken.Event is already in use.
683 - Previous Close() call on this instance has not finished.
684 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
686 - CloseToken is NULL.
687 - CloseToken->CompletionToken.Event is NULL.
688 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to finish the operation.
689 @retval EFI_DEVICE_ERROR Any unexpected error not belonging to the error categories given above.
695 IN EFI_TCP6_PROTOCOL
*This
,
696 IN EFI_TCP6_CLOSE_TOKEN
*CloseToken
700 Abort an asynchronous connection, listen, transmission or receive request.
702 The Cancel() function aborts a pending connection, listen, transmit or
705 If Token is not NULL and the token is in the connection, listen, transmission
706 or receive queue when it is being cancelled, its Token->Status will be set
707 to EFI_ABORTED and then Token->Event will be signaled.
709 If the token is not in one of the queues, which usually means that the
710 asynchronous operation has completed, EFI_NOT_FOUND is returned.
712 If Token is NULL all asynchronous token issued by Connect(), Accept(),
713 Transmit() and Receive() will be aborted.
715 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.
716 @param[in] Token Pointer to a token that has been issued by
717 EFI_TCP6_PROTOCOL.Connect(),
718 EFI_TCP6_PROTOCOL.Accept(),
719 EFI_TCP6_PROTOCOL.Transmit() or
720 EFI_TCP6_PROTOCOL.Receive(). If NULL, all pending
721 tokens issued by above four functions will be aborted. Type
722 EFI_TCP6_COMPLETION_TOKEN is defined in
723 EFI_TCP_PROTOCOL.Connect().
725 @retval EFI_UNSUPPORTED The implementation does not support this function.
731 IN EFI_TCP6_PROTOCOL
*This
,
732 IN EFI_TCP6_COMPLETION_TOKEN
*Token OPTIONAL
736 Poll to receive incoming data and transmit outgoing segments.
738 The Poll() function increases the rate that data is moved between the network
739 and application and can be called when the TCP instance is created successfully.
742 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.
744 @retval EFI_SUCCESS Incoming or outgoing data was processed.
745 @retval EFI_INVALID_PARAMETER This is NULL.
746 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
747 @retval EFI_NOT_READY No incoming or outgoing data is processed.
748 @retval EFI_TIMEOUT Data was dropped out of the transmission or receive queue.
749 Consider increasing the polling rate.
755 IN EFI_TCP6_PROTOCOL
*This