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 - 2016, Intel Corporation. All rights reserved.<BR>
7 SPDX-License-Identifier: BSD-2-Clause-Patent
14 #include <Protocol/ServiceBinding.h>
15 #include <Protocol/DriverBinding.h>
16 #include <Library/IpIoLib.h>
17 #include <Library/DevicePathLib.h>
18 #include <Library/PrintLib.h>
22 #include "TcpDriver.h"
25 extern UINT16 mTcp4RandomPort
;
26 extern UINT16 mTcp6RandomPort
;
27 extern CHAR16
*mTcpStateName
[];
28 extern EFI_COMPONENT_NAME_PROTOCOL gTcpComponentName
;
29 extern EFI_COMPONENT_NAME2_PROTOCOL gTcpComponentName2
;
30 extern EFI_UNICODE_STRING_TABLE
*gTcpControllerNameTable
;
32 extern LIST_ENTRY mTcpRunQue
;
33 extern LIST_ENTRY mTcpListenQue
;
34 extern TCP_SEQNO mTcpGlobalIss
;
35 extern UINT32 mTcpTick
;
40 #define TCP6_KEEP_NEIGHBOR_TIME 30
42 /// 5 seconds, since 1 tick equals 200ms.
44 #define TCP6_REFRESH_NEIGHBOR_TICK 25
46 #define TCP_EXPIRE_TIME 65535
49 /// The implementation selects the initial send sequence number and the unit to
50 /// be added when it is increased.
52 #define TCP_BASE_ISS 0x4d7e980b
53 #define TCP_ISS_INCREMENT_1 2048
54 #define TCP_ISS_INCREMENT_2 100
57 EFI_TCP4_CONFIG_DATA Tcp4CfgData
;
58 EFI_TCP6_CONFIG_DATA Tcp6CfgData
;
62 EFI_TCP4_ACCESS_POINT Tcp4Ap
;
63 EFI_TCP6_ACCESS_POINT Tcp6Ap
;
66 typedef struct _TCP4_MODE_DATA
{
67 EFI_TCP4_CONNECTION_STATE
*Tcp4State
;
68 EFI_TCP4_CONFIG_DATA
*Tcp4ConfigData
;
69 EFI_IP4_MODE_DATA
*Ip4ModeData
;
70 EFI_MANAGED_NETWORK_CONFIG_DATA
*MnpConfigData
;
71 EFI_SIMPLE_NETWORK_MODE
*SnpModeData
;
74 typedef struct _TCP6_MODE_DATA
{
75 EFI_TCP6_CONNECTION_STATE
*Tcp6State
;
76 EFI_TCP6_CONFIG_DATA
*Tcp6ConfigData
;
77 EFI_IP6_MODE_DATA
*Ip6ModeData
;
78 EFI_MANAGED_NETWORK_CONFIG_DATA
*MnpConfigData
;
79 EFI_SIMPLE_NETWORK_MODE
*SnpModeData
;
82 typedef struct _TCP4_ROUTE_INFO
{
84 EFI_IPv4_ADDRESS
*SubnetAddress
;
85 EFI_IPv4_ADDRESS
*SubnetMask
;
86 EFI_IPv4_ADDRESS
*GatewayAddress
;
90 EFI_SERVICE_BINDING_PROTOCOL
*ServiceBinding
;
91 UINTN NumberOfChildren
;
92 EFI_HANDLE
*ChildHandleBuffer
;
93 } TCP_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT
;
96 // EFI_TCP4_PROTOCOL definitions.
100 Get the current operational status.
102 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.
103 @param[out] Tcp4State Pointer to the buffer to receive the current TCP
104 state. Optional parameter that may be NULL.
105 @param[out] Tcp4ConfigData Pointer to the buffer to receive the current TCP
106 configuration. Optional parameter that may be NULL.
107 @param[out] Ip4ModeData Pointer to the buffer to receive the current
108 IPv4 configuration. Optional parameter that may be NULL.
109 @param[out] MnpConfigData Pointer to the buffer to receive the current MNP
110 configuration data indirectly used by the TCPv4
111 Instance. Optional parameter that may be NULL.
112 @param[out] SnpModeData Pointer to the buffer to receive the current SNP
113 configuration data indirectly used by the TCPv4
114 Instance. Optional parameter that may be NULL.
116 @retval EFI_SUCCESS The mode data was read.
117 @retval EFI_NOT_STARTED No configuration data is available because this
118 instance hasn't been started.
119 @retval EFI_INVALID_PARAMETER This is NULL.
125 IN EFI_TCP4_PROTOCOL
*This
,
126 OUT EFI_TCP4_CONNECTION_STATE
*Tcp4State OPTIONAL
,
127 OUT EFI_TCP4_CONFIG_DATA
*Tcp4ConfigData OPTIONAL
,
128 OUT EFI_IP4_MODE_DATA
*Ip4ModeData OPTIONAL
,
129 OUT EFI_MANAGED_NETWORK_CONFIG_DATA
*MnpConfigData OPTIONAL
,
130 OUT EFI_SIMPLE_NETWORK_MODE
*SnpModeData OPTIONAL
134 Initialize or brutally reset the operational parameters for
135 this EFI TCPv4 instance.
137 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.
138 @param[in] TcpConfigData Pointer to the configure data to configure the
139 instance. Optional parameter that may be NULL.
141 @retval EFI_SUCCESS The operational settings are set, changed, or
143 @retval EFI_NO_MAPPING When using a default address, configuration
144 (through DHCP, BOOTP, RARP, etc.) is not
146 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
147 @retval EFI_ACCESS_DENIED Configuring the TCP instance when it is already
149 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.
150 @retval EFI_UNSUPPORTED One or more of the control options are not
151 supported in the implementation.
152 @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources.
158 IN EFI_TCP4_PROTOCOL
* This
,
159 IN EFI_TCP4_CONFIG_DATA
* TcpConfigData OPTIONAL
163 Add or delete routing entries.
165 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.
166 @param[in] DeleteRoute If TRUE, delete the specified route from routing
167 table; if FALSE, add the specified route to
169 @param[in] SubnetAddress The destination network.
170 @param[in] SubnetMask The subnet mask for the destination network.
171 @param[in] GatewayAddress The gateway address for this route.
173 @retval EFI_SUCCESS The operation completed successfully.
174 @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance has not been
176 @retval EFI_NO_MAPPING When using a default address, configuration
177 (through DHCP, BOOTP, RARP, etc.) is not
179 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
180 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to add the
181 entry to the routing table.
182 @retval EFI_NOT_FOUND This route is not in the routing table.
183 @retval EFI_ACCESS_DENIED This route is already in the routing table.
184 @retval EFI_UNSUPPORTED The TCP driver does not support this operation.
190 IN EFI_TCP4_PROTOCOL
*This
,
191 IN BOOLEAN DeleteRoute
,
192 IN EFI_IPv4_ADDRESS
*SubnetAddress
,
193 IN EFI_IPv4_ADDRESS
*SubnetMask
,
194 IN EFI_IPv4_ADDRESS
*GatewayAddress
198 Initiate a nonblocking TCP connection request for an active TCP instance.
200 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.
201 @param[in] ConnectionToken Pointer to the connection token to return when
202 the TCP three way handshake finishes.
204 @retval EFI_SUCCESS The connection request is successfully
206 @retval EFI_NOT_STARTED This EFI_TCP4_PROTOCOL instance hasn't been
208 @retval EFI_ACCESS_DENIED The instance is not configured as an active one
209 or it is not in Tcp4StateClosed state.
210 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
211 @retval EFI_OUT_OF_RESOURCES The driver can't allocate enough resources to
212 initiate the active open.
213 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
219 IN EFI_TCP4_PROTOCOL
*This
,
220 IN EFI_TCP4_CONNECTION_TOKEN
*ConnectionToken
224 Listen on the passive instance to accept an incoming connection request.
226 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.
227 @param[in] ListenToken Pointer to the listen token to return when
230 @retval EFI_SUCCESS The listen token has been queued successfully.
231 @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been
233 @retval EFI_ACCESS_DENIED The instatnce is not a passive one or it is not
234 in Tcp4StateListen state, or a same listen token
235 has already existed in the listen token queue of
237 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
238 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to finish
240 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
246 IN EFI_TCP4_PROTOCOL
*This
,
247 IN EFI_TCP4_LISTEN_TOKEN
*ListenToken
251 Queues outgoing data into the transmit queue
253 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance
254 @param[in] Token Pointer to the completion token to queue to the
257 @retval EFI_SUCCESS The data has been queued for transmission
258 @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been
260 @retval EFI_NO_MAPPING When using a default address, configuration
261 (DHCP, BOOTP, RARP, etc.) is not finished yet.
262 @retval EFI_INVALID_PARAMETER One or more parameters are invalid
263 @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:
264 * A transmit completion token with the same
265 Token-> CompletionToken.Event was already in the
266 transmission queue. * The current instance is in
267 Tcp4StateClosed state * The current instance is
268 a passive one and it is in Tcp4StateListen
269 state. * User has called Close() to disconnect
271 @retval EFI_NOT_READY The completion token could not be queued because
272 the transmit queue is full.
273 @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data because of a
275 @retval EFI_NETWORK_UNREACHABLE There is no route to the destination network or
282 IN EFI_TCP4_PROTOCOL
*This
,
283 IN EFI_TCP4_IO_TOKEN
*Token
287 Place an asynchronous receive request into the receiving queue.
289 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.
290 @param[in] Token Pointer to a token that is associated with the
291 receive data descriptor.
293 @retval EFI_SUCCESS The receive completion token was cached.
294 @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been
296 @retval EFI_NO_MAPPING When using a default address, configuration
297 (DHCP, BOOTP, RARP, etc.) is not finished yet.
298 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
299 @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued
300 due to a lack of system resources.
301 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
302 @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:
303 * A receive completion token with the same
304 Token->CompletionToken.Event was already in the
305 receive queue. * The current instance is in
306 Tcp4StateClosed state. * The current instance is
307 a passive one and it is in Tcp4StateListen
308 state. * User has called Close() to disconnect
310 @retval EFI_CONNECTION_FIN The communication peer has closed the connection
311 and there is no buffered data in the receive
312 buffer of this instance.
313 @retval EFI_NOT_READY The receive request could not be queued because
314 the receive queue is full.
320 IN EFI_TCP4_PROTOCOL
*This
,
321 IN EFI_TCP4_IO_TOKEN
*Token
325 Disconnecting a TCP connection gracefully or reset a TCP connection.
327 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.
328 @param[in] CloseToken Pointer to the close token to return when
331 @retval EFI_SUCCESS The operation completed successfully.
332 @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been
334 @retval EFI_ACCESS_DENIED One or more of the following are TRUE: *
335 Configure() has been called with TcpConfigData
336 set to NULL and this function has not returned.
337 * Previous Close() call on this instance has not
339 @retval EFI_INVALID_PARAMETER One ore more parameters are invalid.
340 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to finish the
342 @retval EFI_DEVICE_ERROR Any unexpected error not belonging to the error
343 categories given above.
349 IN EFI_TCP4_PROTOCOL
*This
,
350 IN EFI_TCP4_CLOSE_TOKEN
*CloseToken
354 Abort an asynchronous connection, listen, transmission or receive request.
356 @param This The pointer to the EFI_TCP4_PROTOCOL instance.
357 @param Token The pointer to a token that has been issued by
358 EFI_TCP4_PROTOCOL.Connect(),
359 EFI_TCP4_PROTOCOL.Accept(),
360 EFI_TCP4_PROTOCOL.Transmit() or
361 EFI_TCP4_PROTOCOL.Receive(). If NULL, all pending
362 tokens issued by above four functions will be aborted. Type
363 EFI_TCP4_COMPLETION_TOKEN is defined in
364 EFI_TCP4_PROTOCOL.Connect().
366 @retval EFI_SUCCESS The asynchronous I/O request is aborted and Token->Event
368 @retval EFI_INVALID_PARAMETER This is NULL.
369 @retval EFI_NOT_STARTED This instance hasn't been configured.
370 @retval EFI_NO_MAPPING When using the default address, configuration
371 (DHCP, BOOTP,RARP, etc.) hasn't finished yet.
372 @retval EFI_NOT_FOUND The asynchronous I/O request isn't found in the
373 transmission or receive queue. It has either
374 completed or wasn't issued by Transmit() and Receive().
380 IN EFI_TCP4_PROTOCOL
*This
,
381 IN EFI_TCP4_COMPLETION_TOKEN
*Token OPTIONAL
385 Poll to receive incoming data and transmit outgoing segments.
387 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.
389 @retval EFI_SUCCESS Incoming or outgoing data was processed.
390 @retval EFI_INVALID_PARAMETER This is NULL.
391 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
392 @retval EFI_NOT_READY No incoming or outgoing data was processed.
393 @retval EFI_TIMEOUT Data was dropped out of the transmission or
394 receive queue. Consider increasing the polling
401 IN EFI_TCP4_PROTOCOL
*This
405 // EFI_TCP6_PROTOCOL definitions.
409 Get the current operational status.
411 The GetModeData() function copies the current operational settings of this EFI TCPv6
412 Protocol instance into user-supplied buffers. This function can also be used to retrieve
413 the operational setting of underlying drivers such as IPv6, MNP, or SNP.
415 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.
416 @param[out] Tcp6State The buffer in which the current TCP state is
417 returned. Optional parameter that may be NULL.
418 @param[out] Tcp6ConfigData The buffer in which the current TCP configuration
419 is returned. Optional parameter that may be NULL.
420 @param[out] Ip6ModeData The buffer in which the current IPv6 configuration
421 data used by the TCP instance is returned.
422 Optional parameter that may be NULL.
423 @param[out] MnpConfigData The buffer in which the current MNP configuration
424 data used indirectly by the TCP instance is returned.
425 Optional parameter that may be NULL.
426 @param[out] SnpModeData The buffer in which the current SNP mode data
427 used indirectly by the TCP instance is returned.
428 Optional parameter that may be NULL.
430 @retval EFI_SUCCESS The mode data was read.
431 @retval EFI_NOT_STARTED No configuration data is available because this instance hasn't
433 @retval EFI_INVALID_PARAMETER This is NULL.
439 IN EFI_TCP6_PROTOCOL
*This
,
440 OUT EFI_TCP6_CONNECTION_STATE
*Tcp6State OPTIONAL
,
441 OUT EFI_TCP6_CONFIG_DATA
*Tcp6ConfigData OPTIONAL
,
442 OUT EFI_IP6_MODE_DATA
*Ip6ModeData OPTIONAL
,
443 OUT EFI_MANAGED_NETWORK_CONFIG_DATA
*MnpConfigData OPTIONAL
,
444 OUT EFI_SIMPLE_NETWORK_MODE
*SnpModeData OPTIONAL
448 Initialize or brutally reset the operational parameters for this EFI TCPv6 instance.
450 The Configure() function does the following:
451 - Initialize this TCP instance, i.e., initialize the communication end settings and
452 specify active open or passive open for an instance.
453 - Reset this TCP instance brutally, i.e., cancel all pending asynchronous tokens, flush
454 transmission and receiving buffer directly without informing the communication peer.
456 No other TCPv6 Protocol operation except Poll() can be executed by this instance until
457 it is configured properly. For an active TCP instance, after a proper configuration it
458 may call Connect() to initiates the three-way handshake. For a passive TCP instance,
459 its state will transit to Tcp6StateListen after configuration, and Accept() may be
460 called to listen the incoming TCP connection requests. If Tcp6ConfigData is set to NULL,
461 the instance is reset. Resetting process will be done brutally, the state machine will
462 be set to Tcp6StateClosed directly, the receive queue and transmit queue will be flushed,
463 and no traffic is allowed through this instance.
465 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.
466 @param[in] Tcp6ConfigData Pointer to the configure data to configure the instance.
467 If Tcp6ConfigData is set to NULL, the instance is reset.
469 @retval EFI_SUCCESS The operational settings were set, changed, or reset
471 @retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a source
472 address for this instance, but no source address was available for
474 @retval EFI_INVALID_PARAMETER One or more of the following conditions are TRUE:
476 - Tcp6ConfigData->AccessPoint.StationAddress is neither zero nor
477 one of the configured IP addresses in the underlying IPv6 driver.
478 - Tcp6ConfigData->AccessPoint.RemoteAddress isn't a valid unicast
480 - Tcp6ConfigData->AccessPoint.RemoteAddress is zero or
481 Tcp6ConfigData->AccessPoint.RemotePort is zero when
482 Tcp6ConfigData->AccessPoint.ActiveFlag is TRUE.
483 - A same access point has been configured in other TCP
485 @retval EFI_ACCESS_DENIED Configuring TCP instance when it is configured without
486 calling Configure() with NULL to reset it.
487 @retval EFI_UNSUPPORTED One or more of the control options are not supported in
489 @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources when
490 executing Configure().
491 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.
497 IN EFI_TCP6_PROTOCOL
*This
,
498 IN EFI_TCP6_CONFIG_DATA
*Tcp6ConfigData OPTIONAL
502 Initiate a nonblocking TCP connection request for an active TCP instance.
504 The Connect() function will initiate an active open to the remote peer configured
505 in current TCP instance if it is configured active. If the connection succeeds or
506 fails due to an error, the ConnectionToken->CompletionToken.Event will be signaled,
507 and ConnectionToken->CompletionToken.Status will be updated accordingly. This
508 function can only be called for the TCP instance in Tcp6StateClosed state. The
509 instance will transfer into Tcp6StateSynSent if the function returns EFI_SUCCESS.
510 If TCP three-way handshake succeeds, its state will become Tcp6StateEstablished;
511 otherwise, the state will return to Tcp6StateClosed.
513 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.
514 @param[in] ConnectionToken Pointer to the connection token to return when the TCP
515 three-way handshake finishes.
517 @retval EFI_SUCCESS The connection request successfully initiated and the state of
518 this TCP instance has been changed to Tcp6StateSynSent.
519 @retval EFI_NOT_STARTED This EFI TCPv6 Protocol instance has not been configured.
520 @retval EFI_ACCESS_DENIED One or more of the following conditions are TRUE:
521 - This instance is not configured as an active instance.
522 - This instance is not in Tcp6StateClosed state.
523 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
525 - ConnectionToken is NULL.
526 - ConnectionToken->CompletionToken.Event is NULL.
527 @retval EFI_OUT_OF_RESOURCES The driver can't allocate enough resources to initiate the active open.
528 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
534 IN EFI_TCP6_PROTOCOL
*This
,
535 IN EFI_TCP6_CONNECTION_TOKEN
*ConnectionToken
539 Listen on the passive instance to accept an incoming connection request. This is a
540 nonblocking operation.
542 The Accept() function initiates an asynchronous accept request to wait for an incoming
543 connection on the passive TCP instance. If a remote peer successfully establishes a
544 connection with this instance, a new TCP instance will be created and its handle will
545 be returned in ListenToken->NewChildHandle. The newly created instance is configured
546 by inheriting the passive instance's configuration, and is ready for use upon return.
547 The new instance is in the Tcp6StateEstablished state.
549 The ListenToken->CompletionToken.Event will be signaled when a new connection is
550 accepted, user aborts the listen or connection is reset.
552 This function only can be called when the current TCP instance is in Tcp6StateListen state.
554 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.
555 @param[in] ListenToken Pointer to the listen token to return when the operation finishes.
558 @retval EFI_SUCCESS The listen token was been queued successfully.
559 @retval EFI_NOT_STARTED This EFI TCPv6 Protocol instance has not been configured.
560 @retval EFI_ACCESS_DENIED One or more of the following are TRUE:
561 - This instance is not a passive instance.
562 - This instance is not in Tcp6StateListen state.
563 - The same listen token has already existed in the listen
564 token queue of this TCP instance.
565 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
567 - ListenToken is NULL.
568 - ListentToken->CompletionToken.Event is NULL.
569 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to finish the operation.
570 @retval EFI_DEVICE_ERROR Any unexpected error not belonging to the error
571 categories given above.
577 IN EFI_TCP6_PROTOCOL
*This
,
578 IN EFI_TCP6_LISTEN_TOKEN
*ListenToken
582 Queues outgoing data into the transmit queue.
584 The Transmit() function queues a sending request to this TCP instance along with the
585 user data. The status of the token is updated and the event in the token will be
586 signaled once the data is sent out or some error occurs.
588 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.
589 @param[in] Token Pointer to the completion token to queue to the transmit queue.
591 @retval EFI_SUCCESS The data has been queued for transmission.
592 @retval EFI_NOT_STARTED This EFI TCPv6 Protocol instance has not been configured.
593 @retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a
594 source address for this instance, but no source address was
596 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
599 - Token->CompletionToken.Event is NULL.
600 - Token->Packet.TxData is NULL.
601 - Token->Packet.FragmentCount is zero.
602 - Token->Packet.DataLength is not equal to the sum of fragment lengths.
603 @retval EFI_ACCESS_DENIED One or more of the following conditions are TRUE:
604 - A transmit completion token with the same Token->
605 CompletionToken.Event was already in the
607 - The current instance is in Tcp6StateClosed state.
608 - The current instance is a passive one and it is in
609 Tcp6StateListen state.
610 - User has called Close() to disconnect this connection.
611 @retval EFI_NOT_READY The completion token could not be queued because the
612 transmit queue is full.
613 @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data because of a resource
615 @retval EFI_NETWORK_UNREACHABLE There is no route to the destination network or address.
621 IN EFI_TCP6_PROTOCOL
*This
,
622 IN EFI_TCP6_IO_TOKEN
*Token
626 Places an asynchronous receive request into the receiving queue.
628 The Receive() function places a completion token into the receive packet queue. This
629 function is always asynchronous. The caller must allocate the Token->CompletionToken.Event
630 and the FragmentBuffer used to receive data. The caller also must fill the DataLength, which
631 represents the whole length of all FragmentBuffer. When the receive operation completes, the
632 EFI TCPv6 Protocol driver updates the Token->CompletionToken.Status and Token->Packet.RxData
633 fields, and the Token->CompletionToken.Event is signaled. If data is obtained, the data and its length
634 will be copied into the FragmentTable. At the same time the full length of received data will
635 be recorded in the DataLength fields. Providing a proper notification function and context
636 for the event enables the user to receive the notification and receiving status. That
637 notification function is guaranteed to not be re-entered.
639 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.
640 @param[in] Token Pointer to a token that is associated with the receive data
643 @retval EFI_SUCCESS The receive completion token was cached.
644 @retval EFI_NOT_STARTED This EFI TCPv6 Protocol instance has not been configured.
645 @retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a source
646 address for this instance, but no source address was available for use.
647 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
650 - Token->CompletionToken.Event is NULL.
651 - Token->Packet.RxData is NULL.
652 - Token->Packet.RxData->DataLength is 0.
653 - The Token->Packet.RxData->DataLength is not the
654 sum of all FragmentBuffer length in FragmentTable.
655 @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued due to a lack of
656 system resources (usually memory).
657 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
658 The EFI TCPv6 Protocol instance has been reset to startup defaults.
659 @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:
660 - A receive completion token with the same Token->CompletionToken.Event
661 was already in the receive queue.
662 - The current instance is in Tcp6StateClosed state.
663 - The current instance is a passive one and it is in
664 Tcp6StateListen state.
665 - The user has called Close() to disconnect this connection.
666 @retval EFI_CONNECTION_FIN The communication peer has closed the connection, and there is no
667 buffered data in the receive buffer of this instance.
668 @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.
674 IN EFI_TCP6_PROTOCOL
*This
,
675 IN EFI_TCP6_IO_TOKEN
*Token
679 Disconnecting a TCP connection gracefully or reset a TCP connection. This function is a
680 nonblocking operation.
682 Initiate an asynchronous close token to the TCP driver. After Close() is called, any buffered
683 transmission data will be sent by the TCP driver, and the current instance will have a graceful close
684 working flow described as RFC 793 if AbortOnClose is set to FALSE, otherwise, a rest packet
685 will be sent by TCP driver to fast disconnect this connection. When the close operation completes
686 successfully the TCP instance is in Tcp6StateClosed state, all pending asynchronous
687 operations are signaled, and any buffers used for TCP network traffic are flushed.
689 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.
690 @param[in] CloseToken Pointer to the close token to return when operation finishes.
692 @retval EFI_SUCCESS The Close() was called successfully.
693 @retval EFI_NOT_STARTED This EFI TCPv6 Protocol instance has not been configured.
694 @retval EFI_ACCESS_DENIED One or more of the following are TRUE:
695 - CloseToken or CloseToken->CompletionToken.Event is already in use.
696 - Previous Close() call on this instance has not finished.
697 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
699 - CloseToken is NULL.
700 - CloseToken->CompletionToken.Event is NULL.
701 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to finish the operation.
702 @retval EFI_DEVICE_ERROR Any unexpected error not belonging to the error categories given above.
708 IN EFI_TCP6_PROTOCOL
*This
,
709 IN EFI_TCP6_CLOSE_TOKEN
*CloseToken
713 Abort an asynchronous connection, listen, transmission or receive request.
715 The Cancel() function aborts a pending connection, listen, transmit or
718 If Token is not NULL and the token is in the connection, listen, transmission
719 or receive queue when it is being cancelled, its Token->Status will be set
720 to EFI_ABORTED and then Token->Event will be signaled.
722 If the token is not in one of the queues, which usually means that the
723 asynchronous operation has completed, EFI_NOT_FOUND is returned.
725 If Token is NULL all asynchronous token issued by Connect(), Accept(),
726 Transmit() and Receive() will be aborted.
728 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.
729 @param[in] Token Pointer to a token that has been issued by
730 EFI_TCP6_PROTOCOL.Connect(),
731 EFI_TCP6_PROTOCOL.Accept(),
732 EFI_TCP6_PROTOCOL.Transmit() or
733 EFI_TCP6_PROTOCOL.Receive(). If NULL, all pending
734 tokens issued by above four functions will be aborted. Type
735 EFI_TCP6_COMPLETION_TOKEN is defined in
736 EFI_TCP_PROTOCOL.Connect().
738 @retval EFI_SUCCESS The asynchronous I/O request is aborted and Token->Event
740 @retval EFI_INVALID_PARAMETER This is NULL.
741 @retval EFI_NOT_STARTED This instance hasn't been configured.
742 @retval EFI_NOT_FOUND The asynchronous I/O request isn't found in the transmission or
743 receive queue. It has either completed or wasn't issued by
744 Transmit() and Receive().
750 IN EFI_TCP6_PROTOCOL
*This
,
751 IN EFI_TCP6_COMPLETION_TOKEN
*Token OPTIONAL
755 Poll to receive incoming data and transmit outgoing segments.
757 The Poll() function increases the rate that data is moved between the network
758 and application and can be called when the TCP instance is created successfully.
761 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.
763 @retval EFI_SUCCESS Incoming or outgoing data was processed.
764 @retval EFI_INVALID_PARAMETER This is NULL.
765 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
766 @retval EFI_NOT_READY No incoming or outgoing data is processed.
767 @retval EFI_TIMEOUT Data was dropped out of the transmission or receive queue.
768 Consider increasing the polling rate.
774 IN EFI_TCP6_PROTOCOL
*This