]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Main.c
[Change summary]:
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Tcp4Dxe / Tcp4Main.c
1 /** @file
2 Implementation of TCP4 protocol services.
3
4 Copyright (c) 2005 - 2009, Intel Corporation<BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php<BR>
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15
16 #include "Tcp4Main.h"
17
18
19 /**
20 Check the integrity of the data buffer.
21
22 @param DataLen The total length of the data buffer.
23 @param FragmentCount The fragment count of the fragment table.
24 @param FragmentTable Pointer to the fragment table of the data
25 buffer.
26
27 @retval EFI_SUCCESS The integrity check is passed.
28 @retval EFI_INVALID_PARAMETER The integrity check is failed.
29
30 **/
31 EFI_STATUS
32 Tcp4ChkDataBuf (
33 IN UINT32 DataLen,
34 IN UINT32 FragmentCount,
35 IN EFI_TCP4_FRAGMENT_DATA *FragmentTable
36 )
37 {
38 UINT32 Index;
39
40 UINT32 Len;
41
42 for (Index = 0, Len = 0; Index < FragmentCount; Index++) {
43 Len = Len + (UINT32) FragmentTable[Index].FragmentLength;
44 }
45
46 if (DataLen != Len) {
47 return EFI_INVALID_PARAMETER;
48 }
49
50 return EFI_SUCCESS;
51 }
52
53
54 /**
55 Get the current operational status.
56
57 The GetModeData() function copies the current operational settings of this
58 EFI TCPv4 Protocol instance into user-supplied buffers. This function can
59 also be used to retrieve the operational setting of underlying drivers
60 such as IPv4, MNP, or SNP.
61
62 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
63 @param Tcp4State Pointer to the buffer to receive the current TCP
64 state.
65 @param Tcp4ConfigData Pointer to the buffer to receive the current TCP
66 configuration.
67 @param Ip4ModeData Pointer to the buffer to receive the current IPv4
68 configuration data used by the TCPv4 instance.
69 @param MnpConfigData Pointer to the buffer to receive the current MNP
70 configuration data indirectly used by the TCPv4
71 Instance.
72 @param SnpModeData Pointer to the buffer to receive the current SNP
73 configuration data indirectly used by the TCPv4
74 Instance.
75
76 @retval EFI_SUCCESS The mode data was read.
77 @retval EFI_NOT_STARTED No configuration data is available because this
78 instance hasn't been started.
79 @retval EFI_INVALID_PARAMETER This is NULL.
80
81 **/
82 EFI_STATUS
83 EFIAPI
84 Tcp4GetModeData (
85 IN CONST EFI_TCP4_PROTOCOL *This,
86 OUT EFI_TCP4_CONNECTION_STATE *Tcp4State OPTIONAL,
87 OUT EFI_TCP4_CONFIG_DATA *Tcp4ConfigData OPTIONAL,
88 OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL,
89 OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
90 OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
91 )
92 {
93 TCP4_MODE_DATA TcpMode;
94 SOCKET *Sock;
95
96 if (NULL == This) {
97 return EFI_INVALID_PARAMETER;
98 }
99
100 Sock = SOCK_FROM_THIS (This);
101
102 TcpMode.Tcp4State = Tcp4State;
103 TcpMode.Tcp4ConfigData = Tcp4ConfigData;
104 TcpMode.Ip4ModeData = Ip4ModeData;
105 TcpMode.MnpConfigData = MnpConfigData;
106 TcpMode.SnpModeData = SnpModeData;
107
108 return SockGetMode (Sock, &TcpMode);
109 }
110
111
112 /**
113 Initialize or brutally reset the operational parameters for
114 this EFI TCPv4 instance.
115
116 The Configure() function does the following:
117 * Initialize this EFI TCPv4 instance, i.e., initialize the communication end
118 setting, specify active open or passive open for an instance.
119 * Reset this TCPv4 instance brutally, i.e., cancel all pending asynchronous
120 tokens, flush transmission and receiving buffer directly without informing
121 the communication peer.
122 No other TCPv4 Protocol operation can be executed by this instance
123 until it is configured properly. For an active TCP4 instance, after a proper
124 configuration it may call Connect() to initiates the three-way handshake.
125 For a passive TCP4 instance, its state will transit to Tcp4StateListen after
126 configuration, and Accept() may be called to listen the incoming TCP connection
127 request. If TcpConfigData is set to NULL, the instance is reset. Resetting
128 process will be done brutally, the state machine will be set to Tcp4StateClosed
129 directly, the receive queue and transmit queue will be flushed, and no traffic is
130 allowed through this instance.
131
132 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
133 @param TcpConfigData Pointer to the configure data to configure the
134 instance.
135
136 @retval EFI_SUCCESS The operational settings are set, changed, or
137 reset successfully.
138 @retval EFI_NO_MAPPING When using a default address, configuration
139 (through DHCP, BOOTP, RARP, etc.) is not
140 finished.
141 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
142 @retval EFI_ACCESS_DENIED Configuring TCP instance when it is already
143 configured.
144 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.
145 @retval EFI_UNSUPPORTED One or more of the control options are not
146 supported in the implementation.
147 @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources.
148
149 **/
150 EFI_STATUS
151 EFIAPI
152 Tcp4Configure (
153 IN EFI_TCP4_PROTOCOL *This,
154 IN EFI_TCP4_CONFIG_DATA *TcpConfigData OPTIONAL
155 )
156 {
157 EFI_TCP4_OPTION *Option;
158 SOCKET *Sock;
159 EFI_STATUS Status;
160 IP4_ADDR Ip;
161 IP4_ADDR SubnetMask;
162
163 if (NULL == This) {
164 return EFI_INVALID_PARAMETER;
165 }
166
167 //
168 // Tcp protocol related parameter check will be conducted here
169 //
170 if (NULL != TcpConfigData) {
171
172 CopyMem (&Ip, &TcpConfigData->AccessPoint.RemoteAddress, sizeof (IP4_ADDR));
173 if ((Ip != 0) && !NetIp4IsUnicast (NTOHL (Ip), 0)) {
174 return EFI_INVALID_PARAMETER;
175 }
176
177 if (TcpConfigData->AccessPoint.ActiveFlag &&
178 (0 == TcpConfigData->AccessPoint.RemotePort || (Ip == 0))) {
179 return EFI_INVALID_PARAMETER;
180 }
181
182 if (!TcpConfigData->AccessPoint.UseDefaultAddress) {
183
184 CopyMem (&Ip, &TcpConfigData->AccessPoint.StationAddress, sizeof (IP4_ADDR));
185 CopyMem (&SubnetMask, &TcpConfigData->AccessPoint.SubnetMask, sizeof (IP4_ADDR));
186 if (!NetIp4IsUnicast (NTOHL (Ip), 0) || !IP4_IS_VALID_NETMASK (NTOHL (SubnetMask))) {
187 return EFI_INVALID_PARAMETER;
188 }
189 }
190
191 Option = TcpConfigData->ControlOption;
192 if ((NULL != Option) &&
193 (Option->EnableSelectiveAck || Option->EnablePathMtuDiscovery)) {
194 return EFI_UNSUPPORTED;
195 }
196 }
197
198 Sock = SOCK_FROM_THIS (This);
199
200 if (NULL == TcpConfigData) {
201 return SockFlush (Sock);
202 }
203
204 Status = SockConfigure (Sock, TcpConfigData);
205
206 if (EFI_NO_MAPPING == Status) {
207 Sock->ConfigureState = SO_NO_MAPPING;
208 }
209
210 return Status;
211 }
212
213
214 /**
215 Add or delete routing entries.
216
217 The Routes() function adds or deletes a route from the instance's routing table.
218 The most specific route is selected by comparing the SubnetAddress with the
219 destination IP address's arithmetical AND to the SubnetMask.
220 The default route is added with both SubnetAddress and SubnetMask set to 0.0.0.0.
221 The default route matches all destination IP addresses if there is no more specific route.
222 Direct route is added with GatewayAddress set to 0.0.0.0. Packets are sent to
223 the destination host if its address can be found in the Address Resolution Protocol (ARP)
224 cache or it is on the local subnet. If the instance is configured to use default
225 address, a direct route to the local network will be added automatically.
226 Each TCP instance has its own independent routing table. Instance that uses the
227 default IP address will have a copy of the EFI_IP4_CONFIG_PROTOCOL's routing table.
228 The copy will be updated automatically whenever the IP driver reconfigures its
229 instance. As a result, the previous modification to the instance's local copy
230 will be lost. The priority of checking the route table is specific with IP
231 implementation and every IP implementation must comply with RFC 1122.
232
233 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
234 @param DeleteRoute If TRUE, delete the specified route from routing
235 table; if FALSE, add the specified route to
236 routing table.
237 DestinationAddress and SubnetMask are used as
238 the keywords to search route entry.
239 @param SubnetAddress The destination network.
240 @param SubnetMask The subnet mask for the destination network.
241 @param GatewayAddress The gateway address for this route.
242 It must be on the same subnet with the station
243 address unless a direct route is specified.
244
245 @retval EFI_SUCCESS The operation completed successfully.
246 @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance has not been
247 configured.
248 @retval EFI_NO_MAPPING When using a default address, configuration
249 (through DHCP, BOOTP, RARP, etc.) is not
250 finished.
251 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
252 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to add the
253 entry to the routing table.
254 @retval EFI_NOT_FOUND This route is not in the routing table.
255 @retval EFI_ACCESS_DENIED This route is already in the routing table.
256 @retval EFI_UNSUPPORTED The TCP driver does not support this operation.
257
258 **/
259 EFI_STATUS
260 EFIAPI
261 Tcp4Routes (
262 IN EFI_TCP4_PROTOCOL *This,
263 IN BOOLEAN DeleteRoute,
264 IN EFI_IPv4_ADDRESS *SubnetAddress,
265 IN EFI_IPv4_ADDRESS *SubnetMask,
266 IN EFI_IPv4_ADDRESS *GatewayAddress
267 )
268 {
269 SOCKET *Sock;
270 TCP4_ROUTE_INFO RouteInfo;
271
272 if (NULL == This) {
273 return EFI_INVALID_PARAMETER;
274 }
275
276 Sock = SOCK_FROM_THIS (This);
277
278 RouteInfo.DeleteRoute = DeleteRoute;
279 RouteInfo.SubnetAddress = SubnetAddress;
280 RouteInfo.SubnetMask = SubnetMask;
281 RouteInfo.GatewayAddress = GatewayAddress;
282
283 return SockRoute (Sock, &RouteInfo);
284 }
285
286
287 /**
288 Initiate a nonblocking TCP connection request for an active TCP instance.
289
290 The Connect() function will initiate an active open to the remote peer configured
291 in current TCP instance if it is configured active. If the connection succeeds
292 or fails due to any error, the ConnectionToken->CompletionToken.Event will be
293 signaled and ConnectionToken->CompletionToken.Status will be updated accordingly.
294 This function can only be called for the TCP instance in Tcp4StateClosed state.
295 The instance will transfer into Tcp4StateSynSent if the function returns EFI_SUCCESS.
296 If TCP three way handshake succeeds, its state will become Tcp4StateEstablished,
297 otherwise, the state will return to Tcp4StateClosed.
298
299 @param This Pointer to the EFI_TCP4_PROTOCOL instance
300 @param ConnectionToken Pointer to the connection token to return when
301 the TCP three way handshake finishes.
302
303 @retval EFI_SUCCESS The connection request is successfully initiated
304 and the state of this TCPv4 instance has
305 been changed to Tcp4StateSynSent.
306 @retval EFI_NOT_STARTED This EFI_TCP4_PROTOCOL instance hasn't been
307 configured.
308 @retval EFI_ACCESS_DENIED The instance is not configured as an active one
309 or it is not in Tcp4StateClosed state.
310 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
311 @retval EFI_OUT_OF_RESOURCES The driver can't allocate enough resource to
312 initiate the active open.
313 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
314
315 **/
316 EFI_STATUS
317 EFIAPI
318 Tcp4Connect (
319 IN EFI_TCP4_PROTOCOL *This,
320 IN EFI_TCP4_CONNECTION_TOKEN *ConnectionToken
321 )
322 {
323 SOCKET *Sock;
324
325 if (NULL == This ||
326 NULL == ConnectionToken ||
327 NULL == ConnectionToken->CompletionToken.Event) {
328 return EFI_INVALID_PARAMETER;
329 }
330
331 Sock = SOCK_FROM_THIS (This);
332
333 return SockConnect (Sock, ConnectionToken);
334 }
335
336
337 /**
338 Listen on the passive instance to accept an incoming connection request.
339
340 The Accept() function initiates an asynchronous accept request to wait for an
341 incoming connection on the passive TCP instance. If a remote peer successfully
342 establishes a connection with this instance, a new TCP instance will be created
343 and its handle will be returned in ListenToken->NewChildHandle. The newly created
344 instance is configured by inheriting the passive instance's configuration and is
345 ready for use upon return. The instance is in the Tcp4StateEstablished state.
346 The ListenToken->CompletionToken.Event will be signaled when a new connection
347 is accepted, user aborts the listen or connection is reset. This function only
348 can be called when current TCP instance is in Tcp4StateListen state.
349
350 @param This Pointer to the EFI_TCP4_PROTOCOL instance
351 @param ListenToken Pointer to the listen token to return when
352 operation finishes.
353
354 @retval EFI_SUCCESS The listen token has been queued successfully.
355 @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been
356 configured.
357 @retval EFI_ACCESS_DENIED The instatnce is not a passive one or it is not
358 in Tcp4StateListen state or a same listen token
359 has already existed in the listen token queue of
360 this TCP instance.
361 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
362 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to finish
363 the operation.
364 @retval EFI_DEVICE_ERROR Any unexpected and not belonged to above category error.
365
366 **/
367 EFI_STATUS
368 EFIAPI
369 Tcp4Accept (
370 IN EFI_TCP4_PROTOCOL *This,
371 IN EFI_TCP4_LISTEN_TOKEN *ListenToken
372 )
373 {
374 SOCKET *Sock;
375
376 if (NULL == This ||
377 NULL == ListenToken ||
378 NULL == ListenToken->CompletionToken.Event) {
379 return EFI_INVALID_PARAMETER;
380 }
381
382 Sock = SOCK_FROM_THIS (This);
383
384 return SockAccept (Sock, ListenToken);
385 }
386
387
388 /**
389 Queues outgoing data into the transmit queue.
390
391 The Transmit() function queues a sending request to this TCPv4 instance along
392 with the user data. The status of the token is updated and the event in the token
393 will be signaled once the data is sent out or some error occurs.
394
395 @param This Pointer to the EFI_TCP4_PROTOCOL instance
396 @param Token Pointer to the completion token to queue to the
397 transmit queue
398
399 @retval EFI_SUCCESS The data has been queued for transmission.
400 @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been
401 configured.
402 @retval EFI_NO_MAPPING When using a default address, configuration
403 (DHCP, BOOTP, RARP, etc.) is not finished yet.
404 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
405 @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:
406 * A transmit completion token with the same
407 Token-> CompletionToken.Event was already in the
408 transmission queue.
409 * The current instance is in Tcp4StateClosed state
410 * The current instance is a passive one and
411 it is in Tcp4StateListen state.
412 * User has called Close() to disconnect this
413 connection.
414 @retval EFI_NOT_READY The completion token could not be queued because
415 the transmit queue is full.
416 @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data because of
417 resource shortage.
418 @retval EFI_NETWORK_UNREACHABLE There is no route to the destination network or
419 address.
420
421 **/
422 EFI_STATUS
423 EFIAPI
424 Tcp4Transmit (
425 IN EFI_TCP4_PROTOCOL *This,
426 IN EFI_TCP4_IO_TOKEN *Token
427 )
428 {
429 SOCKET *Sock;
430 EFI_STATUS Status;
431
432 if (NULL == This ||
433 NULL == Token ||
434 NULL == Token->CompletionToken.Event ||
435 NULL == Token->Packet.TxData ||
436 0 == Token->Packet.TxData->FragmentCount ||
437 0 == Token->Packet.TxData->DataLength
438 ) {
439 return EFI_INVALID_PARAMETER;
440 }
441
442 Status = Tcp4ChkDataBuf (
443 (UINT32) Token->Packet.TxData->DataLength,
444 (UINT32) Token->Packet.TxData->FragmentCount,
445 Token->Packet.TxData->FragmentTable
446 );
447 if (EFI_ERROR (Status)) {
448 return Status;
449 }
450
451 Sock = SOCK_FROM_THIS (This);
452
453 return SockSend (Sock, Token);
454
455 }
456
457
458 /**
459 Place an asynchronous receive request into the receiving queue.
460
461 The Receive() function places a completion token into the receive packet queue.
462 This function is always asynchronous. The caller must allocate the
463 Token->CompletionToken.Event and the FragmentBuffer used to receive data. He also
464 must fill the DataLength which represents the whole length of all FragmentBuffer.
465 When the receive operation completes, the EFI TCPv4 Protocol driver updates the
466 Token->CompletionToken.Status and Token->Packet.RxData fields and the
467 Token->CompletionToken.Event is signaled. If got data the data and its length
468 will be copy into the FragmentTable, in the same time the full length of received
469 data will be recorded in the DataLength fields. Providing a proper notification
470 function and context for the event will enable the user to receive the notification
471 and receiving status. That notification function is guaranteed to not be re-entered.
472
473 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
474 @param Token Pointer to a token that is associated with the
475 receive data descriptor.
476
477 @retval EFI_SUCCESS The receive completion token was cached.
478 @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been
479 configured.
480 @retval EFI_NO_MAPPING When using a default address, configuration
481 (DHCP, BOOTP, RARP, etc.) is not finished yet.
482 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
483 @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued
484 due to a lack of system resources.
485 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
486 The EFI TCPv4 Protocol instance has been reset
487 to startup defaults.
488 @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:
489 * A receive completion token with the same
490 Token->CompletionToken.Event was already in
491 the receive queue.
492 * The current instance is in Tcp4StateClosed state.
493 * The current instance is a passive one and it
494 is in Tcp4StateListen state.
495 * User has called Close() to disconnect this
496 connection.
497 @retval EFI_CONNECTION_FIN The communication peer has closed the connection
498 and there is no any buffered data in the receive
499 buffer of this instance.
500 @retval EFI_NOT_READY The receive request could not be queued because
501 the receive queue is full.
502
503 **/
504 EFI_STATUS
505 EFIAPI
506 Tcp4Receive (
507 IN EFI_TCP4_PROTOCOL *This,
508 IN EFI_TCP4_IO_TOKEN *Token
509 )
510 {
511 SOCKET *Sock;
512 EFI_STATUS Status;
513
514 if (NULL == This ||
515 NULL == Token ||
516 NULL == Token->CompletionToken.Event ||
517 NULL == Token->Packet.RxData ||
518 0 == Token->Packet.RxData->FragmentCount ||
519 0 == Token->Packet.RxData->DataLength
520 ) {
521 return EFI_INVALID_PARAMETER;
522 }
523
524 Status = Tcp4ChkDataBuf (
525 (UINT32) Token->Packet.RxData->DataLength,
526 (UINT32) Token->Packet.RxData->FragmentCount,
527 Token->Packet.RxData->FragmentTable
528 );
529 if (EFI_ERROR (Status)) {
530 return Status;
531 }
532
533 Sock = SOCK_FROM_THIS (This);
534
535 return SockRcv (Sock, Token);
536
537 }
538
539
540 /**
541 Disconnecting a TCP connection gracefully or reset a TCP connection.
542
543 Initiate an asynchronous close token to TCP driver. After Close() is called,
544 any buffered transmission data will be sent by TCP driver and the current
545 instance will have a graceful close working flow described as RFC 793 if
546 AbortOnClose is set to FALSE, otherwise, a rest packet will be sent by TCP
547 driver to fast disconnect this connection. When the close operation completes
548 successfully the TCP instance is in Tcp4StateClosed state, all pending
549 asynchronous operation is signaled and any buffers used for TCP network traffic
550 is flushed.
551
552 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
553 @param CloseToken Pointer to the close token to return when
554 operation finishes.
555
556 @retval EFI_SUCCESS The operation completed successfully.
557 @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been
558 configured.
559 @retval EFI_ACCESS_DENIED One or more of the following are TRUE:
560 * Configure() has been called with TcpConfigData
561 set to NULL and this function has not returned.
562 * Previous Close() call on this instance has not
563 finished.
564 @retval EFI_INVALID_PARAMETER One ore more parameters are invalid.
565 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resource to finish the
566 operation.
567 @retval EFI_DEVICE_ERROR Any unexpected and not belonged to above
568 category error.
569
570 **/
571 EFI_STATUS
572 EFIAPI
573 Tcp4Close (
574 IN EFI_TCP4_PROTOCOL *This,
575 IN EFI_TCP4_CLOSE_TOKEN *CloseToken
576 )
577 {
578 SOCKET *Sock;
579
580 if (NULL == This ||
581 NULL == CloseToken ||
582 NULL == CloseToken->CompletionToken.Event) {
583 return EFI_INVALID_PARAMETER;
584 }
585
586 Sock = SOCK_FROM_THIS (This);
587
588 return SockClose (Sock, CloseToken, CloseToken->AbortOnClose);
589 }
590
591
592 /**
593 Abort an asynchronous connection, listen, transmission or receive request.
594
595 The Cancel() function aborts a pending connection, listen, transmit or receive
596 request. If Token is not NULL and the token is in the connection, listen,
597 transmission or receive queue when it is being cancelled, its Token->Status
598 will be set to EFI_ABORTED and then Token->Event will be signaled. If the token
599 is not in one of the queues, which usually means that the asynchronous operation
600 has completed, EFI_NOT_FOUND is returned. If Token is NULL all asynchronous token
601 issued by Connect(), Accept(), Transmit() and Receive()will be aborted.
602 NOTE: It has not been implemented currently.
603
604 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
605 @param Token Pointer to a token that has been issued by
606 Connect(), Accept(), Transmit() or Receive(). If
607 NULL, all pending tokens issued by above four
608 functions will be aborted.
609
610 @retval EFI_SUCCESS The asynchronous I/O request is aborted and Token->Event
611 is signaled.
612 @retval EFI_INVALID_PARAMETER This is NULL.
613 @retval EFI_NOT_STARTED This instance hasn's been configured.
614 @retval EFI_NO_MAPPING When using the default address, configuration
615 (DHCP, BOOTP,RARP, etc.) hasn's finished yet.
616 @retval EFI_NOT_FOUND The asynchronous I/O request isn's found in the
617 transmission or receive queue. It has either
618 completed or wasn's issued by Transmit() and Receive().
619 @retval EFI_UNSUPPORTED The operation is not supported in current
620 implementation.
621
622 **/
623 EFI_STATUS
624 EFIAPI
625 Tcp4Cancel (
626 IN EFI_TCP4_PROTOCOL *This,
627 IN EFI_TCP4_COMPLETION_TOKEN *Token OPTIONAL
628 )
629 {
630 return EFI_UNSUPPORTED;
631 }
632
633
634 /**
635 Poll to receive incoming data and transmit outgoing segments.
636
637 The Poll() function increases the rate that data is moved between the network
638 and application and can be called when the TCP instance is created successfully.
639 Its use is optional. In some implementations, the periodical timer in the MNP
640 driver may not poll the underlying communications device fast enough to avoid
641 drop packets. Drivers and applications that are experiencing packet loss should
642 try calling the Poll() function in a high frequency.
643
644 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
645
646 @retval EFI_SUCCESS Incoming or outgoing data was processed.
647 @retval EFI_INVALID_PARAMETER This is NULL.
648 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
649 @retval EFI_NOT_READY No incoming or outgoing data was processed.
650 @retval EFI_TIMEOUT Data was dropped out of the transmission or
651 receive queue. Consider increasing the polling
652 rate.
653
654 **/
655 EFI_STATUS
656 EFIAPI
657 Tcp4Poll (
658 IN EFI_TCP4_PROTOCOL *This
659 )
660 {
661 SOCKET *Sock;
662 EFI_STATUS Status;
663
664 if (NULL == This) {
665 return EFI_INVALID_PARAMETER;
666 }
667
668 Sock = SOCK_FROM_THIS (This);
669
670 Status = Sock->ProtoHandler (Sock, SOCK_POLL, NULL);
671
672 return Status;
673 }