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