]>
Commit | Line | Data |
---|---|---|
8a67d61d | 1 | /** @file\r |
2 | \r | |
3 | Copyright (c) 2005 - 2006, Intel Corporation\r | |
4 | All rights reserved. This program and the accompanying materials\r | |
5 | are licensed and made available under the terms and conditions of the BSD License\r | |
6 | which accompanies this distribution. The full text of the license may be found at\r | |
7 | http://opensource.org/licenses/bsd-license.php\r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
11 | \r | |
12 | Module Name:\r | |
13 | \r | |
14 | Tcp4Main.c\r | |
15 | \r | |
16 | Abstract:\r | |
17 | \r | |
18 | Implementation of TCP4 protocol services.\r | |
19 | \r | |
20 | \r | |
21 | **/\r | |
22 | \r | |
23 | #include "Tcp4Main.h"\r | |
24 | \r | |
25 | \r | |
26 | /**\r | |
27 | Check the integrity of the data buffer.\r | |
28 | \r | |
29 | @param DataLen The total length of the data buffer.\r | |
30 | @param FragmentCount The fragment count of the fragment table.\r | |
31 | @param FragmentTable Pointer to the fragment table of the data\r | |
32 | buffer.\r | |
33 | \r | |
34 | @retval EFI_SUCCESS The integrity check is passed.\r | |
35 | @retval EFI_INVALID_PARAMETER The integrity check is failed.\r | |
36 | \r | |
37 | **/\r | |
38 | STATIC\r | |
39 | EFI_STATUS\r | |
40 | Tcp4ChkDataBuf (\r | |
41 | IN UINT32 DataLen,\r | |
42 | IN UINT32 FragmentCount,\r | |
43 | IN EFI_TCP4_FRAGMENT_DATA *FragmentTable\r | |
44 | )\r | |
45 | {\r | |
46 | UINT32 Index;\r | |
47 | \r | |
48 | UINT32 Len;\r | |
49 | \r | |
50 | for (Index = 0, Len = 0; Index < FragmentCount; Index++) {\r | |
4eb65aff | 51 | Len = Len + (UINT32) FragmentTable[Index].FragmentLength;\r |
8a67d61d | 52 | }\r |
53 | \r | |
54 | if (DataLen != Len) {\r | |
55 | return EFI_INVALID_PARAMETER;\r | |
56 | }\r | |
57 | \r | |
58 | return EFI_SUCCESS;\r | |
59 | }\r | |
60 | \r | |
61 | \r | |
62 | /**\r | |
63 | Get the current operational status.\r | |
64 | \r | |
65 | @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r | |
66 | @param Tcp4State Pointer to the buffer to receive the current TCP\r | |
67 | state.\r | |
68 | @param Tcp4ConfigData Pointer to the buffer to receive the current TCP\r | |
69 | configuration.\r | |
70 | @param Ip4ModeData Pointer to the buffer to receive the current\r | |
71 | IPv4 configuration.\r | |
72 | @param MnpConfigData Pointer to the buffer to receive the current MNP\r | |
73 | configuration data indirectly used by the TCPv4\r | |
74 | Instance.\r | |
75 | @param SnpModeData Pointer to the buffer to receive the current SNP\r | |
76 | configuration data indirectly used by the TCPv4\r | |
77 | Instance.\r | |
78 | \r | |
79 | @retval EFI_SUCCESS The mode data was read.\r | |
80 | @retval EFI_NOT_STARTED No configuration data is available because this\r | |
81 | instance hasn't been started.\r | |
82 | @retval EFI_INVALID_PARAMETER This is NULL.\r | |
83 | \r | |
84 | **/\r | |
85 | EFI_STATUS\r | |
86 | EFIAPI\r | |
87 | Tcp4GetModeData (\r | |
88 | IN CONST EFI_TCP4_PROTOCOL * This,\r | |
89 | OUT EFI_TCP4_CONNECTION_STATE * Tcp4State OPTIONAL,\r | |
90 | OUT EFI_TCP4_CONFIG_DATA * Tcp4ConfigData OPTIONAL,\r | |
91 | OUT EFI_IP4_MODE_DATA * Ip4ModeData OPTIONAL,\r | |
92 | OUT EFI_MANAGED_NETWORK_CONFIG_DATA * MnpConfigData OPTIONAL,\r | |
93 | OUT EFI_SIMPLE_NETWORK_MODE * SnpModeData OPTIONAL\r | |
94 | )\r | |
95 | {\r | |
96 | TCP4_MODE_DATA TcpMode;\r | |
97 | SOCKET *Sock;\r | |
98 | \r | |
99 | if (NULL == This) {\r | |
100 | return EFI_INVALID_PARAMETER;\r | |
101 | }\r | |
102 | \r | |
103 | Sock = SOCK_FROM_THIS (This);\r | |
104 | \r | |
105 | TcpMode.Tcp4State = Tcp4State;\r | |
106 | TcpMode.Tcp4ConfigData = Tcp4ConfigData;\r | |
107 | TcpMode.Ip4ModeData = Ip4ModeData;\r | |
108 | TcpMode.MnpConfigData = MnpConfigData;\r | |
109 | TcpMode.SnpModeData = SnpModeData;\r | |
110 | \r | |
111 | return SockGetMode (Sock, &TcpMode);\r | |
112 | }\r | |
113 | \r | |
114 | \r | |
115 | /**\r | |
116 | Initialize or brutally reset the operational parameters for\r | |
117 | this EFI TCPv4 instance.\r | |
118 | \r | |
119 | @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r | |
120 | @param TcpConfigData Pointer to the configure data to configure the\r | |
121 | instance.\r | |
122 | \r | |
123 | @retval EFI_SUCCESS The operational settings are set, changed, or\r | |
124 | reset successfully.\r | |
125 | @retval EFI_NO_MAPPING When using a default address, configuration\r | |
126 | (through DHCP, BOOTP, RARP, etc.) is not\r | |
127 | finished.\r | |
128 | @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r | |
129 | @retval EFI_ACCESS_DENIED Configuring TCP instance when it is already\r | |
130 | configured.\r | |
131 | @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.\r | |
132 | @retval EFI_UNSUPPORTED One or more of the control options are not\r | |
133 | supported in the implementation.\r | |
134 | @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources.\r | |
135 | \r | |
136 | **/\r | |
137 | EFI_STATUS\r | |
138 | EFIAPI\r | |
139 | Tcp4Configure (\r | |
140 | IN EFI_TCP4_PROTOCOL * This,\r | |
141 | IN EFI_TCP4_CONFIG_DATA * TcpConfigData OPTIONAL\r | |
142 | )\r | |
143 | {\r | |
144 | EFI_TCP4_OPTION *Option;\r | |
145 | SOCKET *Sock;\r | |
146 | EFI_STATUS Status;\r | |
147 | \r | |
148 | if (NULL == This) {\r | |
149 | return EFI_INVALID_PARAMETER;\r | |
150 | }\r | |
151 | \r | |
152 | //\r | |
153 | // Tcp protocol related parameter check will be conducted here\r | |
154 | //\r | |
155 | if (NULL != TcpConfigData) {\r | |
156 | if ((EFI_IP4 (TcpConfigData->AccessPoint.RemoteAddress) != 0) &&\r | |
157 | !Ip4IsUnicast (EFI_NTOHL (TcpConfigData->AccessPoint.RemoteAddress), 0)) {\r | |
158 | return EFI_INVALID_PARAMETER;\r | |
159 | }\r | |
160 | \r | |
161 | if (!TcpConfigData->AccessPoint.UseDefaultAddress) {\r | |
162 | if (!Ip4IsUnicast (EFI_NTOHL (TcpConfigData->AccessPoint.StationAddress), 0) ||\r | |
163 | !IP4_IS_VALID_NETMASK (EFI_NTOHL (TcpConfigData->AccessPoint.SubnetMask))\r | |
164 | ) {\r | |
165 | return EFI_INVALID_PARAMETER;\r | |
166 | }\r | |
167 | }\r | |
168 | \r | |
169 | if (TcpConfigData->AccessPoint.ActiveFlag &&\r | |
170 | (0 == TcpConfigData->AccessPoint.RemotePort ||\r | |
171 | (EFI_IP4 (TcpConfigData->AccessPoint.RemoteAddress) == 0))\r | |
172 | ) {\r | |
173 | return EFI_INVALID_PARAMETER;\r | |
174 | }\r | |
175 | \r | |
176 | Option = TcpConfigData->ControlOption;\r | |
177 | if ((NULL != Option) &&\r | |
178 | (Option->EnableSelectiveAck || Option->EnablePathMtuDiscovery)) {\r | |
179 | return EFI_UNSUPPORTED;\r | |
180 | }\r | |
181 | }\r | |
182 | \r | |
183 | Sock = SOCK_FROM_THIS (This);\r | |
184 | \r | |
185 | if (NULL == TcpConfigData) {\r | |
186 | return SockFlush (Sock);\r | |
187 | }\r | |
188 | \r | |
189 | Status = SockConfigure (Sock, TcpConfigData);\r | |
190 | \r | |
191 | if (EFI_NO_MAPPING == Status) {\r | |
192 | Sock->ConfigureState = SO_NO_MAPPING;\r | |
193 | }\r | |
194 | \r | |
195 | return Status;\r | |
196 | }\r | |
197 | \r | |
198 | \r | |
199 | /**\r | |
200 | Add or delete routing entries.\r | |
201 | \r | |
202 | @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r | |
203 | @param DeleteRoute If TRUE, delete the specified route from routing\r | |
204 | table; if FALSE, add the specified route to\r | |
205 | routing table.\r | |
206 | @param SubnetAddress The destination network.\r | |
207 | @param SubnetMask The subnet mask for the destination network.\r | |
208 | @param GatewayAddress The gateway address for this route.\r | |
209 | \r | |
210 | @retval EFI_SUCCESS The operation completed successfully.\r | |
211 | @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance has not been\r | |
212 | configured.\r | |
213 | @retval EFI_NO_MAPPING When using a default address, configuration\r | |
214 | (through DHCP, BOOTP, RARP, etc.) is not\r | |
215 | finished.\r | |
216 | @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r | |
217 | @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to add the\r | |
218 | entry to the routing table.\r | |
219 | @retval EFI_NOT_FOUND This route is not in the routing table.\r | |
220 | @retval EFI_ACCESS_DENIED This route is already in the routing table.\r | |
221 | @retval EFI_UNSUPPORTED The TCP driver does not support this operation.\r | |
222 | \r | |
223 | **/\r | |
224 | EFI_STATUS\r | |
225 | EFIAPI\r | |
226 | Tcp4Routes (\r | |
227 | IN EFI_TCP4_PROTOCOL *This,\r | |
228 | IN BOOLEAN DeleteRoute,\r | |
229 | IN EFI_IPv4_ADDRESS *SubnetAddress,\r | |
230 | IN EFI_IPv4_ADDRESS *SubnetMask,\r | |
231 | IN EFI_IPv4_ADDRESS *GatewayAddress\r | |
232 | )\r | |
233 | {\r | |
234 | SOCKET *Sock;\r | |
235 | TCP4_ROUTE_INFO RouteInfo;\r | |
236 | \r | |
237 | if (NULL == This) {\r | |
238 | return EFI_INVALID_PARAMETER;\r | |
239 | }\r | |
240 | \r | |
241 | Sock = SOCK_FROM_THIS (This);\r | |
242 | \r | |
243 | RouteInfo.DeleteRoute = DeleteRoute;\r | |
244 | RouteInfo.SubnetAddress = SubnetAddress;\r | |
245 | RouteInfo.SubnetMask = SubnetMask;\r | |
246 | RouteInfo.GatewayAddress = GatewayAddress;\r | |
247 | \r | |
248 | return SockRoute (Sock, &RouteInfo);\r | |
249 | }\r | |
250 | \r | |
251 | \r | |
252 | /**\r | |
253 | Initiate a nonblocking TCP connection request for an active TCP instance.\r | |
254 | \r | |
255 | @param This Pointer to the EFI_TCP4_PROTOCOL instance\r | |
256 | @param ConnectionToken Pointer to the connection token to return when\r | |
257 | the TCP three way handshake finishes.\r | |
258 | \r | |
259 | @retval EFI_SUCCESS The connection request is successfully\r | |
260 | initiated.\r | |
261 | @retval EFI_NOT_STARTED This EFI_TCP4_PROTOCOL instance hasn't been\r | |
262 | configured.\r | |
263 | @retval EFI_ACCESS_DENIED The instance is not configured as an active one\r | |
264 | or it is not in Tcp4StateClosed state.\r | |
265 | @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r | |
266 | @retval EFI_OUT_OF_RESOURCES The driver can't allocate enough resource to\r | |
267 | initiate the active open.\r | |
268 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r | |
269 | \r | |
270 | **/\r | |
271 | EFI_STATUS\r | |
272 | EFIAPI\r | |
273 | Tcp4Connect (\r | |
274 | IN EFI_TCP4_PROTOCOL *This,\r | |
275 | IN EFI_TCP4_CONNECTION_TOKEN *ConnectionToken\r | |
276 | )\r | |
277 | {\r | |
278 | SOCKET *Sock;\r | |
279 | \r | |
280 | if (NULL == This ||\r | |
281 | NULL == ConnectionToken ||\r | |
282 | NULL == ConnectionToken->CompletionToken.Event) {\r | |
283 | return EFI_INVALID_PARAMETER;\r | |
284 | }\r | |
285 | \r | |
286 | Sock = SOCK_FROM_THIS (This);\r | |
287 | \r | |
288 | return SockConnect (Sock, ConnectionToken);\r | |
289 | }\r | |
290 | \r | |
291 | \r | |
292 | /**\r | |
293 | Listen on the passive instance to accept an incoming connection request.\r | |
294 | \r | |
295 | @param This Pointer to the EFI_TCP4_PROTOCOL instance\r | |
296 | @param ListenToken Pointer to the listen token to return when\r | |
297 | operation finishes.\r | |
298 | \r | |
299 | @retval EFI_SUCCESS The listen token has been queued successfully.\r | |
300 | @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been\r | |
301 | configured.\r | |
302 | @retval EFI_ACCESS_DENIED The instatnce is not a passive one or it is not\r | |
303 | in Tcp4StateListen state or a same listen token\r | |
304 | has already existed in the listen token queue of\r | |
305 | this TCP instance.\r | |
306 | @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r | |
307 | @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to finish\r | |
308 | the operation.\r | |
309 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r | |
310 | \r | |
311 | **/\r | |
312 | EFI_STATUS\r | |
313 | EFIAPI\r | |
314 | Tcp4Accept (\r | |
315 | IN EFI_TCP4_PROTOCOL *This,\r | |
316 | IN EFI_TCP4_LISTEN_TOKEN *ListenToken\r | |
317 | )\r | |
318 | {\r | |
319 | SOCKET *Sock;\r | |
320 | \r | |
321 | if (NULL == This ||\r | |
322 | NULL == ListenToken ||\r | |
323 | NULL == ListenToken->CompletionToken.Event) {\r | |
324 | return EFI_INVALID_PARAMETER;\r | |
325 | }\r | |
326 | \r | |
327 | Sock = SOCK_FROM_THIS (This);\r | |
328 | \r | |
329 | return SockAccept (Sock, ListenToken);\r | |
330 | }\r | |
331 | \r | |
332 | \r | |
333 | /**\r | |
334 | Queues outgoing data into the transmit queue\r | |
335 | \r | |
336 | @param This Pointer to the EFI_TCP4_PROTOCOL instance\r | |
337 | @param Token Pointer to the completion token to queue to the\r | |
338 | transmit queue\r | |
339 | \r | |
340 | @retval EFI_SUCCESS The data has been queued for transmission\r | |
341 | @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been\r | |
342 | configured.\r | |
343 | @retval EFI_NO_MAPPING When using a default address, configuration\r | |
344 | (DHCP, BOOTP, RARP, etc.) is not finished yet.\r | |
345 | @retval EFI_INVALID_PARAMETER One or more parameters are invalid\r | |
346 | @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:\r | |
347 | * A transmit completion token with the same\r | |
348 | Token-> CompletionToken.Event was already in the\r | |
349 | transmission queue. * The current instance is in\r | |
350 | Tcp4StateClosed state * The current instance is\r | |
351 | a passive one and it is in Tcp4StateListen\r | |
352 | state. * User has called Close() to disconnect\r | |
353 | this connection.\r | |
354 | @retval EFI_NOT_READY The completion token could not be queued because\r | |
355 | the transmit queue is full.\r | |
356 | @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data because of\r | |
357 | resource shortage.\r | |
358 | @retval EFI_NETWORK_UNREACHABLE There is no route to the destination network or\r | |
359 | address.\r | |
360 | \r | |
361 | **/\r | |
362 | EFI_STATUS\r | |
363 | EFIAPI\r | |
364 | Tcp4Transmit (\r | |
365 | IN EFI_TCP4_PROTOCOL *This,\r | |
366 | IN EFI_TCP4_IO_TOKEN *Token\r | |
367 | )\r | |
368 | {\r | |
369 | SOCKET *Sock;\r | |
370 | EFI_STATUS Status;\r | |
371 | \r | |
372 | if (NULL == This ||\r | |
373 | NULL == Token ||\r | |
374 | NULL == Token->CompletionToken.Event ||\r | |
375 | NULL == Token->Packet.TxData ||\r | |
376 | 0 == Token->Packet.TxData->FragmentCount ||\r | |
377 | 0 == Token->Packet.TxData->DataLength\r | |
378 | ) {\r | |
379 | return EFI_INVALID_PARAMETER;\r | |
380 | }\r | |
381 | \r | |
382 | Status = Tcp4ChkDataBuf (\r | |
4eb65aff | 383 | (UINT32) Token->Packet.TxData->DataLength,\r |
384 | (UINT32) Token->Packet.TxData->FragmentCount,\r | |
8a67d61d | 385 | Token->Packet.TxData->FragmentTable\r |
386 | );\r | |
387 | if (EFI_ERROR (Status)) {\r | |
388 | return Status;\r | |
389 | }\r | |
390 | \r | |
391 | Sock = SOCK_FROM_THIS (This);\r | |
392 | \r | |
393 | return SockSend (Sock, Token);\r | |
394 | \r | |
395 | }\r | |
396 | \r | |
397 | \r | |
398 | /**\r | |
399 | Place an asynchronous receive request into the receiving queue.\r | |
400 | \r | |
401 | @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r | |
402 | @param Token Pointer to a token that is associated with the\r | |
403 | receive data descriptor.\r | |
404 | \r | |
405 | @retval EFI_SUCCESS The receive completion token was cached\r | |
406 | @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been\r | |
407 | configured.\r | |
408 | @retval EFI_NO_MAPPING When using a default address, configuration\r | |
409 | (DHCP, BOOTP, RARP, etc.) is not finished yet.\r | |
410 | @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r | |
411 | @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued\r | |
412 | due to a lack of system resources.\r | |
413 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r | |
414 | @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:\r | |
415 | * A receive completion token with the same\r | |
416 | Token->CompletionToken.Event was already in the\r | |
417 | receive queue. * The current instance is in\r | |
418 | Tcp4StateClosed state. * The current instance is\r | |
419 | a passive one and it is in Tcp4StateListen\r | |
420 | state. * User has called Close() to disconnect\r | |
421 | this connection.\r | |
422 | @retval EFI_CONNECTION_FIN The communication peer has closed the connection\r | |
423 | and there is no any buffered data in the receive\r | |
424 | buffer of this instance.\r | |
425 | @retval EFI_NOT_READY The receive request could not be queued because\r | |
426 | the receive queue is full.\r | |
427 | \r | |
428 | **/\r | |
429 | EFI_STATUS\r | |
430 | EFIAPI\r | |
431 | Tcp4Receive (\r | |
432 | IN EFI_TCP4_PROTOCOL *This,\r | |
433 | IN EFI_TCP4_IO_TOKEN *Token\r | |
434 | )\r | |
435 | {\r | |
436 | SOCKET *Sock;\r | |
437 | EFI_STATUS Status;\r | |
438 | \r | |
439 | if (NULL == This ||\r | |
440 | NULL == Token ||\r | |
441 | NULL == Token->CompletionToken.Event ||\r | |
442 | NULL == Token->Packet.RxData ||\r | |
443 | 0 == Token->Packet.RxData->FragmentCount ||\r | |
444 | 0 == Token->Packet.RxData->DataLength\r | |
445 | ) {\r | |
446 | return EFI_INVALID_PARAMETER;\r | |
447 | }\r | |
448 | \r | |
449 | Status = Tcp4ChkDataBuf (\r | |
4eb65aff | 450 | (UINT32) Token->Packet.RxData->DataLength,\r |
451 | (UINT32) Token->Packet.RxData->FragmentCount,\r | |
8a67d61d | 452 | Token->Packet.RxData->FragmentTable\r |
453 | );\r | |
454 | if (EFI_ERROR (Status)) {\r | |
455 | return Status;\r | |
456 | }\r | |
457 | \r | |
458 | Sock = SOCK_FROM_THIS (This);\r | |
459 | \r | |
460 | return SockRcv (Sock, Token);\r | |
461 | \r | |
462 | }\r | |
463 | \r | |
464 | \r | |
465 | /**\r | |
466 | Disconnecting a TCP connection gracefully or reset a TCP connection.\r | |
467 | \r | |
468 | @param This Pointer to the EFI_TCP4_PROTOCOL instance\r | |
469 | @param CloseToken Pointer to the close token to return when\r | |
470 | operation finishes.\r | |
471 | \r | |
472 | @retval EFI_SUCCESS The operation completed successfully\r | |
473 | @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been\r | |
474 | configured.\r | |
475 | @retval EFI_ACCESS_DENIED One or more of the following are TRUE: *\r | |
476 | Configure() has been called with TcpConfigData\r | |
477 | set to NULL and this function has not returned.\r | |
478 | * Previous Close() call on this instance has not\r | |
479 | finished.\r | |
480 | @retval EFI_INVALID_PARAMETER One ore more parameters are invalid\r | |
481 | @retval EFI_OUT_OF_RESOURCES Could not allocate enough resource to finish the\r | |
482 | operation\r | |
483 | @retval EFI_DEVICE_ERROR Any unexpected and not belonged to above\r | |
484 | category error.\r | |
485 | \r | |
486 | **/\r | |
487 | EFI_STATUS\r | |
488 | EFIAPI\r | |
489 | Tcp4Close (\r | |
490 | IN EFI_TCP4_PROTOCOL *This,\r | |
491 | IN EFI_TCP4_CLOSE_TOKEN *CloseToken\r | |
492 | )\r | |
493 | {\r | |
494 | SOCKET *Sock;\r | |
495 | \r | |
496 | if (NULL == This ||\r | |
497 | NULL == CloseToken ||\r | |
498 | NULL == CloseToken->CompletionToken.Event) {\r | |
499 | return EFI_INVALID_PARAMETER;\r | |
500 | }\r | |
501 | \r | |
502 | Sock = SOCK_FROM_THIS (This);\r | |
503 | \r | |
504 | return SockClose (Sock, CloseToken, CloseToken->AbortOnClose);\r | |
505 | }\r | |
506 | \r | |
507 | \r | |
508 | /**\r | |
509 | Abort an asynchronous connection, listen, transmission or receive request.\r | |
510 | \r | |
511 | @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r | |
512 | @param Token Pointer to a token that has been issued by\r | |
513 | Connect(), Accept(), Transmit() or Receive(). If\r | |
514 | NULL, all pending tokens issued by above four\r | |
515 | functions will be aborted.\r | |
516 | \r | |
517 | @retval EFI_UNSUPPORTED The operation is not supported in current\r | |
518 | implementation.\r | |
519 | \r | |
520 | **/\r | |
521 | EFI_STATUS\r | |
522 | EFIAPI\r | |
523 | Tcp4Cancel (\r | |
524 | IN EFI_TCP4_PROTOCOL * This,\r | |
525 | IN EFI_TCP4_COMPLETION_TOKEN * Token OPTIONAL\r | |
526 | )\r | |
527 | {\r | |
528 | return EFI_UNSUPPORTED;\r | |
529 | }\r | |
530 | \r | |
531 | \r | |
532 | /**\r | |
533 | Poll to receive incoming data and transmit outgoing segments.\r | |
534 | \r | |
535 | @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r | |
536 | \r | |
537 | @retval EFI_SUCCESS Incoming or outgoing data was processed.\r | |
538 | @retval EFI_INVALID_PARAMETER This is NULL.\r | |
539 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r | |
540 | @retval EFI_NOT_READY No incoming or outgoing data was processed.\r | |
541 | @retval EFI_TIMEOUT Data was dropped out of the transmission or\r | |
542 | receive queue. Consider increasing the polling\r | |
543 | rate.\r | |
544 | \r | |
545 | **/\r | |
546 | EFI_STATUS\r | |
547 | EFIAPI\r | |
548 | Tcp4Poll (\r | |
549 | IN EFI_TCP4_PROTOCOL *This\r | |
550 | )\r | |
551 | {\r | |
552 | SOCKET *Sock;\r | |
553 | EFI_STATUS Status;\r | |
554 | \r | |
555 | if (NULL == This) {\r | |
556 | return EFI_INVALID_PARAMETER;\r | |
557 | }\r | |
558 | \r | |
559 | Sock = SOCK_FROM_THIS (This);\r | |
560 | \r | |
561 | Status = Sock->ProtoHandler (Sock, SOCK_POLL, NULL);\r | |
562 | \r | |
563 | return Status;\r | |
564 | }\r |