]> git.proxmox.com Git - mirror_edk2.git/blame - NetworkPkg/TcpDxe/TcpMain.h
Fix a bug about the iSCSI DHCP dependency issue.
[mirror_edk2.git] / NetworkPkg / TcpDxe / TcpMain.h
CommitLineData
a3bcde70
HT
1/** @file\r
2 Declaration of protocol interfaces in EFI_TCP4_PROTOCOL and EFI_TCP6_PROTOCOL.\r
3 It is the common head file for all Tcp*.c in TCP driver.\r
4\r
216f7970 5 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r
a3bcde70
HT
6\r
7 This program and the accompanying materials\r
8 are licensed and made available under the terms and conditions of the BSD License\r
9 which accompanies this distribution. The full text of the license may be found at\r
10 http://opensource.org/licenses/bsd-license.php.\r
11\r
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
14\r
15**/\r
16\r
17#ifndef _TCP_MAIN_H_\r
18#define _TCP_MAIN_H_\r
19\r
20#include <Protocol/ServiceBinding.h>\r
21#include <Protocol/DriverBinding.h>\r
22#include <Library/IpIoLib.h>\r
23#include <Library/DevicePathLib.h>\r
216f7970 24#include <Library/PrintLib.h>\r
a3bcde70
HT
25\r
26#include "Socket.h"\r
27#include "TcpProto.h"\r
28#include "TcpDriver.h"\r
29#include "TcpFunc.h"\r
30\r
31extern UINT16 mTcp4RandomPort;\r
32extern UINT16 mTcp6RandomPort;\r
33extern CHAR16 *mTcpStateName[];\r
34extern EFI_COMPONENT_NAME_PROTOCOL gTcpComponentName;\r
35extern EFI_COMPONENT_NAME2_PROTOCOL gTcpComponentName2;\r
216f7970 36extern EFI_UNICODE_STRING_TABLE *gTcpControllerNameTable;\r
a3bcde70
HT
37\r
38extern LIST_ENTRY mTcpRunQue;\r
39extern LIST_ENTRY mTcpListenQue;\r
40extern TCP_SEQNO mTcpGlobalIss;\r
41extern UINT32 mTcpTick;\r
42\r
43///\r
44/// 30 seconds.\r
45///\r
46#define TCP6_KEEP_NEIGHBOR_TIME 30\r
47///\r
48/// 5 seconds, since 1 tick equals 200ms.\r
49///\r
50#define TCP6_REFRESH_NEIGHBOR_TICK 25\r
51\r
52#define TCP_EXPIRE_TIME 65535\r
53\r
54///\r
55/// The implementation selects the initial send sequence number and the unit to\r
56/// be added when it is increased.\r
57///\r
58#define TCP_BASE_ISS 0x4d7e980b\r
59#define TCP_ISS_INCREMENT_1 2048\r
60#define TCP_ISS_INCREMENT_2 100\r
61\r
62typedef union {\r
63 EFI_TCP4_CONFIG_DATA Tcp4CfgData;\r
64 EFI_TCP6_CONFIG_DATA Tcp6CfgData;\r
65} TCP_CONFIG_DATA;\r
66\r
67typedef union {\r
68 EFI_TCP4_ACCESS_POINT Tcp4Ap;\r
69 EFI_TCP6_ACCESS_POINT Tcp6Ap;\r
70} TCP_ACCESS_POINT;\r
71\r
72typedef struct _TCP4_MODE_DATA {\r
73 EFI_TCP4_CONNECTION_STATE *Tcp4State;\r
74 EFI_TCP4_CONFIG_DATA *Tcp4ConfigData;\r
75 EFI_IP4_MODE_DATA *Ip4ModeData;\r
76 EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData;\r
77 EFI_SIMPLE_NETWORK_MODE *SnpModeData;\r
78} TCP4_MODE_DATA;\r
79\r
80typedef struct _TCP6_MODE_DATA {\r
81 EFI_TCP6_CONNECTION_STATE *Tcp6State;\r
82 EFI_TCP6_CONFIG_DATA *Tcp6ConfigData;\r
83 EFI_IP6_MODE_DATA *Ip6ModeData;\r
84 EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData;\r
85 EFI_SIMPLE_NETWORK_MODE *SnpModeData;\r
86} TCP6_MODE_DATA;\r
87\r
88typedef struct _TCP4_ROUTE_INFO {\r
89 BOOLEAN DeleteRoute;\r
90 EFI_IPv4_ADDRESS *SubnetAddress;\r
91 EFI_IPv4_ADDRESS *SubnetMask;\r
92 EFI_IPv4_ADDRESS *GatewayAddress;\r
93} TCP4_ROUTE_INFO;\r
94\r
216f7970 95typedef struct {\r
96 EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;\r
97 UINTN NumberOfChildren;\r
98 EFI_HANDLE *ChildHandleBuffer;\r
99} TCP_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT;\r
100\r
a3bcde70
HT
101//\r
102// EFI_TCP4_PROTOCOL definitions.\r
103//\r
104\r
105/**\r
106 Get the current operational status.\r
107\r
108 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.\r
109 @param[out] Tcp4State Pointer to the buffer to receive the current TCP\r
110 state. Optional parameter that may be NULL.\r
111 @param[out] Tcp4ConfigData Pointer to the buffer to receive the current TCP\r
112 configuration. Optional parameter that may be NULL.\r
113 @param[out] Ip4ModeData Pointer to the buffer to receive the current\r
114 IPv4 configuration. Optional parameter that may be NULL.\r
115 @param[out] MnpConfigData Pointer to the buffer to receive the current MNP\r
116 configuration data indirectly used by the TCPv4\r
117 Instance. Optional parameter that may be NULL.\r
118 @param[out] SnpModeData Pointer to the buffer to receive the current SNP\r
119 configuration data indirectly used by the TCPv4\r
120 Instance. Optional parameter that may be NULL.\r
121\r
122 @retval EFI_SUCCESS The mode data was read.\r
123 @retval EFI_NOT_STARTED No configuration data is available because this\r
124 instance hasn't been started.\r
125 @retval EFI_INVALID_PARAMETER This is NULL.\r
126\r
127**/\r
128EFI_STATUS\r
129EFIAPI\r
130Tcp4GetModeData (\r
581900d9 131 IN EFI_TCP4_PROTOCOL *This,\r
132 OUT EFI_TCP4_CONNECTION_STATE *Tcp4State OPTIONAL,\r
133 OUT EFI_TCP4_CONFIG_DATA *Tcp4ConfigData OPTIONAL,\r
134 OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL,\r
135 OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,\r
136 OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL\r
a3bcde70
HT
137 );\r
138\r
139/**\r
140 Initialize or brutally reset the operational parameters for\r
141 this EFI TCPv4 instance.\r
142\r
143 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.\r
144 @param[in] TcpConfigData Pointer to the configure data to configure the\r
145 instance. Optional parameter that may be NULL.\r
146\r
147 @retval EFI_SUCCESS The operational settings are set, changed, or\r
148 reset successfully.\r
149 @retval EFI_NO_MAPPING When using a default address, configuration\r
150 (through DHCP, BOOTP, RARP, etc.) is not\r
151 finished.\r
152 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
153 @retval EFI_ACCESS_DENIED Configuring the TCP instance when it is already\r
154 configured.\r
155 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.\r
156 @retval EFI_UNSUPPORTED One or more of the control options are not\r
157 supported in the implementation.\r
158 @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources.\r
159\r
160**/\r
161EFI_STATUS\r
162EFIAPI\r
163Tcp4Configure (\r
164 IN EFI_TCP4_PROTOCOL * This,\r
165 IN EFI_TCP4_CONFIG_DATA * TcpConfigData OPTIONAL\r
166 );\r
167\r
168/**\r
169 Add or delete routing entries.\r
170\r
171 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.\r
172 @param[in] DeleteRoute If TRUE, delete the specified route from routing\r
173 table; if FALSE, add the specified route to\r
174 routing table.\r
175 @param[in] SubnetAddress The destination network.\r
176 @param[in] SubnetMask The subnet mask for the destination network.\r
177 @param[in] GatewayAddress The gateway address for this route.\r
178\r
179 @retval EFI_SUCCESS The operation completed successfully.\r
180 @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance has not been\r
181 configured.\r
182 @retval EFI_NO_MAPPING When using a default address, configuration\r
183 (through DHCP, BOOTP, RARP, etc.) is not\r
184 finished.\r
185 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
186 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to add the\r
187 entry to the routing table.\r
188 @retval EFI_NOT_FOUND This route is not in the routing table.\r
189 @retval EFI_ACCESS_DENIED This route is already in the routing table.\r
190 @retval EFI_UNSUPPORTED The TCP driver does not support this operation.\r
191\r
192**/\r
193EFI_STATUS\r
194EFIAPI\r
195Tcp4Routes (\r
196 IN EFI_TCP4_PROTOCOL *This,\r
197 IN BOOLEAN DeleteRoute,\r
198 IN EFI_IPv4_ADDRESS *SubnetAddress,\r
199 IN EFI_IPv4_ADDRESS *SubnetMask,\r
200 IN EFI_IPv4_ADDRESS *GatewayAddress\r
201 );\r
202\r
203/**\r
204 Initiate a nonblocking TCP connection request for an active TCP instance.\r
205\r
206 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.\r
207 @param[in] ConnectionToken Pointer to the connection token to return when\r
208 the TCP three way handshake finishes.\r
209\r
210 @retval EFI_SUCCESS The connection request is successfully\r
211 initiated.\r
212 @retval EFI_NOT_STARTED This EFI_TCP4_PROTOCOL instance hasn't been\r
213 configured.\r
214 @retval EFI_ACCESS_DENIED The instance is not configured as an active one\r
215 or it is not in Tcp4StateClosed state.\r
216 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
217 @retval EFI_OUT_OF_RESOURCES The driver can't allocate enough resources to\r
218 initiate the active open.\r
219 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
220\r
221**/\r
222EFI_STATUS\r
223EFIAPI\r
224Tcp4Connect (\r
225 IN EFI_TCP4_PROTOCOL *This,\r
226 IN EFI_TCP4_CONNECTION_TOKEN *ConnectionToken\r
227 );\r
228\r
229/**\r
230 Listen on the passive instance to accept an incoming connection request.\r
231\r
232 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.\r
233 @param[in] ListenToken Pointer to the listen token to return when\r
234 operation finishes.\r
235\r
236 @retval EFI_SUCCESS The listen token has been queued successfully.\r
237 @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been\r
238 configured.\r
239 @retval EFI_ACCESS_DENIED The instatnce is not a passive one or it is not\r
240 in Tcp4StateListen state, or a same listen token\r
241 has already existed in the listen token queue of\r
242 this TCP instance.\r
243 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
244 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to finish\r
245 the operation.\r
246 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
247\r
248**/\r
249EFI_STATUS\r
250EFIAPI\r
251Tcp4Accept (\r
252 IN EFI_TCP4_PROTOCOL *This,\r
253 IN EFI_TCP4_LISTEN_TOKEN *ListenToken\r
254 );\r
255\r
256/**\r
257 Queues outgoing data into the transmit queue\r
258\r
259 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance\r
260 @param[in] Token Pointer to the completion token to queue to the\r
261 transmit queue\r
262\r
263 @retval EFI_SUCCESS The data has been queued for transmission\r
264 @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been\r
265 configured.\r
266 @retval EFI_NO_MAPPING When using a default address, configuration\r
267 (DHCP, BOOTP, RARP, etc.) is not finished yet.\r
268 @retval EFI_INVALID_PARAMETER One or more parameters are invalid\r
269 @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:\r
270 * A transmit completion token with the same\r
271 Token-> CompletionToken.Event was already in the\r
272 transmission queue. * The current instance is in\r
273 Tcp4StateClosed state * The current instance is\r
274 a passive one and it is in Tcp4StateListen\r
275 state. * User has called Close() to disconnect\r
276 this connection.\r
277 @retval EFI_NOT_READY The completion token could not be queued because\r
278 the transmit queue is full.\r
279 @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data because of a\r
280 resource shortage.\r
281 @retval EFI_NETWORK_UNREACHABLE There is no route to the destination network or\r
282 address.\r
283\r
284**/\r
285EFI_STATUS\r
286EFIAPI\r
287Tcp4Transmit (\r
288 IN EFI_TCP4_PROTOCOL *This,\r
289 IN EFI_TCP4_IO_TOKEN *Token\r
290 );\r
291\r
292/**\r
293 Place an asynchronous receive request into the receiving queue.\r
294\r
295 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.\r
296 @param[in] Token Pointer to a token that is associated with the\r
297 receive data descriptor.\r
298\r
299 @retval EFI_SUCCESS The receive completion token was cached.\r
300 @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been\r
301 configured.\r
302 @retval EFI_NO_MAPPING When using a default address, configuration\r
303 (DHCP, BOOTP, RARP, etc.) is not finished yet.\r
304 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
305 @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued\r
306 due to a lack of system resources.\r
307 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
308 @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:\r
309 * A receive completion token with the same\r
310 Token->CompletionToken.Event was already in the\r
311 receive queue. * The current instance is in\r
312 Tcp4StateClosed state. * The current instance is\r
313 a passive one and it is in Tcp4StateListen\r
314 state. * User has called Close() to disconnect\r
315 this connection.\r
316 @retval EFI_CONNECTION_FIN The communication peer has closed the connection\r
317 and there is no buffered data in the receive\r
318 buffer of this instance.\r
319 @retval EFI_NOT_READY The receive request could not be queued because\r
320 the receive queue is full.\r
321\r
322**/\r
323EFI_STATUS\r
324EFIAPI\r
325Tcp4Receive (\r
326 IN EFI_TCP4_PROTOCOL *This,\r
327 IN EFI_TCP4_IO_TOKEN *Token\r
328 );\r
329\r
330/**\r
331 Disconnecting a TCP connection gracefully or reset a TCP connection.\r
332\r
333 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.\r
334 @param[in] CloseToken Pointer to the close token to return when\r
335 operation finishes.\r
336\r
337 @retval EFI_SUCCESS The operation completed successfully.\r
338 @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been\r
339 configured.\r
340 @retval EFI_ACCESS_DENIED One or more of the following are TRUE: *\r
341 Configure() has been called with TcpConfigData\r
342 set to NULL and this function has not returned.\r
343 * Previous Close() call on this instance has not\r
344 finished.\r
345 @retval EFI_INVALID_PARAMETER One ore more parameters are invalid.\r
346 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to finish the\r
347 operation.\r
348 @retval EFI_DEVICE_ERROR Any unexpected error not belonging to the error\r
349 categories given above.\r
350\r
351**/\r
352EFI_STATUS\r
353EFIAPI\r
354Tcp4Close (\r
355 IN EFI_TCP4_PROTOCOL *This,\r
356 IN EFI_TCP4_CLOSE_TOKEN *CloseToken\r
357 );\r
358\r
359/**\r
360 Abort an asynchronous connection, listen, transmission or receive request.\r
361\r
362 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.\r
363 @param[in] Token Pointer to a token that has been issued by\r
364 Connect(), Accept(), Transmit() or Receive(). If\r
365 NULL, all pending tokens issued by the above four\r
366 functions will be aborted.\r
367\r
368 @retval EFI_UNSUPPORTED The operation is not supported in the current\r
369 implementation.\r
370\r
371**/\r
372EFI_STATUS\r
373EFIAPI\r
374Tcp4Cancel (\r
375 IN EFI_TCP4_PROTOCOL *This,\r
376 IN EFI_TCP4_COMPLETION_TOKEN *Token OPTIONAL\r
377 );\r
378\r
379/**\r
380 Poll to receive incoming data and transmit outgoing segments.\r
381\r
382 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.\r
383\r
384 @retval EFI_SUCCESS Incoming or outgoing data was processed.\r
385 @retval EFI_INVALID_PARAMETER This is NULL.\r
386 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
387 @retval EFI_NOT_READY No incoming or outgoing data was processed.\r
388 @retval EFI_TIMEOUT Data was dropped out of the transmission or\r
389 receive queue. Consider increasing the polling\r
390 rate.\r
391\r
392**/\r
393EFI_STATUS\r
394EFIAPI\r
395Tcp4Poll (\r
396 IN EFI_TCP4_PROTOCOL *This\r
397 );\r
398\r
399//\r
400// EFI_TCP6_PROTOCOL definitions.\r
401//\r
402\r
403/**\r
404 Get the current operational status.\r
405\r
406 The GetModeData() function copies the current operational settings of this EFI TCPv6\r
407 Protocol instance into user-supplied buffers. This function can also be used to retrieve\r
408 the operational setting of underlying drivers such as IPv6, MNP, or SNP.\r
409\r
410 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.\r
411 @param[out] Tcp6State The buffer in which the current TCP state is\r
412 returned. Optional parameter that may be NULL.\r
413 @param[out] Tcp6ConfigData The buffer in which the current TCP configuration\r
414 is returned. Optional parameter that may be NULL.\r
415 @param[out] Ip6ModeData The buffer in which the current IPv6 configuration\r
416 data used by the TCP instance is returned.\r
417 Optional parameter that may be NULL.\r
418 @param[out] MnpConfigData The buffer in which the current MNP configuration\r
419 data used indirectly by the TCP instance is returned.\r
420 Optional parameter that may be NULL.\r
421 @param[out] SnpModeData The buffer in which the current SNP mode data\r
422 used indirectly by the TCP instance is returned.\r
423 Optional parameter that may be NULL.\r
424\r
425 @retval EFI_SUCCESS The mode data was read.\r
426 @retval EFI_NOT_STARTED No configuration data is available because this instance hasn't\r
427 been started.\r
428 @retval EFI_INVALID_PARAMETER This is NULL.\r
429\r
430**/\r
431EFI_STATUS\r
432EFIAPI\r
433Tcp6GetModeData (\r
434 IN EFI_TCP6_PROTOCOL *This,\r
435 OUT EFI_TCP6_CONNECTION_STATE *Tcp6State OPTIONAL,\r
436 OUT EFI_TCP6_CONFIG_DATA *Tcp6ConfigData OPTIONAL,\r
437 OUT EFI_IP6_MODE_DATA *Ip6ModeData OPTIONAL,\r
438 OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,\r
439 OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL\r
440 );\r
441\r
442/**\r
443 Initialize or brutally reset the operational parameters for this EFI TCPv6 instance.\r
444\r
445 The Configure() function does the following:\r
446 - Initialize this TCP instance, i.e., initialize the communication end settings and\r
447 specify active open or passive open for an instance.\r
448 - Reset this TCP instance brutally, i.e., cancel all pending asynchronous tokens, flush\r
449 transmission and receiving buffer directly without informing the communication peer.\r
450\r
451 No other TCPv6 Protocol operation except Poll() can be executed by this instance until\r
452 it is configured properly. For an active TCP instance, after a proper configuration it\r
453 may call Connect() to initiates the three-way handshake. For a passive TCP instance,\r
454 its state will transit to Tcp6StateListen after configuration, and Accept() may be\r
455 called to listen the incoming TCP connection requests. If Tcp6ConfigData is set to NULL,\r
456 the instance is reset. Resetting process will be done brutally, the state machine will\r
457 be set to Tcp6StateClosed directly, the receive queue and transmit queue will be flushed,\r
458 and no traffic is allowed through this instance.\r
459\r
460 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.\r
461 @param[in] Tcp6ConfigData Pointer to the configure data to configure the instance.\r
462 If Tcp6ConfigData is set to NULL, the instance is reset.\r
463\r
464 @retval EFI_SUCCESS The operational settings were set, changed, or reset\r
465 successfully.\r
466 @retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a source\r
467 address for this instance, but no source address was available for\r
468 use.\r
469 @retval EFI_INVALID_PARAMETER One or more of the following conditions are TRUE:\r
470 - This is NULL.\r
471 - Tcp6ConfigData->AccessPoint.StationAddress is neither zero nor\r
472 one of the configured IP addresses in the underlying IPv6 driver.\r
473 - Tcp6ConfigData->AccessPoint.RemoteAddress isn't a valid unicast\r
474 IPv6 address.\r
475 - Tcp6ConfigData->AccessPoint.RemoteAddress is zero or\r
476 Tcp6ConfigData->AccessPoint.RemotePort is zero when\r
477 Tcp6ConfigData->AccessPoint.ActiveFlag is TRUE.\r
478 - A same access point has been configured in other TCP\r
479 instance properly.\r
480 @retval EFI_ACCESS_DENIED Configuring TCP instance when it is configured without\r
481 calling Configure() with NULL to reset it.\r
482 @retval EFI_UNSUPPORTED One or more of the control options are not supported in\r
483 the implementation.\r
484 @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources when\r
485 executing Configure().\r
486 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.\r
487\r
488**/\r
489EFI_STATUS\r
490EFIAPI\r
491Tcp6Configure (\r
492 IN EFI_TCP6_PROTOCOL *This,\r
493 IN EFI_TCP6_CONFIG_DATA *Tcp6ConfigData OPTIONAL\r
494 );\r
495\r
496/**\r
497 Initiate a nonblocking TCP connection request for an active TCP instance.\r
498\r
499 The Connect() function will initiate an active open to the remote peer configured\r
500 in current TCP instance if it is configured active. If the connection succeeds or\r
501 fails due to an error, the ConnectionToken->CompletionToken.Event will be signaled,\r
502 and ConnectionToken->CompletionToken.Status will be updated accordingly. This\r
503 function can only be called for the TCP instance in Tcp6StateClosed state. The\r
504 instance will transfer into Tcp6StateSynSent if the function returns EFI_SUCCESS.\r
505 If TCP three-way handshake succeeds, its state will become Tcp6StateEstablished;\r
506 otherwise, the state will return to Tcp6StateClosed.\r
507\r
508 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.\r
509 @param[in] ConnectionToken Pointer to the connection token to return when the TCP\r
510 three-way handshake finishes.\r
511\r
512 @retval EFI_SUCCESS The connection request successfully initiated and the state of\r
513 this TCP instance has been changed to Tcp6StateSynSent.\r
514 @retval EFI_NOT_STARTED This EFI TCPv6 Protocol instance has not been configured.\r
515 @retval EFI_ACCESS_DENIED One or more of the following conditions are TRUE:\r
516 - This instance is not configured as an active instance.\r
517 - This instance is not in Tcp6StateClosed state.\r
518 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:\r
519 - This is NULL.\r
520 - ConnectionToken is NULL.\r
521 - ConnectionToken->CompletionToken.Event is NULL.\r
522 @retval EFI_OUT_OF_RESOURCES The driver can't allocate enough resources to initiate the active open.\r
523 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
524\r
525**/\r
526EFI_STATUS\r
527EFIAPI\r
528Tcp6Connect (\r
529 IN EFI_TCP6_PROTOCOL *This,\r
530 IN EFI_TCP6_CONNECTION_TOKEN *ConnectionToken\r
531 );\r
532\r
533/**\r
534 Listen on the passive instance to accept an incoming connection request. This is a\r
535 nonblocking operation.\r
536\r
537 The Accept() function initiates an asynchronous accept request to wait for an incoming\r
538 connection on the passive TCP instance. If a remote peer successfully establishes a\r
539 connection with this instance, a new TCP instance will be created and its handle will\r
540 be returned in ListenToken->NewChildHandle. The newly created instance is configured\r
541 by inheriting the passive instance's configuration, and is ready for use upon return.\r
542 The new instance is in the Tcp6StateEstablished state.\r
543\r
544 The ListenToken->CompletionToken.Event will be signaled when a new connection is\r
545 accepted, user aborts the listen or connection is reset.\r
546\r
547 This function only can be called when the current TCP instance is in Tcp6StateListen state.\r
548\r
549 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.\r
550 @param[in] ListenToken Pointer to the listen token to return when the operation finishes.\r
551\r
552\r
553 @retval EFI_SUCCESS The listen token was been queued successfully.\r
554 @retval EFI_NOT_STARTED This EFI TCPv6 Protocol instance has not been configured.\r
555 @retval EFI_ACCESS_DENIED One or more of the following are TRUE:\r
556 - This instance is not a passive instance.\r
557 - This instance is not in Tcp6StateListen state.\r
558 - The same listen token has already existed in the listen\r
559 token queue of this TCP instance.\r
560 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:\r
561 - This is NULL.\r
562 - ListenToken is NULL.\r
563 - ListentToken->CompletionToken.Event is NULL.\r
564 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to finish the operation.\r
565 @retval EFI_DEVICE_ERROR Any unexpected error not belonging to the error\r
566 categories given above.\r
567\r
568**/\r
569EFI_STATUS\r
570EFIAPI\r
571Tcp6Accept (\r
572 IN EFI_TCP6_PROTOCOL *This,\r
573 IN EFI_TCP6_LISTEN_TOKEN *ListenToken\r
574 );\r
575\r
576/**\r
577 Queues outgoing data into the transmit queue.\r
578\r
579 The Transmit() function queues a sending request to this TCP instance along with the\r
580 user data. The status of the token is updated and the event in the token will be\r
581 signaled once the data is sent out or some error occurs.\r
582\r
583 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.\r
584 @param[in] Token Pointer to the completion token to queue to the transmit queue.\r
585\r
586 @retval EFI_SUCCESS The data has been queued for transmission.\r
587 @retval EFI_NOT_STARTED This EFI TCPv6 Protocol instance has not been configured.\r
588 @retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a\r
589 source address for this instance, but no source address was\r
590 available for use.\r
591 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:\r
592 - This is NULL.\r
593 - Token is NULL.\r
594 - Token->CompletionToken.Event is NULL.\r
595 - Token->Packet.TxData is NULL.\r
596 - Token->Packet.FragmentCount is zero.\r
597 - Token->Packet.DataLength is not equal to the sum of fragment lengths.\r
598 @retval EFI_ACCESS_DENIED One or more of the following conditions are TRUE:\r
599 - A transmit completion token with the same Token->\r
600 CompletionToken.Event was already in the\r
601 transmission queue.\r
602 - The current instance is in Tcp6StateClosed state.\r
603 - The current instance is a passive one and it is in\r
604 Tcp6StateListen state.\r
605 - User has called Close() to disconnect this connection.\r
606 @retval EFI_NOT_READY The completion token could not be queued because the\r
607 transmit queue is full.\r
608 @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data because of a resource\r
609 shortage.\r
610 @retval EFI_NETWORK_UNREACHABLE There is no route to the destination network or address.\r
611\r
612**/\r
613EFI_STATUS\r
614EFIAPI\r
615Tcp6Transmit (\r
616 IN EFI_TCP6_PROTOCOL *This,\r
617 IN EFI_TCP6_IO_TOKEN *Token\r
618 );\r
619\r
620/**\r
621 Places an asynchronous receive request into the receiving queue.\r
622\r
623 The Receive() function places a completion token into the receive packet queue. This\r
624 function is always asynchronous. The caller must allocate the Token->CompletionToken.Event\r
625 and the FragmentBuffer used to receive data. The caller also must fill the DataLength, which\r
626 represents the whole length of all FragmentBuffer. When the receive operation completes, the\r
627 EFI TCPv6 Protocol driver updates the Token->CompletionToken.Status and Token->Packet.RxData\r
628 fields, and the Token->CompletionToken.Event is signaled. If data is obtained, the data and its length\r
629 will be copied into the FragmentTable. At the same time the full length of received data will\r
630 be recorded in the DataLength fields. Providing a proper notification function and context\r
631 for the event enables the user to receive the notification and receiving status. That\r
632 notification function is guaranteed to not be re-entered.\r
633\r
634 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.\r
635 @param[in] Token Pointer to a token that is associated with the receive data\r
636 descriptor.\r
637\r
638 @retval EFI_SUCCESS The receive completion token was cached.\r
639 @retval EFI_NOT_STARTED This EFI TCPv6 Protocol instance has not been configured.\r
640 @retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a source\r
641 address for this instance, but no source address was available for use.\r
642 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
643 - This is NULL.\r
644 - Token is NULL.\r
645 - Token->CompletionToken.Event is NULL.\r
646 - Token->Packet.RxData is NULL.\r
647 - Token->Packet.RxData->DataLength is 0.\r
648 - The Token->Packet.RxData->DataLength is not the\r
649 sum of all FragmentBuffer length in FragmentTable.\r
650 @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued due to a lack of\r
651 system resources (usually memory).\r
652 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
653 The EFI TCPv6 Protocol instance has been reset to startup defaults.\r
654 @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:\r
655 - A receive completion token with the same Token->CompletionToken.Event\r
656 was already in the receive queue.\r
657 - The current instance is in Tcp6StateClosed state.\r
658 - The current instance is a passive one and it is in\r
659 Tcp6StateListen state.\r
660 - The user has called Close() to disconnect this connection.\r
661 @retval EFI_CONNECTION_FIN The communication peer has closed the connection, and there is no\r
662 buffered data in the receive buffer of this instance.\r
663 @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.\r
664\r
665**/\r
666EFI_STATUS\r
667EFIAPI\r
668Tcp6Receive (\r
669 IN EFI_TCP6_PROTOCOL *This,\r
670 IN EFI_TCP6_IO_TOKEN *Token\r
671 );\r
672\r
673/**\r
674 Disconnecting a TCP connection gracefully or reset a TCP connection. This function is a\r
675 nonblocking operation.\r
676\r
677 Initiate an asynchronous close token to the TCP driver. After Close() is called, any buffered\r
678 transmission data will be sent by the TCP driver, and the current instance will have a graceful close\r
679 working flow described as RFC 793 if AbortOnClose is set to FALSE, otherwise, a rest packet\r
680 will be sent by TCP driver to fast disconnect this connection. When the close operation completes\r
681 successfully the TCP instance is in Tcp6StateClosed state, all pending asynchronous\r
682 operations are signaled, and any buffers used for TCP network traffic are flushed.\r
683\r
684 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.\r
685 @param[in] CloseToken Pointer to the close token to return when operation finishes.\r
686\r
687 @retval EFI_SUCCESS The Close() was called successfully.\r
688 @retval EFI_NOT_STARTED This EFI TCPv6 Protocol instance has not been configured.\r
689 @retval EFI_ACCESS_DENIED One or more of the following are TRUE:\r
690 - CloseToken or CloseToken->CompletionToken.Event is already in use.\r
691 - Previous Close() call on this instance has not finished.\r
692 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:\r
693 - This is NULL.\r
694 - CloseToken is NULL.\r
695 - CloseToken->CompletionToken.Event is NULL.\r
696 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to finish the operation.\r
697 @retval EFI_DEVICE_ERROR Any unexpected error not belonging to the error categories given above.\r
698\r
699**/\r
700EFI_STATUS\r
701EFIAPI\r
702Tcp6Close (\r
703 IN EFI_TCP6_PROTOCOL *This,\r
704 IN EFI_TCP6_CLOSE_TOKEN *CloseToken\r
705 );\r
706\r
707/**\r
708 Abort an asynchronous connection, listen, transmission or receive request.\r
709\r
710 The Cancel() function aborts a pending connection, listen, transmit or\r
711 receive request.\r
712\r
713 If Token is not NULL and the token is in the connection, listen, transmission\r
714 or receive queue when it is being cancelled, its Token->Status will be set\r
715 to EFI_ABORTED and then Token->Event will be signaled.\r
716\r
717 If the token is not in one of the queues, which usually means that the\r
718 asynchronous operation has completed, EFI_NOT_FOUND is returned.\r
719\r
720 If Token is NULL all asynchronous token issued by Connect(), Accept(),\r
721 Transmit() and Receive() will be aborted.\r
722\r
723 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.\r
724 @param[in] Token Pointer to a token that has been issued by\r
725 EFI_TCP6_PROTOCOL.Connect(),\r
726 EFI_TCP6_PROTOCOL.Accept(),\r
727 EFI_TCP6_PROTOCOL.Transmit() or\r
728 EFI_TCP6_PROTOCOL.Receive(). If NULL, all pending\r
729 tokens issued by above four functions will be aborted. Type\r
730 EFI_TCP6_COMPLETION_TOKEN is defined in\r
731 EFI_TCP_PROTOCOL.Connect().\r
732\r
733 @retval EFI_UNSUPPORTED The implementation does not support this function.\r
734\r
735**/\r
736EFI_STATUS\r
737EFIAPI\r
738Tcp6Cancel (\r
739 IN EFI_TCP6_PROTOCOL *This,\r
740 IN EFI_TCP6_COMPLETION_TOKEN *Token OPTIONAL\r
741 );\r
742\r
743/**\r
744 Poll to receive incoming data and transmit outgoing segments.\r
745\r
746 The Poll() function increases the rate that data is moved between the network\r
747 and application and can be called when the TCP instance is created successfully.\r
748 Its use is optional.\r
749\r
750 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.\r
751\r
752 @retval EFI_SUCCESS Incoming or outgoing data was processed.\r
753 @retval EFI_INVALID_PARAMETER This is NULL.\r
754 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
755 @retval EFI_NOT_READY No incoming or outgoing data is processed.\r
756 @retval EFI_TIMEOUT Data was dropped out of the transmission or receive queue.\r
757 Consider increasing the polling rate.\r
758\r
759**/\r
760EFI_STATUS\r
761EFIAPI\r
762Tcp6Poll (\r
763 IN EFI_TCP6_PROTOCOL *This\r
764 );\r
765\r
766#endif\r