]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/Tcp4.h
Add the missing check for NULL pointer before use it.
[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
c5c3e7e2 7 Copyright (c) 2006 - 2010, 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
c5c3e7e2 146 /// EFI_NO_MEDIA: There was a media error.\r
abbfadd7 147 /// \r
d1f95000 148 EFI_TCP4_COMPLETION_TOKEN CompletionToken;\r
149} EFI_TCP4_CONNECTION_TOKEN;\r
150\r
151typedef struct {\r
152 EFI_TCP4_COMPLETION_TOKEN CompletionToken;\r
153 EFI_HANDLE NewChildHandle;\r
154} EFI_TCP4_LISTEN_TOKEN;\r
155\r
156typedef struct {\r
d01c093a 157 UINT32 FragmentLength;\r
158 VOID *FragmentBuffer;\r
d1f95000 159} EFI_TCP4_FRAGMENT_DATA;\r
160\r
161typedef struct {\r
162 BOOLEAN UrgentFlag;\r
d01c093a 163 UINT32 DataLength;\r
164 UINT32 FragmentCount;\r
d1f95000 165 EFI_TCP4_FRAGMENT_DATA FragmentTable[1];\r
d01c093a 166} EFI_TCP4_RECEIVE_DATA;\r
d1f95000 167\r
d01c093a 168typedef struct {\r
d1f95000 169 BOOLEAN Push;\r
170 BOOLEAN Urgent;\r
d01c093a 171 UINT32 DataLength;\r
172 UINT32 FragmentCount;\r
d1f95000 173 EFI_TCP4_FRAGMENT_DATA FragmentTable[1];\r
174} EFI_TCP4_TRANSMIT_DATA;\r
175\r
176typedef struct {\r
abbfadd7 177 /// \r
178 /// When transmission finishes or meets any unexpected error it will \r
179 /// be set to one of the following values:\r
180 /// EFI_SUCCESS: The receiving or transmission operation \r
181 /// completes successfully.\r
182 /// EFI_CONNECTION_FIN: The receiving operation fails because the communication peer \r
183 /// has closed the connection and there is no more data in the \r
184 /// receive buffer of the instance.\r
3a7afaf6 185 /// Note: It is not defined in UEFI 2.3 Specification.\r
abbfadd7 186 /// EFI_CONNECTION_RESET: The receiving or transmission operation fails\r
187 /// because this connection is reset either by instance \r
188 /// itself or the communication peer.\r
189 /// EFI_ABORTED: The receiving or transmission is aborted.\r
190 /// EFI_TIMEOUT: The transmission timer expires and no more \r
191 /// specific information is available.\r
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
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
230 @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
231 @param Tcp4State Pointer to the buffer to receive the current TCP state.\r
232 @param Tcp4ConfigData Pointer to the buffer to receive the current TCP configuration.\r
233 @param Ip4ModeData Pointer to the buffer to receive the current IPv4 configuration\r
234 data used by the TCPv4 instance.\r
235 @param MnpConfigData Pointer to the buffer to receive the current MNP configuration\r
236 data used indirectly by the TCPv4 instance.\r
237 @param SnpModeData Pointer to the buffer to receive the current SNP configuration\r
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
d1f95000 249 IN CONST 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
260 @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
261 @param Tcp4ConfigData Pointer to the configure data to configure the instance.\r
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
288 @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
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
331 @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
332 @param ConnectionToken Pointer to the connection token to return when the TCP three\r
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
360 @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
361 @param ListenToken Pointer to the listen token to return when operation finishes.\r
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
388 @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
389 @param Token Pointer to the completion token to queue to the transmit queue.\r
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
427 @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
428 @param Token Pointer to a token that is associated with the receive data\r
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
470 @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
471 @param CloseToken Pointer to the close token to return when operation finishes.\r
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
499 @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
500 @param Token Pointer to a token that has been issued by\r
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
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
517 completed or wasn't issued by Transmit() and Receive().\r
abbfadd7 518 @retval EFI_UNSUPPORTED The implementation does not support this function.\r
3a7afaf6 519 Note: It is not defined in UEFI 2.3 Specification.\r
d1f95000 520\r
521**/\r
522typedef\r
523EFI_STATUS\r
8b13229b 524(EFIAPI *EFI_TCP4_CANCEL)(\r
d1f95000 525 IN EFI_TCP4_PROTOCOL *This,\r
526 IN EFI_TCP4_COMPLETION_TOKEN *Token OPTIONAL\r
ed66e1bc 527 );\r
d1f95000 528\r
529\r
530/**\r
531 Poll to receive incoming data and transmit outgoing segments.\r
532\r
533 @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
534\r
535 @retval EFI_SUCCESS Incoming or outgoing data was processed.\r
536 @retval EFI_INVALID_PARAMETER This is NULL.\r
537 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
538 @retval EFI_NOT_READY No incoming or outgoing data is processed.\r
539 @retval EFI_TIMEOUT Data was dropped out of the transmission or receive queue.\r
540 Consider increasing the polling rate.\r
541\r
542**/\r
543typedef\r
544EFI_STATUS\r
8b13229b 545(EFIAPI *EFI_TCP4_POLL)(\r
d1f95000 546 IN EFI_TCP4_PROTOCOL *This\r
ed66e1bc 547 );\r
d1f95000 548\r
44717a39 549///\r
550/// The EFI_TCP4_PROTOCOL defines the EFI TCPv4 Protocol child to be used by \r
551/// any network drivers or applications to send or receive data stream. \r
552/// It can either listen on a specified port as a service or actively connected \r
553/// to remote peer as a client. Each instance has its own independent settings, \r
554/// such as the routing table.\r
555///\r
d1f95000 556struct _EFI_TCP4_PROTOCOL {\r
557 EFI_TCP4_GET_MODE_DATA GetModeData;\r
558 EFI_TCP4_CONFIGURE Configure;\r
559 EFI_TCP4_ROUTES Routes;\r
560 EFI_TCP4_CONNECT Connect;\r
561 EFI_TCP4_ACCEPT Accept;\r
562 EFI_TCP4_TRANSMIT Transmit;\r
563 EFI_TCP4_RECEIVE Receive;\r
564 EFI_TCP4_CLOSE Close;\r
565 EFI_TCP4_CANCEL Cancel;\r
566 EFI_TCP4_POLL Poll;\r
567};\r
568\r
d1f95000 569extern EFI_GUID gEfiTcp4ServiceBindingProtocolGuid;\r
570extern EFI_GUID gEfiTcp4ProtocolGuid;\r
571\r
572#endif\r