3 Copyright (c) 2006 - 2007, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
23 #include <Protocol/Ip4.h>
25 EFI_UDP4_PROTOCOL mUdp4Protocol
= {
38 This function copies the current operational settings of this EFI UDPv4 Protocol
39 instance into user-supplied buffers. This function is used optionally to retrieve
40 the operational mode data of underlying networks or drivers.
42 @param This Pointer to the EFI_UDP4_PROTOCOL instance.
43 @param Udp4ConfigData Pointer to the buffer to receive the current
45 @param Ip4ModeData Pointer to the EFI IPv4 Protocol mode data
47 @param MnpConfigData Pointer to the managed network configuration data
49 @param SnpModeData Pointer to the simple network mode data structure.
51 @retval EFI_SUCCESS The mode data was read.
52 @retval EFI_NOT_STARTED When Udp4ConfigData is queried, no configuration
53 data is available because this instance has not
55 @retval EFI_INVALID_PARAMETER This is NULL.
61 IN EFI_UDP4_PROTOCOL
*This
,
62 OUT EFI_UDP4_CONFIG_DATA
*Udp4ConfigData OPTIONAL
,
63 OUT EFI_IP4_MODE_DATA
*Ip4ModeData OPTIONAL
,
64 OUT EFI_MANAGED_NETWORK_CONFIG_DATA
*MnpConfigData OPTIONAL
,
65 OUT EFI_SIMPLE_NETWORK_MODE
*SnpModeData OPTIONAL
68 UDP4_INSTANCE_DATA
*Instance
;
74 return EFI_INVALID_PARAMETER
;
77 Instance
= UDP4_INSTANCE_DATA_FROM_THIS (This
);
79 if (!Instance
->Configured
&& (Udp4ConfigData
!= NULL
)) {
80 return EFI_NOT_STARTED
;
83 OldTpl
= NET_RAISE_TPL (NET_TPL_LOCK
);
85 if (Udp4ConfigData
!= NULL
) {
87 // Set the Udp4ConfigData.
89 *Udp4ConfigData
= Instance
->ConfigData
;
92 Ip
= Instance
->IpInfo
->Ip
;
95 // Get the underlying Ip4ModeData, MnpConfigData and SnpModeData.
97 Status
= Ip
->GetModeData (Ip
, Ip4ModeData
, MnpConfigData
, SnpModeData
);
99 NET_RESTORE_TPL (OldTpl
);
106 This function is used to do the following:
107 Initialize and start this instance of the EFI UDPv4 Protocol.
108 Change the filtering rules and operational parameters.
109 Reset this instance of the EFI UDPv4 Protocol.
111 @param This Pointer to the EFI_UDP4_PROTOCOL instance.
112 @param UdpConfigData Pointer to the buffer to receive the current mode
115 @retval EFI_SUCCESS The configuration settings were set, changed, or
117 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP,
118 BOOTP, RARP, etc.) is not finished yet.
119 @retval EFI_INVALID_PARAMETER One or more following conditions are TRUE: This is
120 NULL. UdpConfigData.StationAddress is not a valid
121 unicast IPv4 address. UdpConfigData.SubnetMask is
122 not a valid IPv4 address mask.
123 UdpConfigData.RemoteAddress is not a valid unicast
124 IPv4 address if it is not zero.
125 @retval EFI_ALREADY_STARTED The EFI UDPv4 Protocol instance is already
126 started/configured and must be stopped/reset
127 before it can be reconfigured. Only TypeOfService,
128 TimeToLive, DoNotFragment, ReceiveTimeout, and
129 TransmitTimeout can be reconfigured without
130 stopping the current instance of the EFI UDPv4
132 @retval EFI_ACCESS_DENIED UdpConfigData.AllowDuplicatePort is FALSE and
133 UdpConfigData.StationPort is already used by other
135 @retval EFI_OUT_OF_RESOURCES The EFI UDPv4 Protocol driver cannot allocate
136 memory for this EFI UDPv4 Protocol instance.
137 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred and
138 this instance was not opened.
144 IN EFI_UDP4_PROTOCOL
*This
,
145 IN EFI_UDP4_CONFIG_DATA
*UdpConfigData OPTIONAL
149 UDP4_INSTANCE_DATA
*Instance
;
150 UDP4_SERVICE_DATA
*Udp4Service
;
152 IP4_ADDR StationAddress
;
154 IP4_ADDR RemoteAddress
;
155 EFI_IP4_CONFIG_DATA Ip4ConfigData
;
158 return EFI_INVALID_PARAMETER
;
161 Instance
= UDP4_INSTANCE_DATA_FROM_THIS (This
);
163 if (!Instance
->Configured
&& (UdpConfigData
== NULL
)) {
167 Udp4Service
= Instance
->Udp4Service
;
168 Status
= EFI_SUCCESS
;
170 OldTpl
= NET_RAISE_TPL (NET_TPL_LOCK
);
172 if (UdpConfigData
!= NULL
) {
174 StationAddress
= EFI_NTOHL (UdpConfigData
->StationAddress
);
175 SubnetMask
= EFI_NTOHL (UdpConfigData
->SubnetMask
);
176 RemoteAddress
= EFI_NTOHL (UdpConfigData
->RemoteAddress
);
178 if (!UdpConfigData
->UseDefaultAddress
&&
179 (!IP4_IS_VALID_NETMASK (SubnetMask
) ||
180 !((StationAddress
== 0) || Ip4IsUnicast (StationAddress
, SubnetMask
)) ||
181 !((RemoteAddress
== 0) || Ip4IsUnicast (RemoteAddress
, 0)))) {
183 // Don't use default address, and subnet mask is invalid or StationAddress is not
184 // a valid unicast IPv4 address or RemoteAddress is not a valid unicast IPv4 address
187 Status
= EFI_INVALID_PARAMETER
;
191 if (Instance
->Configured
) {
193 // The instance is already configured, try to do the re-configuration.
195 if (!Udp4IsReconfigurable (&Instance
->ConfigData
, UdpConfigData
)) {
197 // If the new configuration data wants to change some unreconfigurable
198 // settings, return EFI_ALREADY_STARTED.
200 Status
= EFI_ALREADY_STARTED
;
205 // Save the reconfigurable parameters.
207 Instance
->ConfigData
.TypeOfService
= UdpConfigData
->TypeOfService
;
208 Instance
->ConfigData
.TimeToLive
= UdpConfigData
->TimeToLive
;
209 Instance
->ConfigData
.DoNotFragment
= UdpConfigData
->DoNotFragment
;
210 Instance
->ConfigData
.ReceiveTimeout
= UdpConfigData
->ReceiveTimeout
;
211 Instance
->ConfigData
.TransmitTimeout
= UdpConfigData
->TransmitTimeout
;
214 // Construct the Ip configuration data from the UdpConfigData.
216 Udp4BuildIp4ConfigData (UdpConfigData
, &Ip4ConfigData
);
219 // Configure the Ip instance wrapped in the IpInfo.
221 Status
= IpIoConfigIp (Instance
->IpInfo
, &Ip4ConfigData
);
222 if (EFI_ERROR (Status
)) {
223 if (Status
== EFI_NO_MAPPING
) {
224 Instance
->IsNoMapping
= TRUE
;
230 Instance
->IsNoMapping
= FALSE
;
233 // Save the configuration data.
235 Instance
->ConfigData
= *UdpConfigData
;
236 Instance
->ConfigData
.StationAddress
= Ip4ConfigData
.StationAddress
;
237 Instance
->ConfigData
.SubnetMask
= Ip4ConfigData
.SubnetMask
;
240 // Try to allocate the required port resource.
242 Status
= Udp4Bind (&Udp4Service
->ChildrenList
, &Instance
->ConfigData
);
243 if (EFI_ERROR (Status
)) {
245 // Reset the ip instance if bind fails.
247 IpIoConfigIp (Instance
->IpInfo
, NULL
);
252 // Pre calculate the checksum for the pseudo head, ignore the UDP length first.
254 Instance
->HeadSum
= NetPseudoHeadChecksum (
255 EFI_IP4 (Instance
->ConfigData
.StationAddress
),
256 EFI_IP4 (Instance
->ConfigData
.RemoteAddress
),
261 Instance
->Configured
= TRUE
;
265 // UdpConfigData is NULL, reset the instance.
267 Instance
->Configured
= FALSE
;
268 Instance
->IsNoMapping
= FALSE
;
271 // Reset the Ip instance wrapped in the IpInfo.
273 IpIoConfigIp (Instance
->IpInfo
, NULL
);
276 // Cancel all the user tokens.
278 Udp4InstanceCancelToken (Instance
, NULL
);
281 // Remove the buffered RxData for this instance.
283 Udp4FlushRxData (&Instance
->RcvdDgramQue
);
286 Udp4SetVariableData (Instance
->Udp4Service
);
290 NET_RESTORE_TPL (OldTpl
);
297 This function is used to enable and disable the multicast group filtering.
299 @param This Pointer to the EFI_UDP4_PROTOCOL instance.
300 @param JoinFlag Set to TRUE to join a multicast group. Set to
301 FALSE to leave one or all multicast groups.
302 @param MulticastAddress Pointer to multicast group address to join or
305 @retval EFI_SUCCESS The operation completed successfully.
306 @retval EFI_NOT_STARTED The EFI UDPv4 Protocol instance has not been
308 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP,
309 BOOTP, RARP, etc.) is not finished yet.
310 @retval EFI_OUT_OF_RESOURCES Could not allocate resources to join the group.
311 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
312 This is NULL. JoinFlag is TRUE and
313 MulticastAddress is NULL. JoinFlag is TRUE and
314 *MulticastAddress is not a valid multicast
316 @retval EFI_ALREADY_STARTED The group address is already in the group table
317 (when JoinFlag is TRUE).
318 @retval EFI_NOT_FOUND The group address is not in the group table (when
320 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
326 IN EFI_UDP4_PROTOCOL
*This
,
328 IN EFI_IPv4_ADDRESS
*MulticastAddress OPTIONAL
332 UDP4_INSTANCE_DATA
*Instance
;
333 EFI_IP4_PROTOCOL
*Ip
;
336 if ((This
== NULL
) ||
337 (JoinFlag
&& (MulticastAddress
== NULL
)) ||
338 (JoinFlag
&& !IP4_IS_MULTICAST (EFI_NTOHL (*MulticastAddress
)))) {
339 return EFI_INVALID_PARAMETER
;
342 Instance
= UDP4_INSTANCE_DATA_FROM_THIS (This
);
344 if (Instance
->IsNoMapping
) {
345 return EFI_NO_MAPPING
;
348 if (!Instance
->Configured
) {
349 return EFI_NOT_STARTED
;
352 Ip
= Instance
->IpInfo
->Ip
;
354 OldTpl
= NET_RAISE_TPL (NET_TPL_LOCK
);
357 // Invoke the Ip instance the Udp4 instance consumes to do the group operation.
359 Status
= Ip
->Groups (Ip
, JoinFlag
, MulticastAddress
);
361 if (EFI_ERROR (Status
)) {
366 // Keep a local copy of the configured multicast IPs because IpIo receives
367 // datagrams from the 0 station address IP instance and then UDP delivers to
368 // the matched instance. This copy of multicast IPs is used to avoid receive
369 // the mutlicast datagrams destinated to multicast IPs the other instances configured.
375 (VOID
*) (UINTN
) EFI_IP4 (*MulticastAddress
),
380 NetMapIterate (&Instance
->McastIps
, Udp4LeaveGroup
, MulticastAddress
);
385 NET_RESTORE_TPL (OldTpl
);
392 This function adds a route to or deletes a route from the routing table.
394 @param This Pointer to the EFI_UDP4_PROTOCOL instance.
395 @param DeleteRoute Set to TRUE to delete this route from the routing
396 table. Set to FALSE to add this route to the
398 @param SubnetAddress The destination network address that needs to be
400 @param SubnetMask The subnet mask of SubnetAddress.
401 @param GatewayAddress The gateway IP address for this route.
403 @retval EFI_SUCCESS The operation completed successfully.
404 @retval EFI_NOT_STARTED The EFI UDPv4 Protocol instance has not been
406 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP,
407 BOOTP, RARP, etc.) is not finished yet.
408 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
409 This is NULL. SubnetAddress is NULL. SubnetMask is
410 NULL. GatewayAddress is NULL. SubnetAddress is not
411 a valid subnet address. SubnetMask is not a valid
412 subnet mask. GatewayAddress is not a valid unicast
414 @retval EFI_OUT_OF_RESOURCES Could not add the entry to the routing table.
415 @retval EFI_NOT_FOUND This route is not in the routing table.
416 @retval EFI_ACCESS_DENIED The route is already defined in the routing table.
422 IN EFI_UDP4_PROTOCOL
*This
,
423 IN BOOLEAN DeleteRoute
,
424 IN EFI_IPv4_ADDRESS
*SubnetAddress
,
425 IN EFI_IPv4_ADDRESS
*SubnetMask
,
426 IN EFI_IPv4_ADDRESS
*GatewayAddress
429 UDP4_INSTANCE_DATA
*Instance
;
430 EFI_IP4_PROTOCOL
*Ip
;
433 return EFI_INVALID_PARAMETER
;
436 Instance
= UDP4_INSTANCE_DATA_FROM_THIS (This
);
438 if (Instance
->IsNoMapping
) {
439 return EFI_NO_MAPPING
;
442 if (!Instance
->Configured
) {
443 return EFI_NOT_STARTED
;
446 Ip
= Instance
->IpInfo
->Ip
;
449 // Invoke the Ip instance the Udp4 instance consumes to do the actual operation.
451 return Ip
->Routes (Ip
, DeleteRoute
, SubnetAddress
, SubnetMask
, GatewayAddress
);
456 This function places a sending request to this instance of the EFI UDPv4 Protocol,
457 alongside the transmit data that was filled by the user.
459 @param This Pointer to the EFI_UDP4_PROTOCOL instance.
460 @param Token Pointer to the completion token that will be
461 placed into the transmit queue.
463 @retval EFI_SUCCESS The data has been queued for transmission.
464 @retval EFI_NOT_STARTED This EFI UDPv4 Protocol instance has not been
466 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP,
467 BOOTP, RARP, etc.) is not finished yet.
468 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE: This is
469 NULL. Token is NULL. Token.Event is NULL.
470 Token.Packet.TxData is NULL.
471 Token.Packet.TxData.FragmentCount is zero.
472 Token.Packet.TxData.DataLength is not equal to the
473 sum of fragment lengths. One or more of the
474 Token.Packet.TxData.FragmentTable[].
475 FragmentLength fields is zero. One or more of the
476 Token.Packet.TxData.FragmentTable[].
477 FragmentBuffer fields is NULL.
478 Token.Packet.TxData. GatewayAddress is not a
479 unicast IPv4 address if it is not NULL. One or
480 more IPv4 addresses in Token.Packet.TxData.
481 UdpSessionData are not valid unicast IPv4
482 addresses if the UdpSessionData is not NULL.
483 @retval EFI_ACCESS_DENIED The transmit completion token with the same
484 Token.Event is already in the transmit queue.
485 @retval EFI_NOT_READY The completion token could not be queued because
486 the transmit queue is full.
487 @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data.
488 @retval EFI_NOT_FOUND There is no route to the destination network or
490 @retval EFI_BAD_BUFFER_SIZE The data length is greater than the maximum UDP
491 packet size. Or the length of the IP header + UDP
492 header + data length is greater than MTU if
493 DoNotFragment is TRUE.
499 IN EFI_UDP4_PROTOCOL
*This
,
500 IN EFI_UDP4_COMPLETION_TOKEN
*Token
504 UDP4_INSTANCE_DATA
*Instance
;
507 EFI_UDP4_HEADER
*Udp4Header
;
508 EFI_UDP4_CONFIG_DATA
*ConfigData
;
509 IP4_ADDR Destination
;
510 EFI_UDP4_TRANSMIT_DATA
*TxData
;
511 EFI_UDP4_SESSION_DATA
*UdpSessionData
;
512 UDP4_SERVICE_DATA
*Udp4Service
;
513 IP_IO_OVERRIDE Override
;
516 if ((This
== NULL
) || (Token
== NULL
)) {
517 return EFI_INVALID_PARAMETER
;
520 Instance
= UDP4_INSTANCE_DATA_FROM_THIS (This
);
522 if (Instance
->IsNoMapping
) {
523 return EFI_NO_MAPPING
;
526 if (!Instance
->Configured
) {
527 return EFI_NOT_STARTED
;
530 OldTpl
= NET_RAISE_TPL (NET_TPL_LOCK
);
533 // Validate the Token, if the token is invalid return the error code.
535 Status
= Udp4ValidateTxToken (Instance
, Token
);
536 if (EFI_ERROR (Status
)) {
540 if (EFI_ERROR (NetMapIterate (&Instance
->TxTokens
, Udp4TokenExist
, Token
)) ||
541 EFI_ERROR (NetMapIterate (&Instance
->RxTokens
, Udp4TokenExist
, Token
))) {
543 // Try to find a duplicate token in the two token maps, if found, return
544 // EFI_ACCESS_DENIED.
546 Status
= EFI_ACCESS_DENIED
;
550 TxData
= Token
->Packet
.TxData
;
553 // Create a net buffer to hold the user buffer and the udp header.
555 Packet
= NetbufFromExt (
556 (NET_FRAGMENT
*)TxData
->FragmentTable
,
557 TxData
->FragmentCount
,
560 Udp4NetVectorExtFree
,
563 if (Packet
== NULL
) {
564 Status
= EFI_OUT_OF_RESOURCES
;
569 // Store the IpIo in ProtoData.
571 Udp4Service
= Instance
->Udp4Service
;
572 *((UINTN
*) &Packet
->ProtoData
[0]) = (UINTN
) (Udp4Service
->IpIo
);
574 Udp4Header
= (EFI_UDP4_HEADER
*) NetbufAllocSpace (Packet
, UDP4_HEADER_SIZE
, TRUE
);
575 ConfigData
= &Instance
->ConfigData
;
578 // Fill the udp header.
580 Udp4Header
->SrcPort
= HTONS (ConfigData
->StationPort
);
581 Udp4Header
->DstPort
= HTONS (ConfigData
->RemotePort
);
582 Udp4Header
->Length
= HTONS (Packet
->TotalSize
);
583 Udp4Header
->Checksum
= 0;
585 UdpSessionData
= TxData
->UdpSessionData
;
586 Override
.SourceAddress
= ConfigData
->StationAddress
;
588 if (UdpSessionData
!= NULL
) {
590 // Set the SourceAddress, SrcPort and Destination according to the specified
593 if (EFI_IP4 (UdpSessionData
->SourceAddress
) != 0) {
594 Override
.SourceAddress
= UdpSessionData
->SourceAddress
;
597 if (UdpSessionData
->SourcePort
!= 0) {
598 Udp4Header
->SrcPort
= HTONS (UdpSessionData
->SourcePort
);
601 Destination
= EFI_IP4 (UdpSessionData
->DestinationAddress
);
603 if (UdpSessionData
->DestinationPort
!= 0) {
604 Udp4Header
->DstPort
= HTONS (UdpSessionData
->DestinationPort
);
608 // calculate the pseudo head checksum using the overridden parameters.
610 HeadSum
= NetPseudoHeadChecksum (
611 EFI_IP4 (Override
.SourceAddress
),
618 // UdpSessionData is NULL, use the address and port information previously configured.
620 Destination
= EFI_IP4 (ConfigData
->RemoteAddress
);
621 HeadSum
= Instance
->HeadSum
;
625 // calculate the checksum.
627 Udp4Header
->Checksum
= Udp4Checksum (Packet
, HeadSum
);
628 if (Udp4Header
->Checksum
== 0) {
630 // If the calculated checksum is 0, fill the Checksum field with all ones.
632 Udp4Header
->Checksum
= 0xffff;
636 // Fill the IpIo Override data.
638 EFI_IP4 (Override
.GatewayAddress
) = (TxData
->GatewayAddress
!= NULL
) ?
639 EFI_IP4 (*(TxData
->GatewayAddress
)) : 0;
640 Override
.Protocol
= EFI_IP_PROTO_UDP
;
641 Override
.TypeOfService
= ConfigData
->TypeOfService
;
642 Override
.TimeToLive
= ConfigData
->TimeToLive
;
643 Override
.DoNotFragment
= ConfigData
->DoNotFragment
;
646 // Save the token into the TxToken map.
648 Status
= NetMapInsertTail (&Instance
->TxTokens
, Token
, Packet
);
649 if (EFI_ERROR (Status
)) {
654 // Send out this datagram through IpIo.
665 if (EFI_ERROR (Status
)) {
667 // Remove this token from the TxTokens.
669 Udp4RemoveToken (&Instance
->TxTokens
, Token
);
678 NET_RESTORE_TPL (OldTpl
);
685 This function places a completion token into the receive packet queue. This function
686 is always asynchronous.
688 @param This Pointer to the EFI_UDP4_PROTOCOL instance.
689 @param Token Pointer to a token that is associated with the
690 receive data descriptor.
692 @retval EFI_SUCCESS The receive completion token is cached.
693 @retval EFI_NOT_STARTED This EFI UDPv4 Protocol instance has not been
695 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP,
696 BOOTP, RARP, etc.) is not finished yet.
697 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
698 This is NULL. Token is NULL. Token.Event is NULL.
699 @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued
700 due to a lack of system resources (usually
702 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
703 The EFI UDPv4 Protocol instance has been reset to
705 @retval EFI_ACCESS_DENIED A receive completion token with the same
706 Token.Event is already in the receive queue.
707 @retval EFI_NOT_READY The receive request could not be queued because
708 the receive queue is full.
714 IN EFI_UDP4_PROTOCOL
*This
,
715 IN EFI_UDP4_COMPLETION_TOKEN
*Token
719 UDP4_INSTANCE_DATA
*Instance
;
722 if ((This
== NULL
) || (Token
== NULL
) || (Token
->Event
== NULL
)) {
723 return EFI_INVALID_PARAMETER
;
726 Instance
= UDP4_INSTANCE_DATA_FROM_THIS (This
);
728 if (Instance
->IsNoMapping
) {
729 return EFI_NO_MAPPING
;
732 if (!Instance
->Configured
) {
733 return EFI_NOT_STARTED
;
736 OldTpl
= NET_RAISE_TPL (NET_TPL_LOCK
);
738 if (EFI_ERROR (NetMapIterate (&Instance
->RxTokens
, Udp4TokenExist
, Token
))||
739 EFI_ERROR (NetMapIterate (&Instance
->TxTokens
, Udp4TokenExist
, Token
))) {
741 // Return EFI_ACCESS_DENIED if the specified token is already in the TxTokens or
744 Status
= EFI_ACCESS_DENIED
;
748 Token
->Packet
.RxData
= NULL
;
751 // Save the token into the RxTokens map.
753 Status
= NetMapInsertTail (&Instance
->RxTokens
, Token
, NULL
);
754 if (EFI_ERROR (Status
)) {
755 return EFI_NOT_READY
;
759 // If there is an icmp error, report it.
761 Udp4ReportIcmpError (Instance
);
764 // Try to delivered the received datagrams.
766 Udp4InstanceDeliverDgram (Instance
);
770 NET_RESTORE_TPL (OldTpl
);
777 This function is used to abort a pending transmit or receive request.
779 @param This Pointer to the EFI_UDP4_PROTOCOL instance.
780 @param Token Pointer to a token that has been issued by
781 EFI_UDP4_PROTOCOL.Transmit() or
782 EFI_UDP4_PROTOCOL.Receive().
784 @retval EFI_SUCCESS The asynchronous I/O request is aborted and
785 Token.Event is signaled. When Token is NULL, all
786 pending requests are aborted and their events are
788 @retval EFI_INVALID_PARAMETER This is NULL.
789 @retval EFI_NOT_STARTED This instance has not been started.
790 @retval EFI_NO_MAPPING When using the default address, configuration
791 (DHCP, BOOTP, RARP, etc.) is not finished yet.
792 @retval EFI_NOT_FOUND When Token is not NULL, the asynchronous I/O
793 request is not found in the transmit or receive
794 queue. It is either completed or not issued by
795 Transmit() or Receive().
801 IN EFI_UDP4_PROTOCOL
*This
,
802 IN EFI_UDP4_COMPLETION_TOKEN
*Token OPTIONAL
806 UDP4_INSTANCE_DATA
*Instance
;
810 return EFI_INVALID_PARAMETER
;
813 Instance
= UDP4_INSTANCE_DATA_FROM_THIS (This
);
815 if (Instance
->IsNoMapping
) {
816 return EFI_NO_MAPPING
;
819 if (!Instance
->Configured
) {
820 return EFI_NOT_STARTED
;
823 OldTpl
= NET_RAISE_TPL (NET_TPL_LOCK
);
826 // Cancle the tokens specified by Token for this instance.
828 Status
= Udp4InstanceCancelToken (Instance
, Token
);
830 NET_RESTORE_TPL (OldTpl
);
837 This function can be used by network drivers and applications to increase the rate that
838 data packets are moved between the communications device and the transmit/receive queues.
840 This - Pointer to the EFI_UDP4_PROTOCOL instance.
842 @retval EFI_SUCCESS Incoming or outgoing data was processed.
843 @retval EFI_INVALID_PARAMETER This is NULL.
844 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
845 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or
852 IN EFI_UDP4_PROTOCOL
*This
855 UDP4_INSTANCE_DATA
*Instance
;
856 EFI_IP4_PROTOCOL
*Ip
;
859 return EFI_INVALID_PARAMETER
;
862 Instance
= UDP4_INSTANCE_DATA_FROM_THIS (This
);
863 Ip
= Instance
->IpInfo
->Ip
;
866 // Invode the Ip instance consumed by the udp instance to do the poll operation.
868 return Ip
->Poll (Ip
);