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