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