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