]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Include/Protocol/Tcp6.h
MdePkg: Add UEFI2.5 Ramdisk device path definition
[mirror_edk2.git] / MdePkg / Include / Protocol / Tcp6.h
... / ...
CommitLineData
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
7 Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR>\r
8 This program and the accompanying materials\r
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
16 @par Revision Reference:\r
17 This Protocol is introduced in UEFI Specification 2.2\r
18\r
19**/\r
20\r
21#ifndef __EFI_TCP6_PROTOCOL_H__\r
22#define __EFI_TCP6_PROTOCOL_H__\r
23\r
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
40///\r
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
43///\r
44typedef struct {\r
45 ///\r
46 /// The EFI TCPv6 Protocol instance handle that is using this\r
47 /// address/port pair.\r
48 ///\r
49 EFI_HANDLE InstanceHandle;\r
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
53 /// available source addresses.\r
54 ///\r
55 EFI_IPv6_ADDRESS LocalAddress;\r
56 ///\r
57 /// The local port number in host byte order.\r
58 ///\r
59 UINT16 LocalPort;\r
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
64 EFI_IPv6_ADDRESS RemoteAddress;\r
65 ///\r
66 /// The remote port number in host byte order. It may be zero if this\r
67 /// TCP instance is not connected to any remote host.\r
68 ///\r
69 UINT16 RemotePort;\r
70} EFI_TCP6_SERVICE_POINT;\r
71\r
72///\r
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
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
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
92 /// IPv6 driver.\r
93 ///\r
94 EFI_IPv6_ADDRESS StationAddress;\r
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
98 /// StationPort to zero to use an ephemeral port.\r
99 ///\r
100 UINT16 StationPort;\r
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
110 /// from any address will be accepted.\r
111 ///\r
112 EFI_IPv6_ADDRESS RemoteAddress;\r
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
119 /// ActiveFlag is TRUE.\r
120 ///\r
121 UINT16 RemotePort;\r
122 ///\r
123 /// Set it to TRUE to initiate an active open. Set it to FALSE to\r
124 /// initiate a passive open to act as a server.\r
125 ///\r
126 BOOLEAN ActiveFlag;\r
127} EFI_TCP6_ACCESS_POINT;\r
128\r
129///\r
130/// EFI_TCP6_OPTION\r
131///\r
132typedef struct {\r
133 ///\r
134 /// The size of the TCP receive buffer.\r
135 ///\r
136 UINT32 ReceiveBufferSize;\r
137 ///\r
138 /// The size of the TCP send buffer.\r
139 ///\r
140 UINT32 SendBufferSize;\r
141 ///\r
142 /// The length of incoming connect request queue for a passive\r
143 /// instance. When set to zero, the value is implementation specific.\r
144 ///\r
145 UINT32 MaxSynBackLog;\r
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
149 /// implementation specific.\r
150 ///\r
151 UINT32 ConnectionTimeout;\r
152 ///\r
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
155 ///implementation specific.\r
156 ///\r
157 UINT32 DataRetries;\r
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
165 /// against the standard. The default value is 60.\r
166 ///\r
167 UINT32 FinTimeout;\r
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
172 /// is against the related RFC documents.\r
173 ///\r
174 UINT32 TimeWaitTimeout;\r
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
178 /// other end. Set to zero to disable keep-alive probe.\r
179 ///\r
180 UINT32 KeepAliveProbes;\r
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
184 /// value is implementation specific. It should be ignored if keep-\r
185 /// alive probe is disabled.\r
186 ///\r
187 UINT32 KeepAliveTime;\r
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
191 /// value is implementation specific. It should be ignored if keep-\r
192 /// alive probe is disabled.\r
193 ///\r
194 UINT32 KeepAliveInterval;\r
195 ///\r
196 /// Set it to TRUE to enable the Nagle algorithm as defined in\r
197 /// RFC896. Set it to FALSE to disable it.\r
198 ///\r
199 BOOLEAN EnableNagle;\r
200 ///\r
201 /// Set it to TRUE to enable TCP timestamps option as defined in\r
202 /// RFC1323. Set to FALSE to disable it.\r
203 ///\r
204 BOOLEAN EnableTimeStamp;\r
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
209 BOOLEAN EnableWindowScaling;\r
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
214 /// DSAK as defined in RFC 2883.\r
215 ///\r
216 BOOLEAN EnableSelectiveAck;\r
217 ///\r
218 /// Set it to TRUE to enable path MTU discovery as defined in\r
219 /// RFC 1191. Set to FALSE to disable it.\r
220 ///\r
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
237 /// Used to specify TCP communication end settings for a TCP instance.\r
238 ///\r
239 EFI_TCP6_ACCESS_POINT AccessPoint;\r
240 ///\r
241 /// Used to configure the advance TCP option for a connection. If set\r
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
266/// is used as a common header for various asynchronous tokens.\r
267///\r
268typedef struct {\r
269 ///\r
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
273 EFI_EVENT Event;\r
274 ///\r
275 /// The result of the completed operation.\r
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
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
289 /// error happens:\r
290 /// EFI_SUCCESS: The active open succeeds and the instance's\r
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
294 /// EFI_CONNECTION_REFUSED: The receiving or transmission operation fails because this\r
295 /// connection is refused.\r
296 /// EFI_ABORTED: The active open is aborted.\r
297 /// EFI_TIMEOUT: The connection establishment timer expires and\r
298 /// no more specific information is available.\r
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
304 /// because an ICMP protocol unreachable error is received.\r
305 /// EFI_PORT_UNREACHABLE: The connection establishment\r
306 /// timer times out and an ICMP port unreachable error is received.\r
307 /// EFI_ICMP_ERROR: The connection establishment timer times\r
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
311 /// EFI_NO_MEDIA: There was a media error.\r
312 ///\r
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
322 /// The Status in CompletionToken will be set to the\r
323 /// following value if accept finishes:\r
324 /// EFI_SUCCESS: A remote peer has successfully established a\r
325 /// connection to this instance. A new TCP instance has also been\r
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
338/// allows multiple receive or transmit buffers to be specified. The\r
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
348/// When TCPv6 driver wants to deliver received data to the application,\r
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
354 /// Whether the data is urgent. When this flag is set, the instance is in\r
355 /// urgent mode.\r
356 ///\r
357 BOOLEAN UrgentFlag;\r
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
362 /// received data in the fragments.\r
363 ///\r
364 UINT32 DataLength;\r
365 ///\r
366 /// Number of fragments.\r
367 ///\r
368 UINT32 FragmentCount;\r
369 ///\r
370 /// An array of fragment descriptors.\r
371 ///\r
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
378/// The packet may contain multiple buffers in non-continuous memory locations.\r
379///\r
380typedef struct {\r
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
385 /// subsequent Transmit()s for efficiency.\r
386 ///\r
387 BOOLEAN Push;\r
388 ///\r
389 /// The data in the fragment table are urgent and urgent point is in\r
390 /// effect if TRUE. Otherwise those data are NOT considered urgent.\r
391 ///\r
392 BOOLEAN Urgent;\r
393 ///\r
394 /// Length of the data in the fragments.\r
395 ///\r
396 UINT32 DataLength;\r
397 ///\r
398 /// Number of fragments.\r
399 ///\r
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
409/// returns When transmission finishes or meets any unexpected error.\r
410///\r
411typedef struct {\r
412 ///\r
413 /// When transmission finishes or meets any unexpected error it will\r
414 /// be set to one of the following values:\r
415 /// EFI_SUCCESS: The receiving or transmission operation\r
416 /// completes successfully.\r
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
419 /// receive buffer of the instance.\r
420 /// EFI_CONNECTION_RESET: The receiving or transmission operation fails\r
421 /// because this connection is reset either by instance\r
422 /// itself or the communication peer.\r
423 /// EFI_ABORTED: The receiving or transmission is aborted.\r
424 /// EFI_TIMEOUT: The transmission timer expires and no more\r
425 /// specific information is available.\r
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
436 /// EFI_DEVICE_ERROR: An unexpected system or network error occurs.\r
437 /// EFI_SECURITY_VIOLATION: The receiving or transmission\r
438 /// operation was failed because of IPSec policy check\r
439 /// EFI_NO_MEDIA: There was a media error.\r
440 ///\r
441 EFI_TCP6_COMPLETION_TOKEN CompletionToken;\r
442 union {\r
443 ///\r
444 /// When this token is used for receiving, RxData is a pointer to\r
445 /// EFI_TCP6_RECEIVE_DATA.\r
446 ///\r
447 EFI_TCP6_RECEIVE_DATA *RxData;\r
448 ///\r
449 /// When this token is used for transmitting, TxData is a pointer to\r
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
462 /// When close finishes or meets any unexpected error it will be set\r
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
467 ///\r
468 EFI_TCP6_COMPLETION_TOKEN CompletionToken;\r
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
472 /// satisfy a fast disconnect.\r
473 ///\r
474 BOOLEAN AbortOnClose;\r
475} EFI_TCP6_CLOSE_TOKEN;\r
476\r
477/**\r
478 Get the current operational status.\r
479\r
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
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
490 indirectly by the TCP instance is returned.\r
491 @param[out] SnpModeData The buffer in which the current SNP mode data used indirectly by\r
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
502(EFIAPI *EFI_TCP6_GET_MODE_DATA)(\r
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
517 - Reset this TCP instance brutally, i.e., cancel all pending asynchronous tokens, flush\r
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
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
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
527 and no traffic is allowed through this instance.\r
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
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
537 use.\r
538 @retval EFI_INVALID_PARAMETER One or more of the following conditions are TRUE:\r
539 - This is NULL.\r
540 - Tcp6ConfigData->AccessPoint.StationAddress is neither zero nor\r
541 one of the configured IP addresses in the underlying IPv6 driver.\r
542 - Tcp6ConfigData->AccessPoint.RemoteAddress isn't a valid unicast\r
543 IPv6 address.\r
544 - Tcp6ConfigData->AccessPoint.RemoteAddress is zero or\r
545 Tcp6ConfigData->AccessPoint.RemotePort is zero when\r
546 Tcp6ConfigData->AccessPoint.ActiveFlag is TRUE.\r
547 - A same access point has been configured in other TCP\r
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
560(EFIAPI *EFI_TCP6_CONFIGURE)(\r
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
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
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
581 @retval EFI_SUCCESS The connection request is successfully initiated and the state of\r
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
597(EFIAPI *EFI_TCP6_CONNECT)(\r
598 IN EFI_TCP6_PROTOCOL *This,\r
599 IN EFI_TCP6_CONNECTION_TOKEN *ConnectionToken\r
600 );\r
601\r
602/**\r
603 Listen on the passive instance to accept an incoming connection request. This is a\r
604 nonblocking operation.\r
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
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
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
615\r
616 This function only can be called when current TCP instance is in Tcp6StateListen state.\r
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
620\r
621\r
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
639(EFIAPI *EFI_TCP6_ACCEPT)(\r
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
648 user data. The status of the token is updated and the event in the token will be\r
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
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
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
667 - A transmit completion token with the same Token->\r
668 CompletionToken.Event was already in the\r
669 transmission queue.\r
670 - The current instance is in Tcp6StateClosed state.\r
671 - The current instance is a passive one and it is in\r
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
683(EFIAPI *EFI_TCP6_TRANSMIT)(\r
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
691 The Receive() function places a completion token into the receive packet queue. This\r
692 function is always asynchronous. The caller must allocate the Token->CompletionToken.Event\r
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
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
699 for the event will enable the user to receive the notification and receiving status. That\r
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
708 @retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a source\r
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
716 - The Token->Packet.RxData->DataLength is not the\r
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
720 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
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
726 - The current instance is a passive one and it is in\r
727 Tcp6StateListen state.\r
728 - User has called Close() to disconnect this connection.\r
729 @retval EFI_CONNECTION_FIN The communication peer has closed the connection and there is no\r
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
736(EFIAPI *EFI_TCP6_RECEIVE)(\r
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
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
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
754\r
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
770(EFIAPI *EFI_TCP6_CLOSE)(\r
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
778 The Cancel() function aborts a pending connection, listen, transmit or\r
779 receive request.\r
780\r
781 If Token is not NULL and the token is in the connection, listen, transmission\r
782 or receive queue when it is being cancelled, its Token->Status will be set\r
783 to EFI_ABORTED and then Token->Event will be signaled.\r
784\r
785 If the token is not in one of the queues, which usually means that the\r
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
801 @retval EFI_SUCCESS The asynchronous I/O request is aborted and Token->Event\r
802 is signaled.\r
803 @retval EFI_INVALID_PARAMETER This is NULL.\r
804 @retval EFI_NOT_STARTED This instance hasn't been configured.\r
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
807 Transmit() and Receive().\r
808 @retval EFI_UNSUPPORTED The implementation does not support this function.\r
809\r
810**/\r
811typedef\r
812EFI_STATUS\r
813(EFIAPI *EFI_TCP6_CANCEL)(\r
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
837(EFIAPI *EFI_TCP6_POLL)(\r
838 IN EFI_TCP6_PROTOCOL *This\r
839 );\r
840\r
841///\r
842/// EFI_TCP6_PROTOCOL\r
843/// defines the EFI TCPv6 Protocol child to be used by any network drivers or\r
844/// applications to send or receive data stream. It can either listen on a\r
845/// specified port as a service or actively connect to remote peer as a client.\r
846/// Each instance has its own independent settings.\r
847///\r
848struct _EFI_TCP6_PROTOCOL {\r
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
858};\r
859\r
860extern EFI_GUID gEfiTcp6ServiceBindingProtocolGuid;\r
861extern EFI_GUID gEfiTcp6ProtocolGuid;\r
862\r
863#endif\r
864\r