]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/Tcp4.h
MdePkg: Replace BSD License with BSD+Patent License
[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
8377875b 37 EFI_HANDLE InstanceHandle;\r
d1f95000 38 EFI_IPv4_ADDRESS LocalAddress;\r
39 UINT16 LocalPort;\r
40 EFI_IPv4_ADDRESS RemoteAddress;\r
41 UINT16 RemotePort;\r
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
49 EFI_HANDLE DriverHandle;\r
50 UINT32 ServiceCount;\r
51 EFI_TCP4_SERVICE_POINT Services[1];\r
52} EFI_TCP4_VARIABLE_DATA;\r
53\r
54typedef struct {\r
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
62} EFI_TCP4_ACCESS_POINT;\r
63\r
64typedef struct {\r
d01c093a 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
d1f95000 75 BOOLEAN EnableNagle;\r
76 BOOLEAN EnableTimeStamp;\r
77 BOOLEAN EnableWindowScaling;\r
78 BOOLEAN EnableSelectiveAck;\r
79 BOOLEAN EnablePathMtuDiscovery;\r
80} EFI_TCP4_OPTION;\r
81\r
82typedef struct {\r
83 //\r
84 // I/O parameters\r
85 //\r
86 UINT8 TypeOfService;\r
87 UINT8 TimeToLive;\r
88\r
89 //\r
90 // Access Point\r
91 //\r
92 EFI_TCP4_ACCESS_POINT AccessPoint;\r
d01c093a 93\r
94 //\r
95 // TCP Control Options\r
96 //\r
d1f95000 97 EFI_TCP4_OPTION *ControlOption;\r
98} EFI_TCP4_CONFIG_DATA;\r
99\r
9319d2c2
LG
100///\r
101/// TCP4 connnection state\r
102///\r
d1f95000 103typedef enum {\r
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
115} EFI_TCP4_CONNECTION_STATE;\r
116\r
117typedef struct {\r
118 EFI_EVENT Event;\r
119 EFI_STATUS Status;\r
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
d1f95000 149 EFI_TCP4_COMPLETION_TOKEN CompletionToken;\r
150} EFI_TCP4_CONNECTION_TOKEN;\r
151\r
152typedef struct {\r
153 EFI_TCP4_COMPLETION_TOKEN CompletionToken;\r
154 EFI_HANDLE NewChildHandle;\r
155} EFI_TCP4_LISTEN_TOKEN;\r
156\r
157typedef struct {\r
d01c093a 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
d1f95000 205 EFI_TCP4_COMPLETION_TOKEN CompletionToken;\r
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
d1f95000 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
d1f95000 214 EFI_TCP4_TRANSMIT_DATA *TxData;\r
215 } Packet;\r
216} EFI_TCP4_IO_TOKEN;\r
217\r
218typedef struct {\r
219 EFI_TCP4_COMPLETION_TOKEN CompletionToken;\r
220 BOOLEAN AbortOnClose;\r
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/**\r
286 Add or delete a route entry to the route table\r
287\r
af2dc6a7 288 @param This The pointer to the EFI_TCP4_PROTOCOL instance.\r
d1f95000 289 @param DeleteRoute Set it to TRUE to delete this route from the routing table. Set it to\r
290 FALSE to add this route to the routing table.\r
291 DestinationAddress and SubnetMask are used as the\r
292 keywords to search route entry.\r
293 @param SubnetAddress The destination network.\r
294 @param SubnetMask The subnet mask of the destination network.\r
295 @param GatewayAddress The gateway address for this route. It must be on the same\r
296 subnet with the station address unless a direct route is specified.\r
297\r
298 @retval EFI_SUCCESS The operation completed successfully.\r
299 @retval EFI_NOT_STARTED The EFI TCPv4 Protocol instance has not been configured.\r
300 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,\r
301 RARP, etc.) is not finished yet.\r
302 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
303 - This is NULL.\r
304 - SubnetAddress is NULL.\r
305 - SubnetMask is NULL.\r
306 - GatewayAddress is NULL.\r
307 - *SubnetAddress is not NULL a valid subnet address.\r
308 - *SubnetMask is not a valid subnet mask.\r
309 - *GatewayAddress is not a valid unicast IP address or it\r
310 is not in the same subnet.\r
311 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to add the entry to the\r
312 routing table.\r
313 @retval EFI_NOT_FOUND This route is not in the routing table.\r
314 @retval EFI_ACCESS_DENIED The route is already defined in the routing table.\r
315 @retval EFI_UNSUPPORTED The TCP driver does not support this operation.\r
316\r
317**/\r
318typedef\r
319EFI_STATUS\r
8b13229b 320(EFIAPI *EFI_TCP4_ROUTES)(\r
d1f95000 321 IN EFI_TCP4_PROTOCOL *This,\r
322 IN BOOLEAN DeleteRoute,\r
323 IN EFI_IPv4_ADDRESS *SubnetAddress,\r
324 IN EFI_IPv4_ADDRESS *SubnetMask,\r
325 IN EFI_IPv4_ADDRESS *GatewayAddress\r
ed66e1bc 326 );\r
d1f95000 327\r
328/**\r
329 Initiate a nonblocking TCP connection request for an active TCP instance.\r
330\r
af2dc6a7 331 @param This The pointer to the EFI_TCP4_PROTOCOL instance.\r
332 @param ConnectionToken The pointer to the connection token to return when the TCP three\r
d1f95000 333 way handshake finishes.\r
d01c093a 334\r
d1f95000 335 @retval EFI_SUCCESS The connection request is successfully initiated and the state\r
bdb140d7 336 of this TCPv4 instance has been changed to Tcp4StateSynSent.\r
d1f95000 337 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.\r
338 @retval EFI_ACCESS_DENIED One or more of the following conditions are TRUE:\r
339 - This instance is not configured as an active one.\r
340 - This instance is not in Tcp4StateClosed state.\r
341 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:\r
342 - This is NULL.\r
343 - ConnectionToken is NULL.\r
344 - ConnectionToken->CompletionToken.Event is NULL.\r
bdb140d7 345 @retval EFI_OUT_OF_RESOURCES The driver can't allocate enough resource to initiate the activ eopen.\r
d1f95000 346 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
347\r
348**/\r
349typedef\r
350EFI_STATUS\r
8b13229b 351(EFIAPI *EFI_TCP4_CONNECT)(\r
d1f95000 352 IN EFI_TCP4_PROTOCOL *This,\r
353 IN EFI_TCP4_CONNECTION_TOKEN *ConnectionToken\r
ed66e1bc 354 );\r
d01c093a 355\r
d1f95000 356\r
357/**\r
358 Listen on the passive instance to accept an incoming connection request. This is a nonblocking operation.\r
359\r
af2dc6a7 360 @param This The pointer to the EFI_TCP4_PROTOCOL instance.\r
361 @param ListenToken The pointer to the listen token to return when operation finishes.\r
d1f95000 362\r
363 @retval EFI_SUCCESS The listen token has been queued successfully.\r
364 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.\r
365 @retval EFI_ACCESS_DENIED One or more of the following are TRUE:\r
366 - This instance is not a passive instance.\r
367 - This instance is not in Tcp4StateListen state.\r
368 - The same listen token has already existed in the listen\r
369 token queue of this TCP instance.\r
370 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:\r
371 - This is NULL.\r
372 - ListenToken is NULL.\r
373 - ListentToken->CompletionToken.Event is NULL.\r
f754f721 374 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resource to finish the operation.\r
375 @retval EFI_DEVICE_ERROR Any unexpected and not belonged to above category error.\r
d1f95000 376\r
377**/\r
378typedef\r
379EFI_STATUS\r
8b13229b 380(EFIAPI *EFI_TCP4_ACCEPT)(\r
d1f95000 381 IN EFI_TCP4_PROTOCOL *This,\r
382 IN EFI_TCP4_LISTEN_TOKEN *ListenToken\r
ed66e1bc 383 );\r
d1f95000 384\r
385/**\r
386 Queues outgoing data into the transmit queue.\r
387\r
af2dc6a7 388 @param This The pointer to the EFI_TCP4_PROTOCOL instance.\r
389 @param Token The pointer to the completion token to queue to the transmit queue.\r
d1f95000 390\r
391 @retval EFI_SUCCESS The data has been queued for transmission.\r
392 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.\r
393 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,\r
394 RARP, etc.) is not finished yet.\r
395 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:\r
396 - This is NULL.\r
397 - Token is NULL.\r
398 - Token->CompletionToken.Event is NULL.\r
399 - Token->Packet.TxData is NULL L.\r
400 - Token->Packet.FragmentCount is zero.\r
401 - Token->Packet.DataLength is not equal to the sum of fragment lengths.\r
402 @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:\r
403 - A transmit completion token with the same Token->CompletionToken.Event\r
404 was already in the transmission queue.\r
405 - The current instance is in Tcp4StateClosed state.\r
406 - The current instance is a passive one and it is in\r
407 Tcp4StateListen state.\r
408 - User has called Close() to disconnect this connection.\r
409 @retval EFI_NOT_READY The completion token could not be queued because the\r
410 transmit queue is full.\r
411 @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data because of resource\r
412 shortage.\r
413 @retval EFI_NETWORK_UNREACHABLE There is no route to the destination network or address.\r
414\r
415**/\r
416typedef\r
417EFI_STATUS\r
8b13229b 418(EFIAPI *EFI_TCP4_TRANSMIT)(\r
d1f95000 419 IN EFI_TCP4_PROTOCOL *This,\r
420 IN EFI_TCP4_IO_TOKEN *Token\r
ed66e1bc 421 );\r
d1f95000 422\r
423\r
424/**\r
425 Places an asynchronous receive request into the receiving queue.\r
426\r
af2dc6a7 427 @param This The pointer to the EFI_TCP4_PROTOCOL instance.\r
428 @param Token The pointer to a token that is associated with the receive data\r
d1f95000 429 descriptor.\r
430\r
431 @retval EFI_SUCCESS The receive completion token was cached.\r
432 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.\r
433 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP, RARP,\r
434 etc.) is not finished yet.\r
435 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
436 - This is NULL.\r
437 - Token is NULL.\r
438 - Token->CompletionToken.Event is NULL.\r
439 - Token->Packet.RxData is NULL.\r
440 - Token->Packet.RxData->DataLength is 0.\r
441 - The Token->Packet.RxData->DataLength is not\r
442 the sum of all FragmentBuffer length in FragmentTable.\r
443 @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued due to a lack of\r
444 system resources (usually memory).\r
445 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
446 @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:\r
447 - A receive completion token with the same Token-\r
448 >CompletionToken.Event was already in the receive\r
449 queue.\r
450 - The current instance is in Tcp4StateClosed state.\r
451 - The current instance is a passive one and it is in\r
452 Tcp4StateListen state.\r
453 - User has called Close() to disconnect this connection.\r
454 @retval EFI_CONNECTION_FIN The communication peer has closed the connection and there is\r
f754f721 455 no any buffered data in the receive buffer of this instance.\r
d1f95000 456 @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.\r
457\r
458**/\r
459typedef\r
460EFI_STATUS\r
8b13229b 461(EFIAPI *EFI_TCP4_RECEIVE)(\r
d1f95000 462 IN EFI_TCP4_PROTOCOL *This,\r
463 IN EFI_TCP4_IO_TOKEN *Token\r
ed66e1bc 464 );\r
d01c093a 465\r
d1f95000 466/**\r
467 Disconnecting a TCP connection gracefully or reset a TCP connection. This function is a\r
d01c093a 468 nonblocking operation.\r
d1f95000 469\r
af2dc6a7 470 @param This The pointer to the EFI_TCP4_PROTOCOL instance.\r
471 @param CloseToken The pointer to the close token to return when operation finishes.\r
d1f95000 472\r
473 @retval EFI_SUCCESS The Close() is called successfully.\r
474 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.\r
475 @retval EFI_ACCESS_DENIED One or more of the following are TRUE:\r
476 - Configure() has been called with\r
477 TcpConfigData set to NULL and this function has\r
478 not returned.\r
479 - Previous Close() call on this instance has not\r
480 finished.\r
481 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:\r
482 - This is NULL.\r
483 - CloseToken is NULL.\r
484 - CloseToken->CompletionToken.Event is NULL.\r
f754f721 485 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resource to finish the operation.\r
486 @retval EFI_DEVICE_ERROR Any unexpected and not belonged to above category error.\r
d1f95000 487\r
488**/\r
489typedef\r
490EFI_STATUS\r
8b13229b 491(EFIAPI *EFI_TCP4_CLOSE)(\r
d1f95000 492 IN EFI_TCP4_PROTOCOL *This,\r
493 IN EFI_TCP4_CLOSE_TOKEN *CloseToken\r
ed66e1bc 494 );\r
d1f95000 495\r
496/**\r
497 Abort an asynchronous connection, listen, transmission or receive request.\r
498\r
af2dc6a7 499 @param This The pointer to the EFI_TCP4_PROTOCOL instance.\r
500 @param Token The pointer to a token that has been issued by\r
d1f95000 501 EFI_TCP4_PROTOCOL.Connect(),\r
502 EFI_TCP4_PROTOCOL.Accept(),\r
503 EFI_TCP4_PROTOCOL.Transmit() or\r
504 EFI_TCP4_PROTOCOL.Receive(). If NULL, all pending\r
505 tokens issued by above four functions will be aborted. Type\r
506 EFI_TCP4_COMPLETION_TOKEN is defined in\r
507 EFI_TCP4_PROTOCOL.Connect().\r
508\r
bdb140d7 509 @retval EFI_SUCCESS The asynchronous I/O request is aborted and Token->Event\r
510 is signaled.\r
511 @retval EFI_INVALID_PARAMETER This is NULL.\r
512 @retval EFI_NOT_STARTED This instance hasn't been configured.\r
513 @retval EFI_NO_MAPPING When using the default address, configuration\r
514 (DHCP, BOOTP,RARP, etc.) hasn't finished yet.\r
bce46f7e 515 @retval EFI_NOT_FOUND The asynchronous I/O request isn't found in the\r
516 transmission or receive queue. It has either\r
bdb140d7 517 completed or wasn't issued by Transmit() and Receive().\r
abbfadd7 518 @retval EFI_UNSUPPORTED The implementation does not support this function.\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
af2dc6a7 532 @param This The pointer to the EFI_TCP4_PROTOCOL instance.\r
d1f95000 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
bce46f7e 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
44717a39 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