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