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