]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/Tcp6.h
1. import Ip6.h, Ip6Config.h and Tcp6.h.
[mirror_edk2.git] / MdePkg / Include / Protocol / Tcp6.h
1 /** @file
2 EFI TCPv6(Transmission Control Protocol version 6) Protocol Definition
3 The EFI TCPv6 Service Binding Protocol is used to locate EFI TCPv6 Protocol drivers to create
4 and destroy child of the driver to communicate with other host using TCP protocol.
5 The EFI TCPv6 Protocol provides services to send and receive data stream.
6
7 Copyright (c) 2008 - 2009, Intel Corporation
8 All rights reserved. This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
12
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15
16 **/
17
18 #ifndef __EFI_TCP6_PROTOCOL_H__
19 #define __EFI_TCP6_PROTOCOL_H__
20
21 #include <Protocol/Snp.h>
22 #include <Protocol/ManagedNetwork.h>
23 #include <Protocol/Ip6.h>
24
25 #define EFI_TCP6_SERVICE_BINDING_PROTOCOL_GUID \
26 { \
27 0xec20eb79, 0x6c1a, 0x4664, {0x9a, 0x0d, 0xd2, 0xe4, 0xcc, 0x16, 0xd6, 0x64 } \
28 }
29
30 #define EFI_TCP6_PROTOCOL_GUID \
31 { \
32 0x46e44855, 0xbd60, 0x4ab7, {0xab, 0x0d, 0xa6, 0x79, 0xb9, 0x44, 0x7d, 0x77 } \
33 }
34
35
36 typedef struct _EFI_TCP6_PROTOCOL EFI_TCP6_PROTOCOL;
37
38
39 ///
40 /// EFI_TCP6_SERVICE_POINT
41 ///
42 typedef struct {
43 ///
44 /// The EFI TCPv6 Protocol instance handle that is using this
45 /// address/port pair.
46 ///
47 EFI_HANDLE InstanceHandle;
48 ///
49 /// The local IPv6 address to which this TCP instance is bound. Set
50 /// to 0::/128, if this TCP instance is configured to listen on all
51 /// available source addresses.
52 ///
53 EFI_IPv6_ADDRESS LocalAddress;
54 ///
55 /// The local port number in host byte order.
56 ///
57 UINT16 LocalPort;
58 ///
59 /// The remote IPv6 address. It may be 0::/128 if this TCP instance is
60 /// not connected to any remote host.
61 ///
62 EFI_IPv6_ADDRESS RemoteAddress;
63 ///
64 /// The remote port number in host byte order. It may be zero if this
65 /// TCP instance is not connected to any remote host.
66 ///
67 UINT16 RemotePort;
68 } EFI_TCP6_SERVICE_POINT;
69
70 ///
71 /// EFI_TCP6_VARIABLE_DATA
72 ///
73 typedef struct {
74 EFI_HANDLE DriverHandle; ///< The handle of the driver that creates this entry.
75 UINT32 ServiceCount; ///< The number of address/port pairs following this data structure.
76 EFI_TCP6_SERVICE_POINT Services[1]; ///< List of address/port pairs that are currently in use.
77 } EFI_TCP6_VARIABLE_DATA;
78
79 ///
80 /// EFI_TCP6_ACCESS_POINT
81 ///
82 typedef struct {
83 ///
84 /// The local IP address assigned to this TCP instance. The EFI
85 /// TCPv6 driver will only deliver incoming packets whose
86 /// destination addresses exactly match the IP address. Set to zero to
87 /// let the underlying IPv6 driver choose a source address. If not zero
88 /// it must be one of the configured IP addresses in the underlying
89 /// IPv6 driver.
90 ///
91 EFI_IPv6_ADDRESS StationAddress;
92 ///
93 /// The local port number to which this EFI TCPv6 Protocol instance
94 /// is bound. If the instance doesn't care the local port number, set
95 /// StationPort to zero to use an ephemeral port.
96 ///
97 UINT16 StationPort;
98 ///
99 /// The remote IP address to which this EFI TCPv6 Protocol instance
100 /// is connected. If ActiveFlag is FALSE (i.e. a passive TCPv6
101 /// instance), the instance only accepts connections from the
102 /// RemoteAddress. If ActiveFlag is TRUE the instance will
103 /// connect to the RemoteAddress, i.e., outgoing segments will be
104 /// sent to this address and only segments from this address will be
105 /// delivered to the application. When ActiveFlag is FALSE, it
106 /// can be set to zero and means that incoming connection requests
107 /// from any address will be accepted.
108 ///
109 EFI_IPv6_ADDRESS RemoteAddress;
110 ///
111 /// The remote port to which this EFI TCPv6 Protocol instance
112 /// connects or from which connection request will be accepted by
113 /// this EFI TCPv6 Protocol instance. If ActiveFlag is FALSE it
114 /// can be zero and means that incoming connection request from
115 /// any port will be accepted. Its value can not be zero when
116 /// ActiveFlag is TRUE.
117 ///
118 UINT16 RemotePort;
119 ///
120 /// Set it to TRUE to initiate an active open. Set it to FALSE to
121 /// initiate a passive open to act as a server.
122 ///
123 BOOLEAN ActiveFlag;
124 } EFI_TCP6_ACCESS_POINT;
125
126 ///
127 /// EFI_TCP6_OPTION
128 ///
129 typedef struct {
130 ///
131 /// The size of the TCP receive buffer.
132 ///
133 UINT32 ReceiveBufferSize;
134 ///
135 /// The size of the TCP send buffer.
136 ///
137 UINT32 SendBufferSize;
138 ///
139 /// The length of incoming connect request queue for a passive
140 /// instance. When set to zero, the value is implementation specific.
141 ///
142 UINT32 MaxSynBackLog;
143 ///
144 /// The maximum seconds a TCP instance will wait for before a TCP
145 /// connection established. When set to zero, the value is
146 /// implementation specific.
147 ///
148 UINT32 ConnectionTimeout;
149 ///
150 ///The number of times TCP will attempt to retransmit a packet on
151 ///an established connection. When set to zero, the value is
152 ///implementation specific.
153 ///
154 UINT32 DataRetries;
155 ///
156 /// How many seconds to wait in the FIN_WAIT_2 states for a final
157 /// FIN flag before the TCP instance is closed. This timeout is in
158 /// effective only if the application has called Close() to
159 /// disconnect the connection completely. It is also called
160 /// FIN_WAIT_2 timer in other implementations. When set to zero,
161 /// it should be disabled because the FIN_WAIT_2 timer itself is
162 /// against the standard. The default value is 60.
163 ///
164 UINT32 FinTimeout;
165 ///
166 /// How many seconds to wait in TIME_WAIT state before the TCP
167 /// instance is closed. The timer is disabled completely to provide a
168 /// method to close the TCP connection quickly if it is set to zero. It
169 /// is against the related RFC documents.
170 ///
171 UINT32 TimeWaitTimeout;
172 ///
173 /// The maximum number of TCP keep-alive probes to send before
174 /// giving up and resetting the connection if no response from the
175 /// other end. Set to zero to disable keep-alive probe.
176 ///
177 UINT32 KeepAliveProbes;
178 ///
179 /// The number of seconds a connection needs to be idle before TCP
180 /// sends out periodical keep-alive probes. When set to zero, the
181 /// value is implementation specific. It should be ignored if keep-
182 /// alive probe is disabled.
183 ///
184 UINT32 KeepAliveTime;
185 ///
186 /// The number of seconds between TCP keep-alive probes after the
187 /// periodical keep-alive probe if no response. When set to zero, the
188 /// value is implementation specific. It should be ignored if keep-
189 /// alive probe is disabled.
190 ///
191 UINT32 KeepAliveInterval;
192 ///
193 /// Set it to TRUE to enable the Nagle algorithm as defined in
194 /// RFC896. Set it to FALSE to disable it.
195 ///
196 BOOLEAN EnableNagle;
197 ///
198 /// Set it to TRUE to enable TCP timestamps option as defined in
199 /// RFC1323. Set to FALSE to disable it.
200 ///
201 BOOLEAN EnableTimeStamp;
202 ///
203 /// Set it to TRUE to enable TCP window scale option as defined in
204 /// RFC1323. Set it to FALSE to disable it.
205 ///
206 BOOLEAN EnableWindowScaling;
207 ///
208 /// Set it to TRUE to enable selective acknowledge mechanism
209 /// described in RFC 2018. Set it to FALSE to disable it.
210 /// Implementation that supports SACK can optionally support
211 /// DSAK as defined in RFC 2883.
212 ///
213 BOOLEAN EnableSelectiveAck;
214 ///
215 /// Set it to TRUE to enable path MTU discovery as defined in
216 /// RFC 1191. Set to FALSE to disable it.
217 ///
218 BOOLEAN EnablePathMtuDiscovery;
219 } EFI_TCP6_OPTION;
220
221 ///
222 /// EFI_TCP6_CONFIG_DATA
223 ///
224 typedef struct {
225 ///
226 /// TrafficClass field in transmitted IPv6 packets.
227 ///
228 UINT8 TrafficClass;
229 ///
230 /// HopLimit field in transmitted IPv6 packets.
231 ///
232 UINT8 HopLimit;
233 ///
234 /// Used to specify TCP communication end settings for a TCP instance.
235 ///
236 EFI_TCP6_ACCESS_POINT AccessPoint;
237 ///
238 /// Used to configure the advance TCP option for a connection. If set
239 /// to NULL, implementation specific options for TCP connection will be used.
240 ///
241 EFI_TCP6_OPTION *ControlOption;
242 } EFI_TCP6_CONFIG_DATA;
243
244 ///
245 /// EFI_TCP6_CONNECTION_STATE
246 ///
247 typedef enum {
248 Tcp6StateClosed = 0,
249 Tcp6StateListen = 1,
250 Tcp6StateSynSent = 2,
251 Tcp6StateSynReceived = 3,
252 Tcp6StateEstablished = 4,
253 Tcp6StateFinWait1 = 5,
254 Tcp6StateFinWait2 = 6,
255 Tcp6StateClosing = 7,
256 Tcp6StateTimeWait = 8,
257 Tcp6StateCloseWait = 9,
258 Tcp6StateLastAck = 10
259 } EFI_TCP6_CONNECTION_STATE;
260
261 ///
262 /// EFI_TCP6_COMPLETION_TOKEN
263 /// is used as a common header for various asynchronous tokens.
264 ///
265 typedef struct {
266 ///
267 /// The Event to signal after request is finished and Status field is
268 /// updated by the EFI TCPv6 Protocol driver.
269 ///
270 EFI_EVENT Event;
271 ///
272 /// The result of the completed operation.
273 ///
274 EFI_STATUS Status;
275 } EFI_TCP6_COMPLETION_TOKEN;
276
277 ///
278 /// EFI_TCP6_CONNECTION_TOKEN
279 /// will be set if the active open succeeds or an unexpected
280 /// error happens.
281 ///
282 typedef struct {
283 ///
284 /// The Status in the CompletionToken will be set to one of
285 /// the following values if the active open succeeds or an unexpected
286 /// error happens:
287 /// EFI_SUCCESS: The active open succeeds and the instance's
288 /// state is Tcp6StateEstablished.
289 /// EFI_CONNECTION_RESET: The connect fails because the connection is reset
290 /// either by instance itself or the communication peer.
291 /// EFI_ABORTED: The active open is aborted.
292 /// EFI_TIMEOUT: The connection establishment timer expires and
293 /// no more specific information is available.
294 /// EFI_NETWORK_UNREACHABLE: The active open fails because
295 /// an ICMP network unreachable error is received.
296 /// EFI_HOST_UNREACHABLE: The active open fails because an
297 /// ICMP host unreachable error is received.
298 /// EFI_PROTOCOL_UNREACHABLE: The active open fails
299 /// because an ICMP protocol unreachable error is received.
300 /// EFI_PORT_UNREACHABLE: The connection establishment
301 /// timer times out and an ICMP port unreachable error is received.
302 /// EFI_ICMP_ERROR: The connection establishment timer times
303 /// out and some other ICMP error is received.
304 /// EFI_DEVICE_ERROR: An unexpected system or network error occurred.
305 /// EFI_SECURITY_VIOLATION: The active open was failed because of IPSec policy check.
306 ///
307 EFI_TCP6_COMPLETION_TOKEN CompletionToken;
308 } EFI_TCP6_CONNECTION_TOKEN;
309
310 ///
311 /// EFI_TCP6_LISTEN_TOKEN
312 /// returns when list operation finishes.
313 ///
314 typedef struct {
315 ///
316 /// The Status in CompletionToken will be set to the
317 /// following value if accept finishes:
318 /// EFI_SUCCESS: A remote peer has successfully established a
319 /// connection to this instance. A new TCP instance has also been
320 /// created for the connection.
321 /// EFI_CONNECTION_RESET: The accept fails because the connection is reset either
322 /// by instance itself or communication peer.
323 /// EFI_ABORTED: The accept request has been aborted.
324 /// EFI_SECURITY_VIOLATION: The accept operation was failed because of IPSec policy check.
325 ///
326 EFI_TCP6_COMPLETION_TOKEN CompletionToken;
327 EFI_HANDLE NewChildHandle;
328 } EFI_TCP6_LISTEN_TOKEN;
329
330 ///
331 /// EFI_TCP6_FRAGMENT_DATA
332 /// allows multiple receive or transmit buffers to be specified. The
333 /// purpose of this structure is to provide scattered read and write.
334 ///
335 typedef struct {
336 UINT32 FragmentLength; ///< Length of data buffer in the fragment.
337 VOID *FragmentBuffer; ///< Pointer to the data buffer in the fragment.
338 } EFI_TCP6_FRAGMENT_DATA;
339
340 ///
341 /// EFI_TCP6_RECEIVE_DATA
342 /// When TCPv6 driver wants to deliver received data to the application,
343 /// it will pick up the first queued receiving token, update its
344 /// Token->Packet.RxData then signal the Token->CompletionToken.Event.
345 ///
346 typedef struct {
347 ///
348 /// Whether the data is urgent. When this flag is set, the instance is in
349 /// urgent mode.
350 ///
351 BOOLEAN UrgentFlag;
352 ///
353 /// When calling Receive() function, it is the byte counts of all
354 /// Fragmentbuffer in FragmentTable allocated by user.
355 /// When the token is signaled by TCPv6 driver it is the length of
356 /// received data in the fragments.
357 ///
358 UINT32 DataLength;
359 ///
360 /// Number of fragments.
361 ///
362 UINT32 FragmentCount;
363 ///
364 /// An array of fragment descriptors.
365 ///
366 EFI_TCP6_FRAGMENT_DATA FragmentTable[1];
367 } EFI_TCP6_RECEIVE_DATA;
368
369 ///
370 /// EFI_TCP6_TRANSMIT_DATA
371 /// The EFI TCPv6 Protocol user must fill this data structure before sending a packet.
372 /// The packet may contain multiple buffers in non-continuous memory locations.
373 ///
374 typedef struct {
375 ///
376 /// Push If TRUE, data must be transmitted promptly, and the PUSH bit in
377 /// the last TCP segment created will be set. If FALSE, data
378 /// transmission may be delayed to combine with data from
379 /// subsequent Transmit()s for efficiency.
380 ///
381 BOOLEAN Push;
382 ///
383 /// The data in the fragment table are urgent and urgent point is in
384 /// effect if TRUE. Otherwise those data are NOT considered urgent.
385 ///
386 BOOLEAN Urgent;
387 ///
388 /// Length of the data in the fragments.
389 ///
390 UINT32 DataLength;
391 ///
392 /// Number of fragments.
393 ///
394 UINT32 FragmentCount;
395 ///
396 /// An array of fragment descriptors.
397 ///
398 EFI_TCP6_FRAGMENT_DATA FragmentTable[1];
399 } EFI_TCP6_TRANSMIT_DATA;
400
401 ///
402 /// EFI_TCP6_IO_TOKEN
403 /// returns When transmission finishes or meets any unexpected error.
404 ///
405 typedef struct {
406 ///
407 /// When transmission finishes or meets any unexpected error it will
408 /// be set to one of the following values:
409 /// EFI_SUCCESS: The receiving or transmission operation
410 /// completes successfully.
411 /// EFI_CONNECTION_RESET: The receiving or transmission operation fails
412 /// because this connection is reset either by instance
413 /// itself or the communication peer.
414 /// EFI_ABORTED: The receiving or transmission is aborted.
415 /// EFI_TIMEOUT: The transmission timer expires and no more
416 /// specific information is available.
417 /// EFI_NETWORK_UNREACHABLE: The transmission fails
418 /// because an ICMP network unreachable error is received.
419 /// EFI_HOST_UNREACHABLE: The transmission fails because an
420 /// ICMP host unreachable error is received.
421 /// EFI_PROTOCOL_UNREACHABLE: The transmission fails
422 /// because an ICMP protocol unreachable error is received.
423 /// EFI_PORT_UNREACHABLE: The transmission fails and an
424 /// ICMP port unreachable error is received.
425 /// EFI_ICMP_ERROR: The transmission fails and some other
426 /// ICMP error is received.
427 /// EFI_DEVICE_ERROR: An unexpected system or network error occurs.
428 /// EFI_SECURITY_VIOLATION: The receiving or transmission
429 /// operation was failed because of IPSec policy check
430 ///
431 EFI_TCP6_COMPLETION_TOKEN CompletionToken;
432 union {
433 ///
434 /// When this token is used for receiving, RxData is a pointer to
435 /// EFI_TCP6_RECEIVE_DATA.
436 ///
437 EFI_TCP6_RECEIVE_DATA *RxData;
438 ///
439 /// When this token is used for transmitting, TxData is a pointer to
440 /// EFI_TCP6_TRANSMIT_DATA.
441 ///
442 EFI_TCP6_TRANSMIT_DATA *TxData;
443 } Packet;
444 } EFI_TCP6_IO_TOKEN;
445
446 ///
447 /// EFI_TCP6_CLOSE_TOKEN
448 /// returns when close operation finishes.
449 ///
450 typedef struct {
451 ///
452 /// When close finishes or meets any unexpected error it will be set
453 /// to one of the following values:
454 /// EFI_SUCCESS: The close operation completes successfully.
455 /// EFI_ABORTED: User called configure with NULL without close stopping.
456 /// EFI_SECURITY_VIOLATION: The close operation was failed because of IPSec policy check.
457 ///
458 EFI_TCP6_COMPLETION_TOKEN CompletionToken;
459 ///
460 /// Abort the TCP connection on close instead of the standard TCP
461 /// close process when it is set to TRUE. This option can be used to
462 /// satisfy a fast disconnect.
463 ///
464 BOOLEAN AbortOnClose;
465 } EFI_TCP6_CLOSE_TOKEN;
466
467 /**
468 Get the current operational status.
469
470 The GetModeData() function copies the current operational settings of this EFI TCPv6
471 Protocol instance into user-supplied buffers. This function can also be used to retrieve
472 the operational setting of underlying drivers such as IPv6, MNP, or SNP.
473
474 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.
475 @param[out] Tcp6State The buffer in which the current TCP state is returned.
476 @param[out] Tcp6ConfigData The buffer in which the current TCP configuration is returned.
477 @param[out] Ip6ModeData The buffer in which the current IPv6 configuration data used by
478 the TCP instance is returned.
479 @param[out] MnpConfigData The buffer in which the current MNP configuration data used
480 indirectly by the TCP instance is returned.
481 @param[out] SnpModeData The buffer in which the current SNP mode data used indirectly by
482 the TCP instance is returned.
483
484 @retval EFI_SUCCESS The mode data was read.
485 @retval EFI_NOT_STARTED No configuration data is available because this instance hasn't
486 been started.
487 @retval EFI_INVALID_PARAMETER This is NULL.
488
489 **/
490 typedef
491 EFI_STATUS
492 (EFIAPI *EFI_TCP6_GET_MODE_DATA) (
493 IN EFI_TCP6_PROTOCOL *This,
494 OUT EFI_TCP6_CONNECTION_STATE *Tcp6State OPTIONAL,
495 OUT EFI_TCP6_CONFIG_DATA *Tcp6ConfigData OPTIONAL,
496 OUT EFI_IP6_MODE_DATA *Ip6ModeData OPTIONAL,
497 OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
498 OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
499 );
500
501 /**
502 Initialize or brutally reset the operational parameters for this EFI TCPv6 instance.
503
504 The Configure() function does the following:
505 - Initialize this TCP instance, i.e., initialize the communication end settings and
506 specify active open or passive open for an instance.
507 - Reset this TCP instance brutally, i.e., cancel all pending asynchronous tokens, flush
508 transmission and receiving buffer directly without informing the communication peer.
509
510 No other TCPv6 Protocol operation except Poll() can be executed by this instance until
511 it is configured properly. For an active TCP instance, after a proper configuration it
512 may call Connect() to initiates the three-way handshake. For a passive TCP instance,
513 its state will transit to Tcp6StateListen after configuration, and Accept() may be
514 called to listen the incoming TCP connection requests. If Tcp6ConfigData is set to NULL,
515 the instance is reset. Resetting process will be done brutally, the state machine will
516 be set to Tcp6StateClosed directly, the receive queue and transmit queue will be flushed,
517 and no traffic is allowed through this instance.
518
519 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.
520 @param[in] Tcp6ConfigData Pointer to the configure data to configure the instance.
521 If Tcp6ConfigData is set to NULL, the instance is reset.
522
523 @retval EFI_SUCCESS The operational settings are set, changed, or reset
524 successfully.
525 @retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a source
526 address for this instance, but no source address was available for
527 use.
528 @retval EFI_INVALID_PARAMETER One or more of the following conditions are TRUE:
529 - This is NULL.
530 - Tcp6ConfigData->AccessPoint.StationAddress is neither zero nor
531 one of the configured IP addresses in the underlying IPv6 driver.
532 - Tcp6ConfigData->AccessPoint.RemoteAddress isn't a valid unicast
533 IPv6 address.
534 - Tcp6ConfigData->AccessPoint.RemoteAddress is zero or
535 Tcp6ConfigData->AccessPoint.RemotePort is zero when
536 Tcp6ConfigData->AccessPoint.ActiveFlag is TRUE.
537 - A same access point has been configured in other TCP
538 instance properly.
539 @retval EFI_ACCESS_DENIED Configuring TCP instance when it is configured without
540 calling Configure() with NULL to reset it.
541 @retval EFI_UNSUPPORTED One or more of the control options are not supported in
542 the implementation.
543 @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources when
544 executing Configure().
545 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.
546
547 **/
548 typedef
549 EFI_STATUS
550 (EFIAPI *EFI_TCP6_CONFIGURE) (
551 IN EFI_TCP6_PROTOCOL *This,
552 IN EFI_TCP6_CONFIG_DATA *Tcp6ConfigData OPTIONAL
553 );
554
555 /**
556 Initiate a nonblocking TCP connection request for an active TCP instance.
557
558 The Connect() function will initiate an active open to the remote peer configured
559 in current TCP instance if it is configured active. If the connection succeeds or
560 fails due to any error, the ConnectionToken->CompletionToken.Event will be signaled
561 and ConnectionToken->CompletionToken.Status will be updated accordingly. This
562 function can only be called for the TCP instance in Tcp6StateClosed state. The
563 instance will transfer into Tcp6StateSynSent if the function returns EFI_SUCCESS.
564 If TCP three-way handshake succeeds, its state will become Tcp6StateEstablished,
565 otherwise, the state will return to Tcp6StateClosed.
566
567 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.
568 @param[in] ConnectionToken Pointer to the connection token to return when the TCP three
569 way handshake finishes.
570
571 @retval EFI_SUCCESS The connection request is successfully initiated and the state of
572 this TCP instance has been changed to Tcp6StateSynSent.
573 @retval EFI_NOT_STARTED This EFI TCPv6 Protocol instance has not been configured.
574 @retval EFI_ACCESS_DENIED One or more of the following conditions are TRUE:
575 - This instance is not configured as an active one.
576 - This instance is not in Tcp6StateClosed state.
577 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
578 - This is NULL.
579 - ConnectionToken is NULL.
580 - ConnectionToken->CompletionToken.Event is NULL.
581 @retval EFI_OUT_OF_RESOURCES The driver can't allocate enough resource to initiate the active open.
582 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
583
584 **/
585 typedef
586 EFI_STATUS
587 (EFIAPI *EFI_TCP6_CONNECT) (
588 IN EFI_TCP6_PROTOCOL *This,
589 IN EFI_TCP6_CONNECTION_TOKEN *ConnectionToken
590 );
591
592 /**
593 Listen on the passive instance to accept an incoming connection request. This is a
594 nonblocking operation.
595
596 The Accept() function initiates an asynchronous accept request to wait for an incoming
597 connection on the passive TCP instance. If a remote peer successfully establishes a
598 connection with this instance, a new TCP instance will be created and its handle will
599 be returned in ListenToken->NewChildHandle. The newly created instance is configured
600 by inheriting the passive instance's configuration and is ready for use upon return.
601 The new instance is in the Tcp6StateEstablished state.
602
603 The ListenToken->CompletionToken.Event will be signaled when a new connection is
604 accepted, user aborts the listen or connection is reset.
605
606 This function only can be called when current TCP instance is in Tcp6StateListen state.
607
608 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.
609 @param[in] ListenToken Pointer to the listen token to return when operation finishes.
610
611
612 @retval EFI_SUCCESS The listen token has been queued successfully.
613 @retval EFI_NOT_STARTED This EFI TCPv6 Protocol instance has not been configured.
614 @retval EFI_ACCESS_DENIED One or more of the following are TRUE:
615 - This instance is not a passive instance.
616 - This instance is not in Tcp6StateListen state.
617 - The same listen token has already existed in the listen
618 token queue of this TCP instance.
619 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
620 - This is NULL.
621 - ListenToken is NULL.
622 - ListentToken->CompletionToken.Event is NULL.
623 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resource to finish the operation.
624 @retval EFI_DEVICE_ERROR Any unexpected and not belonged to above category error.
625
626 **/
627 typedef
628 EFI_STATUS
629 (EFIAPI *EFI_TCP6_ACCEPT) (
630 IN EFI_TCP6_PROTOCOL *This,
631 IN EFI_TCP6_LISTEN_TOKEN *ListenToken
632 );
633
634 /**
635 Queues outgoing data into the transmit queue.
636
637 The Transmit() function queues a sending request to this TCP instance along with the
638 user data. The status of the token is updated and the event in the token will be
639 signaled once the data is sent out or some error occurs.
640
641 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.
642 @param[in] Token Pointer to the completion token to queue to the transmit queue.
643
644 @retval EFI_SUCCESS The data has been queued for transmission.
645 @retval EFI_NOT_STARTED This EFI TCPv6 Protocol instance has not been configured.
646 @retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a
647 source address for this instance, but no source address was
648 available for use.
649 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
650 - This is NULL.
651 - Token is NULL.
652 - Token->CompletionToken.Event is NULL.
653 - Token->Packet.TxData is NULL.
654 - Token->Packet.FragmentCount is zero.
655 - Token->Packet.DataLength is not equal to the sum of fragment lengths.
656 @retval EFI_ACCESS_DENIED One or more of the following conditions are TRUE:
657 - A transmit completion token with the same Token->
658 CompletionToken.Event was already in the
659 transmission queue.
660 - The current instance is in Tcp6StateClosed state.
661 - The current instance is a passive one and it is in
662 Tcp6StateListen state.
663 - User has called Close() to disconnect this connection.
664 @retval EFI_NOT_READY The completion token could not be queued because the
665 transmit queue is full.
666 @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data because of resource
667 shortage.
668 @retval EFI_NETWORK_UNREACHABLE There is no route to the destination network or address.
669
670 **/
671 typedef
672 EFI_STATUS
673 (EFIAPI *EFI_TCP6_TRANSMIT) (
674 IN EFI_TCP6_PROTOCOL *This,
675 IN EFI_TCP6_IO_TOKEN *Token
676 );
677
678 /**
679 Places an asynchronous receive request into the receiving queue.
680
681 The Receive() function places a completion token into the receive packet queue. This
682 function is always asynchronous. The caller must allocate the Token->CompletionToken.Event
683 and the FragmentBuffer used to receive data. The caller also must fill the DataLength which
684 represents the whole length of all FragmentBuffer. When the receive operation completes, the
685 EFI TCPv6 Protocol driver updates the Token->CompletionToken.Status and Token->Packet.RxData
686 fields and the Token->CompletionToken.Event is signaled. If got data the data and its length
687 will be copied into the FragmentTable, at the same time the full length of received data will
688 be recorded in the DataLength fields. Providing a proper notification function and context
689 for the event will enable the user to receive the notification and receiving status. That
690 notification function is guaranteed to not be re-entered.
691
692 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.
693 @param[in] Token Pointer to a token that is associated with the receive data
694 descriptor.
695
696 @retval EFI_SUCCESS The receive completion token was cached.
697 @retval EFI_NOT_STARTED This EFI TCPv6 Protocol instance has not been configured.
698 @retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a source
699 address for this instance, but no source address was available for use.
700 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
701 - This is NULL.
702 - Token is NULL.
703 - Token->CompletionToken.Event is NULL.
704 - Token->Packet.RxData is NULL.
705 - Token->Packet.RxData->DataLength is 0.
706 - The Token->Packet.RxData->DataLength is not the
707 sum of all FragmentBuffer length in FragmentTable.
708 @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued due to a lack of
709 system resources (usually memory).
710 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
711 The EFI TCPv6 Protocol instance has been reset to startup defaults.
712 @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:
713 - A receive completion token with the same Token->CompletionToken.Event
714 was already in the receive queue.
715 - The current instance is in Tcp6StateClosed state.
716 - The current instance is a passive one and it is in
717 Tcp6StateListen state.
718 - User has called Close() to disconnect this connection.
719 @retval EFI_CONNECTION_FIN The communication peer has closed the connection and there is no
720 any buffered data in the receive buffer of this instance
721 @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.
722
723 **/
724 typedef
725 EFI_STATUS
726 (EFIAPI *EFI_TCP6_RECEIVE) (
727 IN EFI_TCP6_PROTOCOL *This,
728 IN EFI_TCP6_IO_TOKEN *Token
729 );
730
731 /**
732 Disconnecting a TCP connection gracefully or reset a TCP connection. This function is a
733 nonblocking operation.
734
735 Initiate an asynchronous close token to TCP driver. After Close() is called, any buffered
736 transmission data will be sent by TCP driver and the current instance will have a graceful close
737 working flow described as RFC 793 if AbortOnClose is set to FALSE, otherwise, a rest packet
738 will be sent by TCP driver to fast disconnect this connection. When the close operation completes
739 successfully the TCP instance is in Tcp6StateClosed state, all pending asynchronous
740 operations are signaled and any buffers used for TCP network traffic are flushed.
741
742 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.
743 @param[in] CloseToken Pointer to the close token to return when operation finishes.
744
745 @retval EFI_SUCCESS The Close() is called successfully.
746 @retval EFI_NOT_STARTED This EFI TCPv6 Protocol instance has not been configured.
747 @retval EFI_ACCESS_DENIED One or more of the following are TRUE:
748 - CloseToken or CloseToken->CompletionToken.Event is already in use.
749 - Previous Close() call on this instance has not finished.
750 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
751 - This is NULL.
752 - CloseToken is NULL.
753 - CloseToken->CompletionToken.Event is NULL.
754 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resource to finish the operation.
755 @retval EFI_DEVICE_ERROR Any unexpected and not belonged to above category error.
756
757 **/
758 typedef
759 EFI_STATUS
760 (EFIAPI *EFI_TCP6_CLOSE) (
761 IN EFI_TCP6_PROTOCOL *This,
762 IN EFI_TCP6_CLOSE_TOKEN *CloseToken
763 );
764
765 /**
766 Abort an asynchronous connection, listen, transmission or receive request.
767
768 The Cancel() function aborts a pending connection, listen, transmit or
769 receive request.
770
771 If Token is not NULL and the token is in the connection, listen, transmission
772 or receive queue when it is being cancelled, its Token->Status will be set
773 to EFI_ABORTED and then Token->Event will be signaled.
774
775 If the token is not in one of the queues, which usually means that the
776 asynchronous operation has completed, EFI_NOT_FOUND is returned.
777
778 If Token is NULL all asynchronous token issued by Connect(), Accept(),
779 Transmit() and Receive() will be aborted.
780
781 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.
782 @param[in] Token Pointer to a token that has been issued by
783 EFI_TCP6_PROTOCOL.Connect(),
784 EFI_TCP6_PROTOCOL.Accept(),
785 EFI_TCP6_PROTOCOL.Transmit() or
786 EFI_TCP6_PROTOCOL.Receive(). If NULL, all pending
787 tokens issued by above four functions will be aborted. Type
788 EFI_TCP6_COMPLETION_TOKEN is defined in
789 EFI_TCP_PROTOCOL.Connect().
790
791 @retval EFI_SUCCESS The asynchronous I/O request is aborted and Token->Event
792 is signaled.
793 @retval EFI_INVALID_PARAMETER This is NULL.
794 @retval EFI_NOT_STARTED This instance hasn't been configured.
795 @retval EFI_NOT_FOUND The asynchronous I/O request isn't found in the transmission or
796 receive queue. It has either completed or wasn't issued by
797 Transmit() and Receive().
798
799 **/
800 typedef
801 EFI_STATUS
802 (EFIAPI *EFI_TCP6_CANCEL) (
803 IN EFI_TCP6_PROTOCOL *This,
804 IN EFI_TCP6_COMPLETION_TOKEN *Token OPTIONAL
805 );
806
807 /**
808 Poll to receive incoming data and transmit outgoing segments.
809
810 The Poll() function increases the rate that data is moved between the network
811 and application and can be called when the TCP instance is created successfully.
812 Its use is optional.
813
814 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.
815
816 @retval EFI_SUCCESS Incoming or outgoing data was processed.
817 @retval EFI_INVALID_PARAMETER This is NULL.
818 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
819 @retval EFI_NOT_READY No incoming or outgoing data is processed.
820 @retval EFI_TIMEOUT Data was dropped out of the transmission or receive queue.
821 Consider increasing the polling rate.
822
823 **/
824 typedef
825 EFI_STATUS
826 (EFIAPI *EFI_TCP6_POLL) (
827 IN EFI_TCP6_PROTOCOL *This
828 );
829
830 ///
831 /// EFI_TCP6_PROTOCOL
832 /// defines the EFI TCPv6 Protocol child to be used by any network drivers or
833 /// applications to send or receive data stream. It can either listen on a
834 /// specified port as a service or actively connect to remote peer as a client.
835 /// Each instance has its own independent settings.
836 ///
837 typedef struct _EFI_TCP6_PROTOCOL {
838 EFI_TCP6_GET_MODE_DATA GetModeData;
839 EFI_TCP6_CONFIGURE Configure;
840 EFI_TCP6_CONNECT Connect;
841 EFI_TCP6_ACCEPT Accept;
842 EFI_TCP6_TRANSMIT Transmit;
843 EFI_TCP6_RECEIVE Receive;
844 EFI_TCP6_CLOSE Close;
845 EFI_TCP6_CANCEL Cancel;
846 EFI_TCP6_POLL Poll;
847 } EFI_TCP6_PROTOCOL;
848
849 extern EFI_GUID gEfiTcp6ServiceBindingProtocolGuid;
850 extern EFI_GUID gEfiTcp6ProtocolGuid;
851
852 #endif
853