]> git.proxmox.com Git - mirror_edk2.git/blame - NetworkPkg/TcpDxe/TcpMain.c
MdeModulePkg EsrtFmpDxe: Use EfiBootServicesData for ESRT table
[mirror_edk2.git] / NetworkPkg / TcpDxe / TcpMain.c
CommitLineData
a3bcde70
HT
1/** @file\r
2 Implementation of EFI_TCP4_PROTOCOL and EFI_TCP6_PROTOCOL.\r
3\r
8f586b85 4 (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>\r
ba025280 5 Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>\r
a3bcde70
HT
6\r
7 This program and the accompanying materials\r
8 are licensed and made available under the terms and conditions of the BSD License\r
9 which accompanies this distribution. The full text of the license may be found at\r
10 http://opensource.org/licenses/bsd-license.php.\r
11\r
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
14\r
15**/\r
16\r
17#include "TcpMain.h"\r
18\r
19/**\r
20 Check the integrity of the data buffer.\r
21\r
22 @param[in] DataLen The total length of the data buffer.\r
23 @param[in] FragmentCount The fragment count of the fragment table.\r
24 @param[in] FragmentTable Pointer to the fragment table of the data\r
25 buffer.\r
26\r
27 @retval EFI_SUCCESS The integrity check passed.\r
28 @retval EFI_INVALID_PARAMETER The integrity check failed.\r
29\r
30**/\r
31EFI_STATUS\r
32TcpChkDataBuf (\r
33 IN UINT32 DataLen,\r
34 IN UINT32 FragmentCount,\r
35 IN EFI_TCP4_FRAGMENT_DATA *FragmentTable\r
36 )\r
37{\r
38 UINT32 Index;\r
39\r
40 UINT32 Len;\r
41\r
42 for (Index = 0, Len = 0; Index < FragmentCount; Index++) {\r
8b40f01a
JW
43 if (FragmentTable[Index].FragmentBuffer == NULL) {\r
44 return EFI_INVALID_PARAMETER;\r
45 }\r
a3bcde70
HT
46 Len = Len + FragmentTable[Index].FragmentLength;\r
47 }\r
48\r
49 if (DataLen != Len) {\r
50 return EFI_INVALID_PARAMETER;\r
51 }\r
52\r
53 return EFI_SUCCESS;\r
54}\r
55\r
56/**\r
57 Get the current operational status.\r
58\r
59 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.\r
60 @param[out] Tcp4State Pointer to the buffer to receive the current TCP\r
61 state. Optional parameter that may be NULL.\r
62 @param[out] Tcp4ConfigData Pointer to the buffer to receive the current TCP\r
63 configuration. Optional parameter that may be NULL.\r
64 @param[out] Ip4ModeData Pointer to the buffer to receive the current\r
65 IPv4 configuration. Optional parameter that may be NULL.\r
66 @param[out] MnpConfigData Pointer to the buffer to receive the current MNP\r
67 configuration data indirectly used by the TCPv4\r
68 Instance. Optional parameter that may be NULL.\r
69 @param[out] SnpModeData Pointer to the buffer to receive the current SNP\r
70 configuration data indirectly used by the TCPv4\r
71 Instance. Optional parameter that may be NULL.\r
72\r
73 @retval EFI_SUCCESS The mode data was read.\r
74 @retval EFI_NOT_STARTED No configuration data is available because this\r
75 instance hasn't been started.\r
76 @retval EFI_INVALID_PARAMETER This is NULL.\r
77\r
78**/\r
79EFI_STATUS\r
80EFIAPI\r
81Tcp4GetModeData (\r
581900d9 82 IN EFI_TCP4_PROTOCOL *This,\r
83 OUT EFI_TCP4_CONNECTION_STATE *Tcp4State OPTIONAL,\r
84 OUT EFI_TCP4_CONFIG_DATA *Tcp4ConfigData OPTIONAL,\r
85 OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL,\r
86 OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,\r
87 OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL\r
a3bcde70
HT
88 )\r
89{\r
90 TCP4_MODE_DATA TcpMode;\r
91 SOCKET *Sock;\r
92\r
93 if (NULL == This) {\r
94 return EFI_INVALID_PARAMETER;\r
95 }\r
96\r
97 Sock = SOCK_FROM_THIS (This);\r
98\r
99 TcpMode.Tcp4State = Tcp4State;\r
100 TcpMode.Tcp4ConfigData = Tcp4ConfigData;\r
101 TcpMode.Ip4ModeData = Ip4ModeData;\r
102 TcpMode.MnpConfigData = MnpConfigData;\r
103 TcpMode.SnpModeData = SnpModeData;\r
104\r
105 return SockGetMode (Sock, &TcpMode);\r
106}\r
107\r
108/**\r
109 Initialize or brutally reset the operational parameters for\r
110 this EFI TCPv4 instance.\r
111\r
112 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.\r
113 @param[in] TcpConfigData Pointer to the configure data to configure the\r
114 instance. Optional parameter that may be NULL.\r
115\r
116 @retval EFI_SUCCESS The operational settings were set, changed, or\r
117 reset successfully.\r
118 @retval EFI_NO_MAPPING When using a default address, configuration\r
119 (through DHCP, BOOTP, RARP, etc.) is not\r
120 finished.\r
121 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
122 @retval EFI_ACCESS_DENIED Configuring TCP instance when it is already\r
123 configured.\r
124 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.\r
125 @retval EFI_UNSUPPORTED One or more of the control options are not\r
126 supported in the implementation.\r
127 @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources.\r
128\r
129**/\r
130EFI_STATUS\r
131EFIAPI\r
132Tcp4Configure (\r
133 IN EFI_TCP4_PROTOCOL * This,\r
134 IN EFI_TCP4_CONFIG_DATA * TcpConfigData OPTIONAL\r
135 )\r
136{\r
137 EFI_TCP4_OPTION *Option;\r
138 SOCKET *Sock;\r
139 EFI_STATUS Status;\r
140 IP4_ADDR Ip;\r
141 IP4_ADDR SubnetMask;\r
142\r
143 if (NULL == This) {\r
144 return EFI_INVALID_PARAMETER;\r
145 }\r
146\r
147 //\r
148 // Tcp protocol related parameter check will be conducted here\r
149 //\r
150 if (NULL != TcpConfigData) {\r
151\r
152 CopyMem (&Ip, &TcpConfigData->AccessPoint.RemoteAddress, sizeof (IP4_ADDR));\r
6c12fe63 153 if (IP4_IS_LOCAL_BROADCAST (NTOHL (Ip))) {\r
a3bcde70
HT
154 return EFI_INVALID_PARAMETER;\r
155 }\r
6c12fe63 156 \r
a3bcde70
HT
157 if (TcpConfigData->AccessPoint.ActiveFlag && (0 == TcpConfigData->AccessPoint.RemotePort || (Ip == 0))) {\r
158 return EFI_INVALID_PARAMETER;\r
159 }\r
160\r
161 if (!TcpConfigData->AccessPoint.UseDefaultAddress) {\r
162\r
163 CopyMem (&Ip, &TcpConfigData->AccessPoint.StationAddress, sizeof (IP4_ADDR));\r
164 CopyMem (&SubnetMask, &TcpConfigData->AccessPoint.SubnetMask, sizeof (IP4_ADDR));\r
ba025280
JW
165 if (!IP4_IS_VALID_NETMASK (NTOHL (SubnetMask)) || \r
166 (SubnetMask != 0 && !NetIp4IsUnicast (NTOHL (Ip), NTOHL (SubnetMask)))) {\r
a3bcde70
HT
167 return EFI_INVALID_PARAMETER;\r
168 }\r
169 }\r
170\r
171 Option = TcpConfigData->ControlOption;\r
172 if ((NULL != Option) && (Option->EnableSelectiveAck || Option->EnablePathMtuDiscovery)) {\r
173 return EFI_UNSUPPORTED;\r
174 }\r
175 }\r
176\r
177 Sock = SOCK_FROM_THIS (This);\r
178\r
179 if (NULL == TcpConfigData) {\r
180 return SockFlush (Sock);\r
181 }\r
182\r
183 Status = SockConfigure (Sock, TcpConfigData);\r
184\r
185 if (EFI_NO_MAPPING == Status) {\r
186 Sock->ConfigureState = SO_NO_MAPPING;\r
187 }\r
188\r
189 return Status;\r
190}\r
191\r
192/**\r
193 Add or delete routing entries.\r
194\r
195 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.\r
196 @param[in] DeleteRoute If TRUE, delete the specified route from routing\r
197 table; if FALSE, add the specified route to\r
198 routing table.\r
199 @param[in] SubnetAddress The destination network.\r
200 @param[in] SubnetMask The subnet mask for the destination network.\r
201 @param[in] GatewayAddress The gateway address for this route.\r
202\r
203 @retval EFI_SUCCESS The operation completed successfully.\r
204 @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance has not been\r
205 configured.\r
206 @retval EFI_NO_MAPPING When using a default address, configuration\r
207 (through DHCP, BOOTP, RARP, etc.) is not\r
208 finished.\r
209 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
210 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to add the\r
211 entry to the routing table.\r
212 @retval EFI_NOT_FOUND This route is not in the routing table.\r
213 @retval EFI_ACCESS_DENIED This route is already in the routing table.\r
214 @retval EFI_UNSUPPORTED The TCP driver does not support this operation.\r
215\r
216**/\r
217EFI_STATUS\r
218EFIAPI\r
219Tcp4Routes (\r
220 IN EFI_TCP4_PROTOCOL *This,\r
221 IN BOOLEAN DeleteRoute,\r
222 IN EFI_IPv4_ADDRESS *SubnetAddress,\r
223 IN EFI_IPv4_ADDRESS *SubnetMask,\r
224 IN EFI_IPv4_ADDRESS *GatewayAddress\r
225 )\r
226{\r
227 SOCKET *Sock;\r
228 TCP4_ROUTE_INFO RouteInfo;\r
229\r
230 if (NULL == This) {\r
231 return EFI_INVALID_PARAMETER;\r
232 }\r
233\r
234 Sock = SOCK_FROM_THIS (This);\r
235\r
236 RouteInfo.DeleteRoute = DeleteRoute;\r
2594a98e
FS
237 RouteInfo.SubnetAddress = SubnetAddress;\r
238 RouteInfo.SubnetMask = SubnetMask;\r
239 RouteInfo.GatewayAddress = GatewayAddress;\r
a3bcde70
HT
240\r
241 return SockRoute (Sock, &RouteInfo);\r
242}\r
243\r
244/**\r
245 Initiate a non-blocking TCP connection request for an active TCP instance.\r
246\r
247 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.\r
248 @param[in] ConnectionToken Pointer to the connection token to return when\r
249 the TCP three way handshake finishes.\r
250\r
251 @retval EFI_SUCCESS The connection request successfully\r
252 initiated.\r
253 @retval EFI_NOT_STARTED This EFI_TCP4_PROTOCOL instance hasn't been\r
254 configured.\r
255 @retval EFI_ACCESS_DENIED The instance is not configured as an active one,\r
256 or it is not in Tcp4StateClosed state.\r
257 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
258 @retval EFI_OUT_OF_RESOURCES The driver can't allocate enough resources to\r
259 initiate the active open.\r
260 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
261\r
262**/\r
263EFI_STATUS\r
264EFIAPI\r
265Tcp4Connect (\r
266 IN EFI_TCP4_PROTOCOL *This,\r
267 IN EFI_TCP4_CONNECTION_TOKEN *ConnectionToken\r
268 )\r
269{\r
270 SOCKET *Sock;\r
271\r
272 if (NULL == This || NULL == ConnectionToken || NULL == ConnectionToken->CompletionToken.Event) {\r
273 return EFI_INVALID_PARAMETER;\r
274 }\r
275\r
276 Sock = SOCK_FROM_THIS (This);\r
277\r
278 return SockConnect (Sock, ConnectionToken);\r
279}\r
280\r
281/**\r
282 Listen on the passive instance to accept an incoming connection request.\r
283\r
284 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.\r
285 @param[in] ListenToken Pointer to the listen token to return when\r
286 operation finishes.\r
287\r
288 @retval EFI_SUCCESS The listen token was queued successfully.\r
289 @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been\r
290 configured.\r
291 @retval EFI_ACCESS_DENIED The instatnce is not a passive one or it is not\r
292 in Tcp4StateListen state or a same listen token\r
293 has already existed in the listen token queue of\r
294 this TCP instance.\r
295 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
296 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to finish\r
297 the operation.\r
298 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
299\r
300**/\r
301EFI_STATUS\r
302EFIAPI\r
303Tcp4Accept (\r
304 IN EFI_TCP4_PROTOCOL *This,\r
305 IN EFI_TCP4_LISTEN_TOKEN *ListenToken\r
306 )\r
307{\r
308 SOCKET *Sock;\r
309\r
310 if (NULL == This || NULL == ListenToken || NULL == ListenToken->CompletionToken.Event) {\r
311 return EFI_INVALID_PARAMETER;\r
312 }\r
313\r
314 Sock = SOCK_FROM_THIS (This);\r
315\r
316 return SockAccept (Sock, ListenToken);\r
317}\r
318\r
319/**\r
320 Queues outgoing data into the transmit queue\r
321\r
322 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.\r
323 @param[in] Token Pointer to the completion token to queue to the\r
324 transmit queue.\r
325\r
326 @retval EFI_SUCCESS The data has been queued for transmission.\r
327 @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been\r
328 configured.\r
329 @retval EFI_NO_MAPPING When using a default address, configuration\r
330 (DHCP, BOOTP, RARP, etc.) is not finished yet.\r
331 @retval EFI_INVALID_PARAMETER One or more parameters are invalid\r
332 @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:\r
333 * A transmit completion token with the same\r
334 Token-> CompletionToken.Event was already in the\r
335 transmission queue. * The current instance is in\r
336 Tcp4StateClosed state. * The current instance is\r
337 a passive one and it is in Tcp4StateListen\r
338 state. * User has called Close() to disconnect\r
339 this connection.\r
340 @retval EFI_NOT_READY The completion token could not be queued because\r
341 the transmit queue is full.\r
342 @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data because of a\r
343 resource shortage.\r
344 @retval EFI_NETWORK_UNREACHABLE There is no route to the destination network or\r
345 address.\r
346\r
347**/\r
348EFI_STATUS\r
349EFIAPI\r
350Tcp4Transmit (\r
351 IN EFI_TCP4_PROTOCOL *This,\r
352 IN EFI_TCP4_IO_TOKEN *Token\r
353 )\r
354{\r
355 SOCKET *Sock;\r
356 EFI_STATUS Status;\r
357\r
358 if (NULL == This ||\r
359 NULL == Token ||\r
360 NULL == Token->CompletionToken.Event ||\r
361 NULL == Token->Packet.TxData ||\r
362 0 == Token->Packet.TxData->FragmentCount ||\r
363 0 == Token->Packet.TxData->DataLength\r
364 ) {\r
365 return EFI_INVALID_PARAMETER;\r
366 }\r
367\r
368 Status = TcpChkDataBuf (\r
369 Token->Packet.TxData->DataLength,\r
370 Token->Packet.TxData->FragmentCount,\r
371 Token->Packet.TxData->FragmentTable\r
372 );\r
373 if (EFI_ERROR (Status)) {\r
374 return Status;\r
375 }\r
376\r
377 Sock = SOCK_FROM_THIS (This);\r
378\r
379 return SockSend (Sock, Token);\r
380}\r
381\r
382/**\r
383 Place an asynchronous receive request into the receiving queue.\r
384\r
385 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.\r
386 @param[in] Token Pointer to a token that is associated with the\r
387 receive data descriptor.\r
388\r
389 @retval EFI_SUCCESS The receive completion token was cached\r
390 @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been\r
391 configured.\r
392 @retval EFI_NO_MAPPING When using a default address, configuration\r
393 (DHCP, BOOTP, RARP, etc.) is not finished yet.\r
394 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
395 @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued\r
396 due to a lack of system resources.\r
397 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
398 @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:\r
399 * A receive completion token with the same\r
400 Token->CompletionToken.Event was already in the\r
401 receive queue. * The current instance is in\r
402 Tcp4StateClosed state. * The current instance is\r
403 a passive one and it is in Tcp4StateListen\r
404 state. * User has called Close() to disconnect\r
405 this connection.\r
406 @retval EFI_CONNECTION_FIN The communication peer has closed the connection,\r
407 and there is no any buffered data in the receive\r
408 buffer of this instance.\r
409 @retval EFI_NOT_READY The receive request could not be queued because\r
410 the receive queue is full.\r
411\r
412**/\r
413EFI_STATUS\r
414EFIAPI\r
415Tcp4Receive (\r
416 IN EFI_TCP4_PROTOCOL *This,\r
417 IN EFI_TCP4_IO_TOKEN *Token\r
418 )\r
419{\r
420 SOCKET *Sock;\r
421 EFI_STATUS Status;\r
422\r
423 if (NULL == This ||\r
424 NULL == Token ||\r
425 NULL == Token->CompletionToken.Event ||\r
426 NULL == Token->Packet.RxData ||\r
427 0 == Token->Packet.RxData->FragmentCount ||\r
428 0 == Token->Packet.RxData->DataLength\r
429 ) {\r
430 return EFI_INVALID_PARAMETER;\r
431 }\r
432\r
433 Status = TcpChkDataBuf (\r
434 Token->Packet.RxData->DataLength,\r
435 Token->Packet.RxData->FragmentCount,\r
436 Token->Packet.RxData->FragmentTable\r
437 );\r
438 if (EFI_ERROR (Status)) {\r
439 return Status;\r
440 }\r
441\r
442 Sock = SOCK_FROM_THIS (This);\r
443\r
444 return SockRcv (Sock, Token);\r
445\r
446}\r
447\r
448/**\r
449 Disconnecting a TCP connection gracefully or reset a TCP connection.\r
450\r
451 @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.\r
452 @param[in] CloseToken Pointer to the close token to return when\r
453 operation finishes.\r
454\r
455 @retval EFI_SUCCESS The operation completed successfully.\r
456 @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been\r
457 configured.\r
458 @retval EFI_ACCESS_DENIED One or more of the following are TRUE: *\r
459 Configure() has been called with TcpConfigData\r
460 set to NULL, and this function has not returned.\r
461 * Previous Close() call on this instance has not\r
462 finished.\r
463 @retval EFI_INVALID_PARAMETER One ore more parameters are invalid.\r
464 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to finish the\r
465 operation.\r
466 @retval EFI_DEVICE_ERROR Any unexpected category error not belonging to those\r
467 listed above.\r
468\r
469**/\r
470EFI_STATUS\r
471EFIAPI\r
472Tcp4Close (\r
473 IN EFI_TCP4_PROTOCOL *This,\r
474 IN EFI_TCP4_CLOSE_TOKEN *CloseToken\r
475 )\r
476{\r
477 SOCKET *Sock;\r
478\r
479 if (NULL == This || NULL == CloseToken || NULL == CloseToken->CompletionToken.Event) {\r
480 return EFI_INVALID_PARAMETER;\r
481 }\r
482\r
483 Sock = SOCK_FROM_THIS (This);\r
484\r
485 return SockClose (Sock, CloseToken, CloseToken->AbortOnClose);\r
486}\r
487\r
488/**\r
489 Abort an asynchronous connection, listen, transmission or receive request.\r
490\r
5ffe214a
JW
491 @param This The pointer to the EFI_TCP4_PROTOCOL instance.\r
492 @param Token The pointer to a token that has been issued by\r
493 EFI_TCP4_PROTOCOL.Connect(),\r
494 EFI_TCP4_PROTOCOL.Accept(),\r
495 EFI_TCP4_PROTOCOL.Transmit() or\r
496 EFI_TCP4_PROTOCOL.Receive(). If NULL, all pending\r
497 tokens issued by above four functions will be aborted. Type\r
498 EFI_TCP4_COMPLETION_TOKEN is defined in\r
499 EFI_TCP4_PROTOCOL.Connect().\r
500\r
501 @retval EFI_SUCCESS The asynchronous I/O request is aborted and Token->Event\r
502 is signaled.\r
503 @retval EFI_INVALID_PARAMETER This is NULL.\r
504 @retval EFI_NOT_STARTED This instance hasn't been configured.\r
505 @retval EFI_NO_MAPPING When using the default address, configuration\r
506 (DHCP, BOOTP,RARP, etc.) hasn't finished yet.\r
507 @retval EFI_NOT_FOUND The asynchronous I/O request isn't found in the\r
508 transmission or receive queue. It has either\r
509 completed or wasn't issued by Transmit() and Receive().\r
a3bcde70
HT
510\r
511**/\r
512EFI_STATUS\r
513EFIAPI\r
514Tcp4Cancel (\r
515 IN EFI_TCP4_PROTOCOL *This,\r
516 IN EFI_TCP4_COMPLETION_TOKEN *Token OPTIONAL\r
517 )\r
518{\r
5ffe214a
JW
519 SOCKET *Sock;\r
520\r
521 if (NULL == This) {\r
522 return EFI_INVALID_PARAMETER;\r
523 }\r
524\r
525 Sock = SOCK_FROM_THIS (This);\r
526\r
527 return SockCancel (Sock, Token);\r
a3bcde70
HT
528}\r
529\r
530/**\r
531 Poll to receive incoming data and transmit outgoing segments.\r
532\r
533 @param[in] 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 was processed.\r
539 @retval EFI_TIMEOUT Data was dropped out of the transmission or\r
540 receive queue. Consider increasing the polling\r
541 rate.\r
542\r
543**/\r
544EFI_STATUS\r
545EFIAPI\r
546Tcp4Poll (\r
547 IN EFI_TCP4_PROTOCOL *This\r
548 )\r
549{\r
550 SOCKET *Sock;\r
551 EFI_STATUS Status;\r
552\r
553 if (NULL == This) {\r
554 return EFI_INVALID_PARAMETER;\r
555 }\r
556\r
557 Sock = SOCK_FROM_THIS (This);\r
558\r
559 Status = Sock->ProtoHandler (Sock, SOCK_POLL, NULL);\r
560\r
561 return Status;\r
562}\r
563\r
564/**\r
565 Get the current operational status.\r
566\r
567 The GetModeData() function copies the current operational settings of this EFI TCPv6\r
568 Protocol instance into user-supplied buffers. This function can also be used to retrieve\r
569 the operational setting of underlying drivers such as IPv6, MNP, or SNP.\r
570\r
571 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.\r
572 @param[out] Tcp6State The buffer in which the current TCP state is\r
573 returned. Optional parameter that may be NULL.\r
574 @param[out] Tcp6ConfigData The buffer in which the current TCP configuration\r
575 is returned. Optional parameter that may be NULL.\r
576 @param[out] Ip6ModeData The buffer in which the current IPv6 configuration\r
577 data used by the TCP instance is returned.\r
578 Optional parameter that may be NULL.\r
579 @param[out] MnpConfigData The buffer in which the current MNP configuration\r
580 data indirectly used by the TCP instance is returned.\r
581 Optional parameter that may be NULL.\r
582 @param[out] SnpModeData The buffer in which the current SNP mode data\r
583 indirectly used by the TCP instance is returned.\r
584 Optional parameter that may be NULL.\r
585\r
586 @retval EFI_SUCCESS The mode data was read.\r
587 @retval EFI_NOT_STARTED No configuration data is available because this instance hasn't\r
588 been started.\r
589 @retval EFI_INVALID_PARAMETER This is NULL.\r
590\r
591**/\r
592EFI_STATUS\r
593EFIAPI\r
594Tcp6GetModeData (\r
595 IN EFI_TCP6_PROTOCOL *This,\r
596 OUT EFI_TCP6_CONNECTION_STATE *Tcp6State OPTIONAL,\r
597 OUT EFI_TCP6_CONFIG_DATA *Tcp6ConfigData OPTIONAL,\r
598 OUT EFI_IP6_MODE_DATA *Ip6ModeData OPTIONAL,\r
599 OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,\r
600 OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL\r
601 )\r
602{\r
603 TCP6_MODE_DATA TcpMode;\r
604 SOCKET *Sock;\r
605\r
606 if (NULL == This) {\r
607 return EFI_INVALID_PARAMETER;\r
608 }\r
609\r
610 Sock = SOCK_FROM_THIS (This);\r
611\r
612 TcpMode.Tcp6State = Tcp6State;\r
613 TcpMode.Tcp6ConfigData = Tcp6ConfigData;\r
614 TcpMode.Ip6ModeData = Ip6ModeData;\r
615 TcpMode.MnpConfigData = MnpConfigData;\r
616 TcpMode.SnpModeData = SnpModeData;\r
617\r
618 return SockGetMode (Sock, &TcpMode);\r
619}\r
620\r
621/**\r
622 Initialize or brutally reset the operational parameters for this EFI TCPv6 instance.\r
623\r
624 The Configure() function does the following:\r
625 - Initialize this TCP instance, i.e., initialize the communication end settings and\r
626 specify active open or passive open for an instance.\r
627 - Reset this TCP instance brutally, i.e., cancel all pending asynchronous tokens, flush\r
628 transmission and receiving buffer directly without informing the communication peer.\r
629\r
630 No other TCPv6 Protocol operation except Poll() can be executed by this instance until\r
631 it is configured properly. For an active TCP instance, after a proper configuration it\r
632 may call Connect() to initiate a three-way handshake. For a passive TCP instance,\r
633 its state transits to Tcp6StateListen after configuration, and Accept() may be\r
634 called to listen the incoming TCP connection requests. If Tcp6ConfigData is set to NULL,\r
635 the instance is reset. The resetting process will be done brutally, the state machine will\r
636 be set to Tcp6StateClosed directly, the receive queue and transmit queue will be flushed,\r
637 and no traffic is allowed through this instance.\r
638\r
639 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.\r
640 @param[in] Tcp6ConfigData Pointer to the configure data to configure the instance.\r
641 If Tcp6ConfigData is set to NULL, the instance is reset.\r
642\r
643 @retval EFI_SUCCESS The operational settings were set, changed, or reset\r
644 successfully.\r
645 @retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a source\r
646 address for this instance, but no source address was available for\r
647 use.\r
648 @retval EFI_INVALID_PARAMETER One or more of the following conditions are TRUE:\r
649 - This is NULL.\r
650 - Tcp6ConfigData->AccessPoint.StationAddress is neither zero nor\r
651 one of the configured IP addresses in the underlying IPv6 driver.\r
652 - Tcp6ConfigData->AccessPoint.RemoteAddress isn't a valid unicast\r
653 IPv6 address.\r
654 - Tcp6ConfigData->AccessPoint.RemoteAddress is zero or\r
655 Tcp6ConfigData->AccessPoint.RemotePort is zero when\r
656 Tcp6ConfigData->AccessPoint.ActiveFlag is TRUE.\r
657 - A same access point has been configured in other TCP\r
658 instance properly.\r
659 @retval EFI_ACCESS_DENIED Configuring a TCP instance when it is configured without\r
660 calling Configure() with NULL to reset it.\r
661 @retval EFI_UNSUPPORTED One or more of the control options are not supported in\r
662 the implementation.\r
663 @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources when\r
664 executing Configure().\r
665 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.\r
666\r
667**/\r
668EFI_STATUS\r
669EFIAPI\r
670Tcp6Configure (\r
671 IN EFI_TCP6_PROTOCOL *This,\r
672 IN EFI_TCP6_CONFIG_DATA *Tcp6ConfigData OPTIONAL\r
673 )\r
674{\r
675 EFI_TCP6_OPTION *Option;\r
676 SOCKET *Sock;\r
677 EFI_STATUS Status;\r
678 EFI_IPv6_ADDRESS *Ip;\r
679\r
680 if (NULL == This) {\r
681 return EFI_INVALID_PARAMETER;\r
682 }\r
683\r
684 //\r
685 // Tcp protocol related parameter check will be conducted here\r
686 //\r
687 if (NULL != Tcp6ConfigData) {\r
688\r
689 Ip = &Tcp6ConfigData->AccessPoint.RemoteAddress;\r
690 if (!NetIp6IsUnspecifiedAddr (Ip) && !NetIp6IsValidUnicast (Ip)) {\r
691 return EFI_INVALID_PARAMETER;\r
692 }\r
693\r
694 if (Tcp6ConfigData->AccessPoint.ActiveFlag &&\r
695 (0 == Tcp6ConfigData->AccessPoint.RemotePort || NetIp6IsUnspecifiedAddr (Ip))\r
696 ) {\r
697 return EFI_INVALID_PARAMETER;\r
698 }\r
699\r
700 Ip = &Tcp6ConfigData->AccessPoint.StationAddress;\r
701 if (!NetIp6IsUnspecifiedAddr (Ip) && !NetIp6IsValidUnicast (Ip)) {\r
702 return EFI_INVALID_PARAMETER;\r
703 }\r
704\r
705 Option = Tcp6ConfigData->ControlOption;\r
706 if ((NULL != Option) && (Option->EnableSelectiveAck || Option->EnablePathMtuDiscovery)) {\r
707 return EFI_UNSUPPORTED;\r
708 }\r
709 }\r
710\r
711 Sock = SOCK_FROM_THIS (This);\r
712\r
713 if (NULL == Tcp6ConfigData) {\r
714 return SockFlush (Sock);\r
715 }\r
716\r
717 Status = SockConfigure (Sock, Tcp6ConfigData);\r
718\r
719 if (EFI_NO_MAPPING == Status) {\r
720 Sock->ConfigureState = SO_NO_MAPPING;\r
721 }\r
722\r
723 return Status;\r
724}\r
725\r
726/**\r
727 Initiate a nonblocking TCP connection request for an active TCP instance.\r
728\r
729 The Connect() function will initiate an active open to the remote peer configured\r
730 in a current TCP instance if it is configured active. If the connection succeeds or\r
731 fails due to any error, the ConnectionToken->CompletionToken.Event will be signaled\r
732 and ConnectionToken->CompletionToken.Status will be updated accordingly. This\r
733 function can only be called for the TCP instance in the Tcp6StateClosed state. The\r
734 instance will transfer into Tcp6StateSynSent if the function returns EFI_SUCCESS.\r
735 If a TCP three-way handshake succeeds, its state will become Tcp6StateEstablished.\r
736 Otherwise, the state will return to Tcp6StateClosed.\r
737\r
738 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.\r
739 @param[in] ConnectionToken Pointer to the connection token to return when the TCP three\r
740 way handshake finishes.\r
741\r
742 @retval EFI_SUCCESS The connection request successfully initiated and the state of\r
743 this TCP instance has been changed to Tcp6StateSynSent.\r
744 @retval EFI_NOT_STARTED This EFI TCPv6 Protocol instance has not been configured.\r
745 @retval EFI_ACCESS_DENIED One or more of the following conditions are TRUE:\r
746 - This instance is not configured as an active one.\r
747 - This instance is not in Tcp6StateClosed state.\r
748 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:\r
749 - This is NULL.\r
750 - ConnectionToken is NULL.\r
751 - ConnectionToken->CompletionToken.Event is NULL.\r
752 @retval EFI_OUT_OF_RESOURCES The driver can't allocate enough resources to initiate the active open.\r
753 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
754\r
755**/\r
756EFI_STATUS\r
757EFIAPI\r
758Tcp6Connect (\r
759 IN EFI_TCP6_PROTOCOL *This,\r
760 IN EFI_TCP6_CONNECTION_TOKEN *ConnectionToken\r
761 )\r
762{\r
763 SOCKET *Sock;\r
764\r
765 if (NULL == This || NULL == ConnectionToken || NULL == ConnectionToken->CompletionToken.Event) {\r
766 return EFI_INVALID_PARAMETER;\r
767 }\r
768\r
769 Sock = SOCK_FROM_THIS (This);\r
770\r
771 return SockConnect (Sock, ConnectionToken);\r
772}\r
773\r
774/**\r
775 Listen on the passive instance to accept an incoming connection request. This is a\r
776 nonblocking operation.\r
777\r
778 The Accept() function initiates an asynchronous accept request to wait for an incoming\r
779 connection on the passive TCP instance. If a remote peer successfully establishes a\r
780 connection with this instance, a new TCP instance will be created and its handle will\r
781 be returned in ListenToken->NewChildHandle. The newly created instance is configured\r
782 by inheriting the passive instance's configuration and is ready for use upon return.\r
783 The new instance is in the Tcp6StateEstablished state.\r
784\r
785 The ListenToken->CompletionToken.Event will be signaled when a new connection is\r
786 accepted, when a user aborts the listen or when a connection is reset.\r
787\r
788 This function only can be called when a current TCP instance is in Tcp6StateListen state.\r
789\r
790 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.\r
791 @param[in] ListenToken Pointer to the listen token to return when operation finishes.\r
792\r
793\r
794 @retval EFI_SUCCESS The listen token queued successfully.\r
795 @retval EFI_NOT_STARTED This EFI TCPv6 Protocol instance has not been configured.\r
796 @retval EFI_ACCESS_DENIED One or more of the following are TRUE:\r
797 - This instance is not a passive instance.\r
798 - This instance is not in Tcp6StateListen state.\r
799 - The same listen token has already existed in the listen\r
800 token queue of this TCP instance.\r
801 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:\r
802 - This is NULL.\r
803 - ListenToken is NULL.\r
804 - ListentToken->CompletionToken.Event is NULL.\r
805 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resource to finish the operation.\r
806 @retval EFI_DEVICE_ERROR Any unexpected error not belonging to a category listed above.\r
807\r
808**/\r
809EFI_STATUS\r
810EFIAPI\r
811Tcp6Accept (\r
812 IN EFI_TCP6_PROTOCOL *This,\r
813 IN EFI_TCP6_LISTEN_TOKEN *ListenToken\r
814 )\r
815{\r
816 SOCKET *Sock;\r
817\r
818 if (NULL == This || NULL == ListenToken || NULL == ListenToken->CompletionToken.Event) {\r
819 return EFI_INVALID_PARAMETER;\r
820 }\r
821\r
822 Sock = SOCK_FROM_THIS (This);\r
823\r
824 return SockAccept (Sock, ListenToken);\r
825}\r
826\r
827/**\r
828 Queues outgoing data into the transmit queue.\r
829\r
830 The Transmit() function queues a sending request to this TCP instance along with the\r
831 user data. The status of the token is updated and the event in the token will be\r
832 signaled once the data is sent out or an error occurs.\r
833\r
834 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.\r
835 @param[in] Token Pointer to the completion token to queue to the transmit queue.\r
836\r
837 @retval EFI_SUCCESS The data has been queued for transmission.\r
838 @retval EFI_NOT_STARTED This EFI TCPv6 Protocol instance has not been configured.\r
839 @retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a\r
840 source address for this instance, but no source address was\r
841 available for use.\r
842 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:\r
843 - This is NULL.\r
844 - Token is NULL.\r
845 - Token->CompletionToken.Event is NULL.\r
846 - Token->Packet.TxData is NULL.\r
847 - Token->Packet.FragmentCount is zero.\r
848 - Token->Packet.DataLength is not equal to the sum of fragment lengths.\r
849 @retval EFI_ACCESS_DENIED One or more of the following conditions are TRUE:\r
850 - A transmit completion token with the same Token->\r
851 CompletionToken.Event was already in the\r
852 transmission queue.\r
853 - The current instance is in Tcp6StateClosed state.\r
854 - The current instance is a passive one and it is in\r
855 Tcp6StateListen state.\r
856 - User has called Close() to disconnect this connection.\r
857 @retval EFI_NOT_READY The completion token could not be queued because the\r
858 transmit queue is full.\r
859 @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data because of resource\r
860 shortage.\r
861 @retval EFI_NETWORK_UNREACHABLE There is no route to the destination network or address.\r
862\r
863**/\r
864EFI_STATUS\r
865EFIAPI\r
866Tcp6Transmit (\r
867 IN EFI_TCP6_PROTOCOL *This,\r
868 IN EFI_TCP6_IO_TOKEN *Token\r
869 )\r
870{\r
871 SOCKET *Sock;\r
872 EFI_STATUS Status;\r
873\r
874 if (NULL == This ||\r
875 NULL == Token ||\r
876 NULL == Token->CompletionToken.Event ||\r
877 NULL == Token->Packet.TxData ||\r
878 0 == Token->Packet.TxData->FragmentCount ||\r
879 0 == Token->Packet.TxData->DataLength\r
880 ) {\r
881 return EFI_INVALID_PARAMETER;\r
882 }\r
883\r
884 Status = TcpChkDataBuf (\r
885 Token->Packet.TxData->DataLength,\r
886 Token->Packet.TxData->FragmentCount,\r
887 (EFI_TCP4_FRAGMENT_DATA *) Token->Packet.TxData->FragmentTable\r
888 );\r
889 if (EFI_ERROR (Status)) {\r
890 return Status;\r
891 }\r
892\r
893 Sock = SOCK_FROM_THIS (This);\r
894\r
895 return SockSend (Sock, Token);\r
896}\r
897\r
898/**\r
899 Places an asynchronous receive request into the receiving queue.\r
900\r
901 The Receive() function places a completion token into the receive packet queue. This\r
902 function is always asynchronous. The caller must allocate the Token->CompletionToken.Event\r
903 and the FragmentBuffer used to receive data. The caller also must fill the DataLength that\r
904 represents the whole length of all FragmentBuffer. When the receive operation completes, the\r
905 EFI TCPv6 Protocol driver updates the Token->CompletionToken.Status and Token->Packet.RxData\r
906 fields, and the Token->CompletionToken.Event is signaled. If data obtained, the data and its length\r
907 will be copied into the FragmentTable; at the same time the full length of received data will\r
908 be recorded in the DataLength fields. Providing a proper notification function and context\r
909 for the event enables the user to receive the notification and receiving status. That\r
910 notification function is guaranteed to not be re-entered.\r
911\r
912 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.\r
913 @param[in] Token Pointer to a token that is associated with the receive data\r
914 descriptor.\r
915\r
916 @retval EFI_SUCCESS The receive completion token was cached.\r
917 @retval EFI_NOT_STARTED This EFI TCPv6 Protocol instance has not been configured.\r
918 @retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a source\r
919 address for this instance, but no source address was available for use.\r
920 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
921 - This is NULL.\r
922 - Token is NULL.\r
923 - Token->CompletionToken.Event is NULL.\r
924 - Token->Packet.RxData is NULL.\r
925 - Token->Packet.RxData->DataLength is 0.\r
926 - The Token->Packet.RxData->DataLength is not the\r
927 sum of all FragmentBuffer length in FragmentTable.\r
928 @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued due to a lack of\r
929 system resources (usually memory).\r
930 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
931 The EFI TCPv6 Protocol instance has been reset to startup defaults.\r
932 @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:\r
933 - A receive completion token with the same Token->CompletionToken.Event\r
934 was already in the receive queue.\r
935 - The current instance is in Tcp6StateClosed state.\r
936 - The current instance is a passive one and it is in\r
937 Tcp6StateListen state.\r
938 - User has called Close() to disconnect this connection.\r
939 @retval EFI_CONNECTION_FIN The communication peer has closed the connection and there is no\r
940 buffered data in the receive buffer of this instance.\r
941 @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.\r
942\r
943**/\r
944EFI_STATUS\r
945EFIAPI\r
946Tcp6Receive (\r
947 IN EFI_TCP6_PROTOCOL *This,\r
948 IN EFI_TCP6_IO_TOKEN *Token\r
949 )\r
950{\r
951 SOCKET *Sock;\r
952 EFI_STATUS Status;\r
953\r
954 if (NULL == This ||\r
955 NULL == Token ||\r
956 NULL == Token->CompletionToken.Event ||\r
957 NULL == Token->Packet.RxData ||\r
958 0 == Token->Packet.RxData->FragmentCount ||\r
959 0 == Token->Packet.RxData->DataLength\r
960 ) {\r
961 return EFI_INVALID_PARAMETER;\r
962 }\r
963\r
964 Status = TcpChkDataBuf (\r
965 Token->Packet.RxData->DataLength,\r
966 Token->Packet.RxData->FragmentCount,\r
967 (EFI_TCP4_FRAGMENT_DATA *) Token->Packet.RxData->FragmentTable\r
968 );\r
969 if (EFI_ERROR (Status)) {\r
970 return Status;\r
971 }\r
972\r
973 Sock = SOCK_FROM_THIS (This);\r
974\r
975 return SockRcv (Sock, Token);\r
976}\r
977\r
978/**\r
979 Disconnecting a TCP connection gracefully or reset a TCP connection. This function is a\r
980 nonblocking operation.\r
981\r
982 Initiate an asynchronous close token to the TCP driver. After Close() is called, any buffered\r
983 transmission data will be sent by the TCP driver, and the current instance will have a graceful close\r
984 working flow described as RFC 793 if AbortOnClose is set to FALSE. Otherwise, a rest packet\r
985 will be sent by TCP driver to fast disconnect this connection. When the close operation completes\r
986 successfully the TCP instance is in Tcp6StateClosed state, all pending asynchronous\r
987 operations are signaled, and any buffers used for TCP network traffic are flushed.\r
988\r
989 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.\r
990 @param[in] CloseToken Pointer to the close token to return when operation finishes.\r
991\r
992 @retval EFI_SUCCESS The Close() was called successfully.\r
993 @retval EFI_NOT_STARTED This EFI TCPv6 Protocol instance has not been configured.\r
994 @retval EFI_ACCESS_DENIED One or more of the following are TRUE:\r
995 - CloseToken or CloseToken->CompletionToken.Event is already in use.\r
996 - Previous Close() call on this instance has not finished.\r
997 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:\r
998 - This is NULL.\r
999 - CloseToken is NULL.\r
1000 - CloseToken->CompletionToken.Event is NULL.\r
1001 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resource to finish the operation.\r
1002 @retval EFI_DEVICE_ERROR Any unexpected error not belonging to error categories given above.\r
1003\r
1004**/\r
1005EFI_STATUS\r
1006EFIAPI\r
1007Tcp6Close (\r
1008 IN EFI_TCP6_PROTOCOL *This,\r
1009 IN EFI_TCP6_CLOSE_TOKEN *CloseToken\r
1010 )\r
1011{\r
1012 SOCKET *Sock;\r
1013\r
1014 if (NULL == This || NULL == CloseToken || NULL == CloseToken->CompletionToken.Event) {\r
1015 return EFI_INVALID_PARAMETER;\r
1016 }\r
1017\r
1018 Sock = SOCK_FROM_THIS (This);\r
1019\r
1020 return SockClose (Sock, CloseToken, CloseToken->AbortOnClose);\r
1021}\r
1022\r
1023/**\r
5ffe214a 1024 Abort an asynchronous connection, listen, transmission or receive request.\r
a3bcde70 1025\r
5ffe214a 1026 The Cancel() function aborts a pending connection, listen, transmit or\r
a3bcde70
HT
1027 receive request.\r
1028\r
5ffe214a 1029 If Token is not NULL and the token is in the connection, listen, transmission\r
a3bcde70 1030 or receive queue when it is being cancelled, its Token->Status will be set\r
5ffe214a 1031 to EFI_ABORTED and then Token->Event will be signaled.\r
a3bcde70
HT
1032\r
1033 If the token is not in one of the queues, which usually means that the\r
1034 asynchronous operation has completed, EFI_NOT_FOUND is returned.\r
1035\r
1036 If Token is NULL all asynchronous token issued by Connect(), Accept(),\r
5ffe214a 1037 Transmit() and Receive() will be aborted.\r
a3bcde70
HT
1038\r
1039 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.\r
1040 @param[in] Token Pointer to a token that has been issued by\r
1041 EFI_TCP6_PROTOCOL.Connect(),\r
1042 EFI_TCP6_PROTOCOL.Accept(),\r
1043 EFI_TCP6_PROTOCOL.Transmit() or\r
1044 EFI_TCP6_PROTOCOL.Receive(). If NULL, all pending\r
1045 tokens issued by above four functions will be aborted. Type\r
1046 EFI_TCP6_COMPLETION_TOKEN is defined in\r
1047 EFI_TCP_PROTOCOL.Connect().\r
1048\r
5ffe214a
JW
1049 @retval EFI_SUCCESS The asynchronous I/O request is aborted and Token->Event\r
1050 is signaled.\r
1051 @retval EFI_INVALID_PARAMETER This is NULL.\r
1052 @retval EFI_NOT_STARTED This instance hasn't been configured.\r
1053 @retval EFI_NOT_FOUND The asynchronous I/O request isn't found in the transmission or\r
1054 receive queue. It has either completed or wasn't issued by\r
1055 Transmit() and Receive().\r
a3bcde70
HT
1056\r
1057**/\r
1058EFI_STATUS\r
1059EFIAPI\r
1060Tcp6Cancel (\r
1061 IN EFI_TCP6_PROTOCOL *This,\r
1062 IN EFI_TCP6_COMPLETION_TOKEN *Token OPTIONAL\r
1063 )\r
1064{\r
5ffe214a
JW
1065 SOCKET *Sock;\r
1066\r
1067 if (NULL == This) {\r
1068 return EFI_INVALID_PARAMETER;\r
1069 }\r
1070\r
1071 Sock = SOCK_FROM_THIS (This);\r
1072\r
1073 return SockCancel (Sock, Token);\r
a3bcde70
HT
1074}\r
1075\r
1076/**\r
1077 Poll to receive incoming data and transmit outgoing segments.\r
1078\r
1079 The Poll() function increases the rate that data is moved between the network\r
1080 and application, and can be called when the TCP instance is created successfully.\r
1081 Its use is optional.\r
1082\r
1083 @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.\r
1084\r
1085 @retval EFI_SUCCESS Incoming or outgoing data was processed.\r
1086 @retval EFI_INVALID_PARAMETER This is NULL.\r
1087 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
1088 @retval EFI_NOT_READY No incoming or outgoing data is processed.\r
1089 @retval EFI_TIMEOUT Data was dropped out of the transmission or receive queue.\r
1090 Consider increasing the polling rate.\r
1091\r
1092**/\r
1093EFI_STATUS\r
1094EFIAPI\r
1095Tcp6Poll (\r
1096 IN EFI_TCP6_PROTOCOL *This\r
1097 )\r
1098{\r
1099 SOCKET *Sock;\r
1100 EFI_STATUS Status;\r
1101\r
1102 if (NULL == This) {\r
1103 return EFI_INVALID_PARAMETER;\r
1104 }\r
1105\r
1106 Sock = SOCK_FROM_THIS (This);\r
1107\r
1108 Status = Sock->ProtoHandler (Sock, SOCK_POLL, NULL);\r
1109\r
1110 return Status;\r
1111}\r
1112\r