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