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