]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/Tcp4.h
Add some comments.
[mirror_edk2.git] / MdePkg / Include / Protocol / Tcp4.h
CommitLineData
d1f95000 1/** @file\r
bdb140d7 2 EFI TCPv4(Transmission Control Protocol version 4) Protocol Definition\r
d1f95000 3 The EFI TCPv4 Service Binding Protocol is used to locate EFI TCPv4 Protocol drivers to create\r
d01c093a 4 and destroy child of the driver to communicate with other host using TCP protocol.\r
5 The EFI TCPv4 Protocol provides services to send and receive data stream.\r
d1f95000 6\r
bdb140d7 7 Copyright (c) 2006 - 2009, Intel Corporation\r
d01c093a 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
d1f95000 12\r
d01c093a 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
d1f95000 15\r
5899caf0 16 @par Revision Reference: \r
17 This Protocol is introduced in UEFI Specification 2.0\r
18\r
d1f95000 19**/\r
20\r
21#ifndef __EFI_TCP4_PROTOCOL_H__\r
22#define __EFI_TCP4_PROTOCOL_H__\r
23\r
24#include <Protocol/Ip4.h>\r
25\r
26#define EFI_TCP4_SERVICE_BINDING_PROTOCOL_GUID \\r
27 { \\r
28 0x00720665, 0x67EB, 0x4a99, {0xBA, 0xF7, 0xD3, 0xC3, 0x3A, 0x1C, 0x7C, 0xC9 } \\r
29 }\r
30\r
31#define EFI_TCP4_PROTOCOL_GUID \\r
32 { \\r
33 0x65530BC7, 0xA359, 0x410f, {0xB0, 0x10, 0x5A, 0xAD, 0xC7, 0xEC, 0x2B, 0x62 } \\r
34 }\r
35\r
36typedef struct _EFI_TCP4_PROTOCOL EFI_TCP4_PROTOCOL;\r
37\r
38typedef struct {\r
8377875b 39 EFI_HANDLE InstanceHandle;\r
d1f95000 40 EFI_IPv4_ADDRESS LocalAddress;\r
41 UINT16 LocalPort;\r
42 EFI_IPv4_ADDRESS RemoteAddress;\r
43 UINT16 RemotePort;\r
44} EFI_TCP4_SERVICE_POINT;\r
45\r
46typedef struct {\r
47 EFI_HANDLE DriverHandle;\r
48 UINT32 ServiceCount;\r
49 EFI_TCP4_SERVICE_POINT Services[1];\r
50} EFI_TCP4_VARIABLE_DATA;\r
51\r
52typedef struct {\r
53 BOOLEAN UseDefaultAddress;\r
54 EFI_IPv4_ADDRESS StationAddress;\r
55 EFI_IPv4_ADDRESS SubnetMask;\r
56 UINT16 StationPort;\r
57 EFI_IPv4_ADDRESS RemoteAddress;\r
58 UINT16 RemotePort;\r
59 BOOLEAN ActiveFlag;\r
60} EFI_TCP4_ACCESS_POINT;\r
61\r
62typedef struct {\r
d01c093a 63 UINT32 ReceiveBufferSize;\r
64 UINT32 SendBufferSize;\r
65 UINT32 MaxSynBackLog;\r
66 UINT32 ConnectionTimeout;\r
67 UINT32 DataRetries;\r
68 UINT32 FinTimeout;\r
69 UINT32 TimeWaitTimeout;\r
70 UINT32 KeepAliveProbes;\r
71 UINT32 KeepAliveTime;\r
72 UINT32 KeepAliveInterval;\r
d1f95000 73 BOOLEAN EnableNagle;\r
74 BOOLEAN EnableTimeStamp;\r
75 BOOLEAN EnableWindowScaling;\r
76 BOOLEAN EnableSelectiveAck;\r
77 BOOLEAN EnablePathMtuDiscovery;\r
78} EFI_TCP4_OPTION;\r
79\r
80typedef struct {\r
81 //\r
82 // I/O parameters\r
83 //\r
84 UINT8 TypeOfService;\r
85 UINT8 TimeToLive;\r
86\r
87 //\r
88 // Access Point\r
89 //\r
90 EFI_TCP4_ACCESS_POINT AccessPoint;\r
d01c093a 91\r
92 //\r
93 // TCP Control Options\r
94 //\r
d1f95000 95 EFI_TCP4_OPTION *ControlOption;\r
96} EFI_TCP4_CONFIG_DATA;\r
97\r
9319d2c2
LG
98///\r
99/// TCP4 connnection state\r
100///\r
d1f95000 101typedef enum {\r
102 Tcp4StateClosed = 0,\r
103 Tcp4StateListen = 1,\r
104 Tcp4StateSynSent = 2,\r
105 Tcp4StateSynReceived = 3,\r
106 Tcp4StateEstablished = 4,\r
107 Tcp4StateFinWait1 = 5,\r
108 Tcp4StateFinWait2 = 6,\r
109 Tcp4StateClosing = 7,\r
110 Tcp4StateTimeWait = 8,\r
111 Tcp4StateCloseWait = 9,\r
112 Tcp4StateLastAck = 10\r
113} EFI_TCP4_CONNECTION_STATE;\r
114\r
115typedef struct {\r
116 EFI_EVENT Event;\r
117 EFI_STATUS Status;\r
118} EFI_TCP4_COMPLETION_TOKEN;\r
119\r
120typedef struct {\r
abbfadd7 121 ///\r
122 /// The Status in the CompletionToken will be set to one of \r
123 /// the following values if the active open succeeds or an unexpected \r
124 /// error happens:\r
125 /// EFI_SUCCESS: The active open succeeds and the instance's \r
126 /// state is Tcp4StateEstablished.\r
127 /// EFI_CONNECTION_RESET: The connect fails because the connection is reset\r
128 /// either by instance itself or the communication peer.\r
129 /// EFI_CONNECTION_REFUSED: The connect fails because this connection is initiated with\r
130 /// an active open and the connection is refused.\r
3a7afaf6 131 /// Note: It is not defined in UEFI 2.3 Specification.\r
abbfadd7 132 /// EFI_ABORTED: The active open is aborted.\r
133 /// EFI_TIMEOUT: The connection establishment timer expires and \r
134 /// no more specific information is available.\r
135 /// EFI_NETWORK_UNREACHABLE: The active open fails because \r
136 /// an ICMP network unreachable error is received. \r
137 /// EFI_HOST_UNREACHABLE: The active open fails because an \r
138 /// ICMP host unreachable error is received. \r
139 /// EFI_PROTOCOL_UNREACHABLE: The active open fails \r
140 /// because an ICMP protocol unreachable error is received.\r
141 /// EFI_PORT_UNREACHABLE: The connection establishment \r
142 /// timer times out and an ICMP port unreachable error is received.\r
143 /// EFI_ICMP_ERROR: The connection establishment timer timeout and some other ICMP\r
144 /// error is received.\r
145 /// EFI_DEVICE_ERROR: An unexpected system or network error occurred.\r
146 /// \r
d1f95000 147 EFI_TCP4_COMPLETION_TOKEN CompletionToken;\r
148} EFI_TCP4_CONNECTION_TOKEN;\r
149\r
150typedef struct {\r
151 EFI_TCP4_COMPLETION_TOKEN CompletionToken;\r
152 EFI_HANDLE NewChildHandle;\r
153} EFI_TCP4_LISTEN_TOKEN;\r
154\r
155typedef struct {\r
d01c093a 156 UINT32 FragmentLength;\r
157 VOID *FragmentBuffer;\r
d1f95000 158} EFI_TCP4_FRAGMENT_DATA;\r
159\r
160typedef struct {\r
161 BOOLEAN UrgentFlag;\r
d01c093a 162 UINT32 DataLength;\r
163 UINT32 FragmentCount;\r
d1f95000 164 EFI_TCP4_FRAGMENT_DATA FragmentTable[1];\r
d01c093a 165} EFI_TCP4_RECEIVE_DATA;\r
d1f95000 166\r
d01c093a 167typedef struct {\r
d1f95000 168 BOOLEAN Push;\r
169 BOOLEAN Urgent;\r
d01c093a 170 UINT32 DataLength;\r
171 UINT32 FragmentCount;\r
d1f95000 172 EFI_TCP4_FRAGMENT_DATA FragmentTable[1];\r
173} EFI_TCP4_TRANSMIT_DATA;\r
174\r
175typedef struct {\r
abbfadd7 176 /// \r
177 /// When transmission finishes or meets any unexpected error it will \r
178 /// be set to one of the following values:\r
179 /// EFI_SUCCESS: The receiving or transmission operation \r
180 /// completes successfully.\r
181 /// EFI_CONNECTION_FIN: The receiving operation fails because the communication peer \r
182 /// has closed the connection and there is no more data in the \r
183 /// receive buffer of the instance.\r
3a7afaf6 184 /// Note: It is not defined in UEFI 2.3 Specification.\r
abbfadd7 185 /// EFI_CONNECTION_RESET: The receiving or transmission operation fails\r
186 /// because this connection is reset either by instance \r
187 /// itself or the communication peer.\r
188 /// EFI_ABORTED: The receiving or transmission is aborted.\r
189 /// EFI_TIMEOUT: The transmission timer expires and no more \r
190 /// specific information is available.\r
191 /// EFI_NETWORK_UNREACHABLE: The transmission fails \r
192 /// because an ICMP network unreachable error is received. \r
193 /// EFI_HOST_UNREACHABLE: The transmission fails because an \r
194 /// ICMP host unreachable error is received. \r
195 /// EFI_PROTOCOL_UNREACHABLE: The transmission fails \r
196 /// because an ICMP protocol unreachable error is received. \r
197 /// EFI_PORT_UNREACHABLE: The transmission fails and an \r
198 /// ICMP port unreachable error is received. \r
199 /// EFI_ICMP_ERROR: The transmission fails and some other \r
200 /// ICMP error is received. \r
201 /// EFI_DEVICE_ERROR: An unexpected system or network error occurs.\r
202 /// EFI_NO_MEDIA: There was a media error.\r
203 ///\r
d1f95000 204 EFI_TCP4_COMPLETION_TOKEN CompletionToken;\r
205 union {\r
abbfadd7 206 ///\r
207 /// When this token is used for receiving, RxData is a pointer to EFI_TCP4_RECEIVE_DATA.\r
208 ///\r
d1f95000 209 EFI_TCP4_RECEIVE_DATA *RxData;\r
abbfadd7 210 ///\r
211 /// When this token is used for transmitting, TxData is a pointer to EFI_TCP4_TRANSMIT_DATA.\r
212 ///\r
d1f95000 213 EFI_TCP4_TRANSMIT_DATA *TxData;\r
214 } Packet;\r
215} EFI_TCP4_IO_TOKEN;\r
216\r
217typedef struct {\r
218 EFI_TCP4_COMPLETION_TOKEN CompletionToken;\r
219 BOOLEAN AbortOnClose;\r
220} EFI_TCP4_CLOSE_TOKEN;\r
221\r
222//\r
223// Interface definition for TCP4 protocol\r
224//\r
225\r
226/**\r
227 Get the current operational status.\r
228\r
229 @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
230 @param Tcp4State Pointer to the buffer to receive the current TCP state.\r
231 @param Tcp4ConfigData Pointer to the buffer to receive the current TCP configuration.\r
232 @param Ip4ModeData Pointer to the buffer to receive the current IPv4 configuration\r
233 data used by the TCPv4 instance.\r
234 @param MnpConfigData Pointer to the buffer to receive the current MNP configuration\r
235 data used indirectly by the TCPv4 instance.\r
236 @param SnpModeData Pointer to the buffer to receive the current SNP configuration\r
237 data used indirectly by the TCPv4 instance.\r
238\r
239 @retval EFI_SUCCESS The mode data was read.\r
240 @retval EFI_INVALID_PARAMETER This is NULL.\r
241 @retval EFI_NOT_STARTED No configuration data is available because this instance hasn't\r
242 been started.\r
243\r
244**/\r
245typedef\r
246EFI_STATUS\r
8b13229b 247(EFIAPI *EFI_TCP4_GET_MODE_DATA)(\r
d1f95000 248 IN CONST EFI_TCP4_PROTOCOL *This,\r
249 OUT EFI_TCP4_CONNECTION_STATE *Tcp4State OPTIONAL,\r
250 OUT EFI_TCP4_CONFIG_DATA *Tcp4ConfigData OPTIONAL,\r
251 OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL,\r
252 OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,\r
253 OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL\r
ed66e1bc 254 );\r
d01c093a 255\r
d1f95000 256/**\r
257 Initialize or brutally reset the operational parameters for this EFI TCPv4 instance.\r
258\r
259 @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
260 @param Tcp4ConfigData Pointer to the configure data to configure the instance.\r
261\r
262 @retval EFI_SUCCESS The operational settings are set, changed, or reset\r
263 successfully.\r
264 @retval EFI_INVALID_PARAMETER Some parameter is invalid.\r
265 @retval EFI_NO_MAPPING When using a default address, configuration (through\r
266 DHCP, BOOTP, RARP, etc.) is not finished yet.\r
267 @retval EFI_ACCESS_DENIED Configuring TCP instance when it is configured without\r
268 calling Configure() with NULL to reset it.\r
269 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.\r
270 @retval EFI_UNSUPPORTED One or more of the control options are not supported in\r
271 the implementation.\r
272 @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources when\r
273 executing Configure().\r
274\r
275**/\r
276typedef\r
277EFI_STATUS\r
8b13229b 278(EFIAPI *EFI_TCP4_CONFIGURE)(\r
d1f95000 279 IN EFI_TCP4_PROTOCOL *This,\r
280 IN EFI_TCP4_CONFIG_DATA *TcpConfigData OPTIONAL\r
ed66e1bc 281 );\r
d01c093a 282\r
d1f95000 283\r
284/**\r
285 Add or delete a route entry to the route table\r
286\r
287 @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
288 @param DeleteRoute Set it to TRUE to delete this route from the routing table. Set it to\r
289 FALSE to add this route to the routing table.\r
290 DestinationAddress and SubnetMask are used as the\r
291 keywords to search route entry.\r
292 @param SubnetAddress The destination network.\r
293 @param SubnetMask The subnet mask of the destination network.\r
294 @param GatewayAddress The gateway address for this route. It must be on the same\r
295 subnet with the station address unless a direct route is specified.\r
296\r
297 @retval EFI_SUCCESS The operation completed successfully.\r
298 @retval EFI_NOT_STARTED The EFI TCPv4 Protocol instance has not been configured.\r
299 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,\r
300 RARP, etc.) is not finished yet.\r
301 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
302 - This is NULL.\r
303 - SubnetAddress is NULL.\r
304 - SubnetMask is NULL.\r
305 - GatewayAddress is NULL.\r
306 - *SubnetAddress is not NULL a valid subnet address.\r
307 - *SubnetMask is not a valid subnet mask.\r
308 - *GatewayAddress is not a valid unicast IP address or it\r
309 is not in the same subnet.\r
310 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to add the entry to the\r
311 routing table.\r
312 @retval EFI_NOT_FOUND This route is not in the routing table.\r
313 @retval EFI_ACCESS_DENIED The route is already defined in the routing table.\r
314 @retval EFI_UNSUPPORTED The TCP driver does not support this operation.\r
315\r
316**/\r
317typedef\r
318EFI_STATUS\r
8b13229b 319(EFIAPI *EFI_TCP4_ROUTES)(\r
d1f95000 320 IN EFI_TCP4_PROTOCOL *This,\r
321 IN BOOLEAN DeleteRoute,\r
322 IN EFI_IPv4_ADDRESS *SubnetAddress,\r
323 IN EFI_IPv4_ADDRESS *SubnetMask,\r
324 IN EFI_IPv4_ADDRESS *GatewayAddress\r
ed66e1bc 325 );\r
d1f95000 326\r
327/**\r
328 Initiate a nonblocking TCP connection request for an active TCP instance.\r
329\r
330 @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
331 @param ConnectionToken Pointer to the connection token to return when the TCP three\r
332 way handshake finishes.\r
d01c093a 333\r
d1f95000 334 @retval EFI_SUCCESS The connection request is successfully initiated and the state\r
bdb140d7 335 of this TCPv4 instance has been changed to Tcp4StateSynSent.\r
d1f95000 336 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.\r
337 @retval EFI_ACCESS_DENIED One or more of the following conditions are TRUE:\r
338 - This instance is not configured as an active one.\r
339 - This instance is not in Tcp4StateClosed state.\r
340 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:\r
341 - This is NULL.\r
342 - ConnectionToken is NULL.\r
343 - ConnectionToken->CompletionToken.Event is NULL.\r
bdb140d7 344 @retval EFI_OUT_OF_RESOURCES The driver can't allocate enough resource to initiate the activ eopen.\r
d1f95000 345 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
346\r
347**/\r
348typedef\r
349EFI_STATUS\r
8b13229b 350(EFIAPI *EFI_TCP4_CONNECT)(\r
d1f95000 351 IN EFI_TCP4_PROTOCOL *This,\r
352 IN EFI_TCP4_CONNECTION_TOKEN *ConnectionToken\r
ed66e1bc 353 );\r
d01c093a 354\r
d1f95000 355\r
356/**\r
357 Listen on the passive instance to accept an incoming connection request. This is a nonblocking operation.\r
358\r
359 @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
360 @param ListenToken Pointer to the listen token to return when operation finishes.\r
361\r
362 @retval EFI_SUCCESS The listen token has been queued successfully.\r
363 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.\r
364 @retval EFI_ACCESS_DENIED One or more of the following are TRUE:\r
365 - This instance is not a passive instance.\r
366 - This instance is not in Tcp4StateListen state.\r
367 - The same listen token has already existed in the listen\r
368 token queue of this TCP instance.\r
369 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:\r
370 - This is NULL.\r
371 - ListenToken is NULL.\r
372 - ListentToken->CompletionToken.Event is NULL.\r
f754f721 373 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resource to finish the operation.\r
374 @retval EFI_DEVICE_ERROR Any unexpected and not belonged to above category error.\r
d1f95000 375\r
376**/\r
377typedef\r
378EFI_STATUS\r
8b13229b 379(EFIAPI *EFI_TCP4_ACCEPT)(\r
d1f95000 380 IN EFI_TCP4_PROTOCOL *This,\r
381 IN EFI_TCP4_LISTEN_TOKEN *ListenToken\r
ed66e1bc 382 );\r
d1f95000 383\r
384/**\r
385 Queues outgoing data into the transmit queue.\r
386\r
387 @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
388 @param Token Pointer to the completion token to queue to the transmit queue.\r
389\r
390 @retval EFI_SUCCESS The data has been queued for transmission.\r
391 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.\r
392 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,\r
393 RARP, etc.) is not finished yet.\r
394 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:\r
395 - This is NULL.\r
396 - Token is NULL.\r
397 - Token->CompletionToken.Event is NULL.\r
398 - Token->Packet.TxData is NULL L.\r
399 - Token->Packet.FragmentCount is zero.\r
400 - Token->Packet.DataLength is not equal to the sum of fragment lengths.\r
401 @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:\r
402 - A transmit completion token with the same Token->CompletionToken.Event\r
403 was already in the transmission queue.\r
404 - The current instance is in Tcp4StateClosed state.\r
405 - The current instance is a passive one and it is in\r
406 Tcp4StateListen state.\r
407 - User has called Close() to disconnect this connection.\r
408 @retval EFI_NOT_READY The completion token could not be queued because the\r
409 transmit queue is full.\r
410 @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data because of resource\r
411 shortage.\r
412 @retval EFI_NETWORK_UNREACHABLE There is no route to the destination network or address.\r
413\r
414**/\r
415typedef\r
416EFI_STATUS\r
8b13229b 417(EFIAPI *EFI_TCP4_TRANSMIT)(\r
d1f95000 418 IN EFI_TCP4_PROTOCOL *This,\r
419 IN EFI_TCP4_IO_TOKEN *Token\r
ed66e1bc 420 );\r
d1f95000 421\r
422\r
423/**\r
424 Places an asynchronous receive request into the receiving queue.\r
425\r
426 @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
427 @param Token Pointer to a token that is associated with the receive data\r
428 descriptor.\r
429\r
430 @retval EFI_SUCCESS The receive completion token was cached.\r
431 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.\r
432 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP, RARP,\r
433 etc.) is not finished yet.\r
434 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
435 - This is NULL.\r
436 - Token is NULL.\r
437 - Token->CompletionToken.Event is NULL.\r
438 - Token->Packet.RxData is NULL.\r
439 - Token->Packet.RxData->DataLength is 0.\r
440 - The Token->Packet.RxData->DataLength is not\r
441 the sum of all FragmentBuffer length in FragmentTable.\r
442 @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued due to a lack of\r
443 system resources (usually memory).\r
444 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
445 @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:\r
446 - A receive completion token with the same Token-\r
447 >CompletionToken.Event was already in the receive\r
448 queue.\r
449 - The current instance is in Tcp4StateClosed state.\r
450 - The current instance is a passive one and it is in\r
451 Tcp4StateListen state.\r
452 - User has called Close() to disconnect this connection.\r
453 @retval EFI_CONNECTION_FIN The communication peer has closed the connection and there is\r
f754f721 454 no any buffered data in the receive buffer of this instance.\r
d1f95000 455 @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.\r
456\r
457**/\r
458typedef\r
459EFI_STATUS\r
8b13229b 460(EFIAPI *EFI_TCP4_RECEIVE)(\r
d1f95000 461 IN EFI_TCP4_PROTOCOL *This,\r
462 IN EFI_TCP4_IO_TOKEN *Token\r
ed66e1bc 463 );\r
d01c093a 464\r
d1f95000 465/**\r
466 Disconnecting a TCP connection gracefully or reset a TCP connection. This function is a\r
d01c093a 467 nonblocking operation.\r
d1f95000 468\r
469 @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
470 @param CloseToken Pointer to the close token to return when operation finishes.\r
471\r
472 @retval EFI_SUCCESS The Close() is called successfully.\r
473 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.\r
474 @retval EFI_ACCESS_DENIED One or more of the following are TRUE:\r
475 - Configure() has been called with\r
476 TcpConfigData set to NULL and this function has\r
477 not returned.\r
478 - Previous Close() call on this instance has not\r
479 finished.\r
480 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:\r
481 - This is NULL.\r
482 - CloseToken is NULL.\r
483 - CloseToken->CompletionToken.Event is NULL.\r
f754f721 484 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resource to finish the operation.\r
485 @retval EFI_DEVICE_ERROR Any unexpected and not belonged to above category error.\r
d1f95000 486\r
487**/\r
488typedef\r
489EFI_STATUS\r
8b13229b 490(EFIAPI *EFI_TCP4_CLOSE)(\r
d1f95000 491 IN EFI_TCP4_PROTOCOL *This,\r
492 IN EFI_TCP4_CLOSE_TOKEN *CloseToken\r
ed66e1bc 493 );\r
d1f95000 494\r
495/**\r
496 Abort an asynchronous connection, listen, transmission or receive request.\r
497\r
498 @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
499 @param Token Pointer to a token that has been issued by\r
500 EFI_TCP4_PROTOCOL.Connect(),\r
501 EFI_TCP4_PROTOCOL.Accept(),\r
502 EFI_TCP4_PROTOCOL.Transmit() or\r
503 EFI_TCP4_PROTOCOL.Receive(). If NULL, all pending\r
504 tokens issued by above four functions will be aborted. Type\r
505 EFI_TCP4_COMPLETION_TOKEN is defined in\r
506 EFI_TCP4_PROTOCOL.Connect().\r
507\r
bdb140d7 508 @retval EFI_SUCCESS The asynchronous I/O request is aborted and Token->Event\r
509 is signaled.\r
510 @retval EFI_INVALID_PARAMETER This is NULL.\r
511 @retval EFI_NOT_STARTED This instance hasn't been configured.\r
512 @retval EFI_NO_MAPPING When using the default address, configuration\r
513 (DHCP, BOOTP,RARP, etc.) hasn't finished yet.\r
514 @retval EFI_NOT_FOUND The asynchronous I/O request isn't found in the \r
515 transmission or receive queue. It has either \r
516 completed or wasn't issued by Transmit() and Receive().\r
abbfadd7 517 @retval EFI_UNSUPPORTED The implementation does not support this function.\r
3a7afaf6 518 Note: It is not defined in UEFI 2.3 Specification.\r
d1f95000 519\r
520**/\r
521typedef\r
522EFI_STATUS\r
8b13229b 523(EFIAPI *EFI_TCP4_CANCEL)(\r
d1f95000 524 IN EFI_TCP4_PROTOCOL *This,\r
525 IN EFI_TCP4_COMPLETION_TOKEN *Token OPTIONAL\r
ed66e1bc 526 );\r
d1f95000 527\r
528\r
529/**\r
530 Poll to receive incoming data and transmit outgoing segments.\r
531\r
532 @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
533\r
534 @retval EFI_SUCCESS Incoming or outgoing data was processed.\r
535 @retval EFI_INVALID_PARAMETER This is NULL.\r
536 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
537 @retval EFI_NOT_READY No incoming or outgoing data is processed.\r
538 @retval EFI_TIMEOUT Data was dropped out of the transmission or receive queue.\r
539 Consider increasing the polling rate.\r
540\r
541**/\r
542typedef\r
543EFI_STATUS\r
8b13229b 544(EFIAPI *EFI_TCP4_POLL)(\r
d1f95000 545 IN EFI_TCP4_PROTOCOL *This\r
ed66e1bc 546 );\r
d1f95000 547\r
44717a39 548///\r
549/// The EFI_TCP4_PROTOCOL defines the EFI TCPv4 Protocol child to be used by \r
550/// any network drivers or applications to send or receive data stream. \r
551/// It can either listen on a specified port as a service or actively connected \r
552/// to remote peer as a client. Each instance has its own independent settings, \r
553/// such as the routing table.\r
554///\r
d1f95000 555struct _EFI_TCP4_PROTOCOL {\r
556 EFI_TCP4_GET_MODE_DATA GetModeData;\r
557 EFI_TCP4_CONFIGURE Configure;\r
558 EFI_TCP4_ROUTES Routes;\r
559 EFI_TCP4_CONNECT Connect;\r
560 EFI_TCP4_ACCEPT Accept;\r
561 EFI_TCP4_TRANSMIT Transmit;\r
562 EFI_TCP4_RECEIVE Receive;\r
563 EFI_TCP4_CLOSE Close;\r
564 EFI_TCP4_CANCEL Cancel;\r
565 EFI_TCP4_POLL Poll;\r
566};\r
567\r
d1f95000 568extern EFI_GUID gEfiTcp4ServiceBindingProtocolGuid;\r
569extern EFI_GUID gEfiTcp4ProtocolGuid;\r
570\r
571#endif\r