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