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