/** @file\r
\r
-Copyright (c) 2006 - 2007, Intel Corporation\r
+Copyright (c) 2006 - 2009, Intel Corporation.<BR>\r
All rights reserved. This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
-Module Name:\r
-\r
- Udp4Main.c\r
-\r
-Abstract:\r
-\r
-\r
**/\r
\r
#include "Udp4Impl.h"\r
With different parameters in UdpConfigData, Configure() can be used to bind\r
this instance to specified port.\r
\r
- @param This Pointer to the EFI_UDP4_PROTOCOL instance.\r
- @param UdpConfigData Pointer to the buffer to receive the current configuration data.\r
+ @param[in] This Pointer to the EFI_UDP4_PROTOCOL instance.\r
+ @param[in] UdpConfigData Pointer to the buffer to receive the current configuration data.\r
\r
@retval EFI_SUCCESS The configuration settings were set, changed, or reset successfully.\r
@retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,\r
\r
if (!UdpConfigData->UseDefaultAddress &&\r
(!IP4_IS_VALID_NETMASK (SubnetMask) ||\r
- !((StationAddress == 0) || Ip4IsUnicast (StationAddress, SubnetMask)) ||\r
- !((RemoteAddress == 0) || Ip4IsUnicast (RemoteAddress, 0)))) {\r
+ !((StationAddress == 0) || NetIp4IsUnicast (StationAddress, SubnetMask)) ||\r
+ !((RemoteAddress == 0) || NetIp4IsUnicast (RemoteAddress, 0)))) {\r
//\r
// Don't use default address, and subnet mask is invalid or StationAddress is not\r
// a valid unicast IPv4 address or RemoteAddress is not a valid unicast IPv4 address\r
filtering. If the JoinFlag is FALSE and the MulticastAddress is NULL, then all\r
currently joined groups are left.\r
\r
- @param This Pointer to the EFI_UDP4_PROTOCOL instance.\r
- @param JoinFlag Set to TRUE to join a multicast group. Set to FALSE to leave one\r
- or all multicast groups.\r
- @param MulticastAddress Pointer to multicast group address to join or leave.\r
+ @param[in] This Pointer to the EFI_UDP4_PROTOCOL instance.\r
+ @param[in] JoinFlag Set to TRUE to join a multicast group. Set to FALSE to leave one\r
+ or all multicast groups.\r
+ @param[in] MulticastAddress Pointer to multicast group address to join or leave.\r
\r
@retval EFI_SUCCESS The operation completed successfully.\r
@retval EFI_NOT_STARTED The EFI UDPv4 Protocol instance has not been started.\r
copies will be updated automatically whenever the IP driver reconfigures its\r
instances; as a result, the previous modification to these copies will be lost.\r
\r
- @param This Pointer to the EFI_UDP4_PROTOCOL instance.\r
- @param DeleteRoute Set to TRUE to delete this route from the routing table.\r
- Set to FALSE to add this route to the routing table.\r
- @param SubnetAddress The destination network address that needs to be routed.\r
- @param SubnetMask The subnet mask of SubnetAddress.\r
- @param GatewayAddress The gateway IP address for this route.\r
+ @param[in] This Pointer to the EFI_UDP4_PROTOCOL instance.\r
+ @param[in] DeleteRoute Set to TRUE to delete this route from the routing table.\r
+ Set to FALSE to add this route to the routing table.\r
+ @param[in] SubnetAddress The destination network address that needs to be routed.\r
+ @param[in] SubnetMask The subnet mask of SubnetAddress.\r
+ @param[in] GatewayAddress The gateway IP address for this route.\r
\r
@retval EFI_SUCCESS The operation completed successfully.\r
@retval EFI_NOT_STARTED The EFI UDPv4 Protocol instance has not been started.\r
and context for the event will enable the user to receive the notification and\r
transmitting status.\r
\r
- @param This Pointer to the EFI_UDP4_PROTOCOL instance.\r
- @param Token Pointer to the completion token that will be placed into the\r
- transmit queue.\r
+ @param[in] This Pointer to the EFI_UDP4_PROTOCOL instance.\r
+ @param[in] Token Pointer to the completion token that will be placed into the\r
+ transmit queue.\r
\r
@retval EFI_SUCCESS The data has been queued for transmission.\r
@retval EFI_NOT_STARTED This EFI UDPv4 Protocol instance has not been started.\r
UDP4_INSTANCE_DATA *Instance;\r
EFI_TPL OldTpl;\r
NET_BUF *Packet;\r
- EFI_UDP4_HEADER *Udp4Header;\r
+ EFI_UDP_HEADER *Udp4Header;\r
EFI_UDP4_CONFIG_DATA *ConfigData;\r
IP4_ADDR Source;\r
IP4_ADDR Destination;\r
UDP4_SERVICE_DATA *Udp4Service;\r
IP_IO_OVERRIDE Override;\r
UINT16 HeadSum;\r
+ EFI_IP_ADDRESS IpDestAddr;\r
\r
if ((This == NULL) || (Token == NULL)) {\r
return EFI_INVALID_PARAMETER;\r
Udp4Service = Instance->Udp4Service;\r
*((UINTN *) &Packet->ProtoData[0]) = (UINTN) (Udp4Service->IpIo);\r
\r
- Udp4Header = (EFI_UDP4_HEADER *) NetbufAllocSpace (Packet, UDP4_HEADER_SIZE, TRUE);\r
+ Udp4Header = (EFI_UDP_HEADER *) NetbufAllocSpace (Packet, UDP4_HEADER_SIZE, TRUE);\r
+ ASSERT (Udp4Header != NULL);\r
+\r
ConfigData = &Instance->ConfigData;\r
\r
//\r
Udp4Header->Checksum = 0;\r
\r
UdpSessionData = TxData->UdpSessionData;\r
- Override.SourceAddress = ConfigData->StationAddress;\r
+ Override.Ip4OverrideData.SourceAddress = ConfigData->StationAddress;\r
\r
if (UdpSessionData != NULL) {\r
//\r
// UdpSessionData.\r
//\r
if (!EFI_IP4_EQUAL (&UdpSessionData->SourceAddress, &mZeroIp4Addr)) {\r
- CopyMem (&Override.SourceAddress, &UdpSessionData->SourceAddress, sizeof (EFI_IPv4_ADDRESS));\r
+ CopyMem (&Override.Ip4OverrideData.SourceAddress, &UdpSessionData->SourceAddress, sizeof (EFI_IPv4_ADDRESS));\r
}\r
\r
if (UdpSessionData->SourcePort != 0) {\r
Udp4Header->DstPort = HTONS (UdpSessionData->DestinationPort);\r
}\r
\r
- CopyMem (&Source, &Override.SourceAddress, sizeof (IP4_ADDR));\r
+ CopyMem (&Source, &Override.Ip4OverrideData.SourceAddress, sizeof (IP4_ADDR));\r
CopyMem (&Destination, &UdpSessionData->DestinationAddress, sizeof (IP4_ADDR));\r
\r
//\r
// Fill the IpIo Override data.\r
//\r
if (TxData->GatewayAddress != NULL) {\r
- CopyMem (&Override.GatewayAddress, TxData->GatewayAddress, sizeof (EFI_IPv4_ADDRESS));\r
+ CopyMem (&Override.Ip4OverrideData.GatewayAddress, TxData->GatewayAddress, sizeof (EFI_IPv4_ADDRESS));\r
} else {\r
- ZeroMem (&Override.GatewayAddress, sizeof (EFI_IPv4_ADDRESS));\r
+ ZeroMem (&Override.Ip4OverrideData.GatewayAddress, sizeof (EFI_IPv4_ADDRESS));\r
}\r
\r
- Override.Protocol = EFI_IP_PROTO_UDP;\r
- Override.TypeOfService = ConfigData->TypeOfService;\r
- Override.TimeToLive = ConfigData->TimeToLive;\r
- Override.DoNotFragment = ConfigData->DoNotFragment;\r
+ Override.Ip4OverrideData.Protocol = EFI_IP_PROTO_UDP;\r
+ Override.Ip4OverrideData.TypeOfService = ConfigData->TypeOfService;\r
+ Override.Ip4OverrideData.TimeToLive = ConfigData->TimeToLive;\r
+ Override.Ip4OverrideData.DoNotFragment = ConfigData->DoNotFragment;\r
\r
//\r
// Save the token into the TxToken map.\r
//\r
// Send out this datagram through IpIo.\r
//\r
+ IpDestAddr.Addr[0] = Destination;\r
Status = IpIoSend (\r
Udp4Service->IpIo,\r
Packet,\r
Instance->IpInfo,\r
Instance,\r
Token,\r
- Destination,\r
+ &IpDestAddr,\r
&Override\r
);\r
if (EFI_ERROR (Status)) {\r
will enable the user to receive the notification and receiving status. That\r
notification function is guaranteed to not be re-entered.\r
\r
- @param This Pointer to the EFI_UDP4_PROTOCOL instance.\r
- @param Token Pointer to a token that is associated with the receive data\r
- descriptor.\r
+ @param[in] This Pointer to the EFI_UDP4_PROTOCOL instance.\r
+ @param[in] Token Pointer to a token that is associated with\r
+ the receive data descriptor.\r
\r
@retval EFI_SUCCESS The receive completion token was cached.\r
@retval EFI_NOT_STARTED This EFI UDPv4 Protocol instance has not been started.\r
//\r
// Dispatch the DPC queued by the NotifyFunction of Token->Event.\r
//\r
- NetLibDispatchDpc ();\r
+ DispatchDpc ();\r
\r
ON_EXIT:\r
\r
the asynchronous operation has completed, this function will not signal the\r
token and EFI_NOT_FOUND is returned.\r
\r
- @param This Pointer to the EFI_UDP4_PROTOCOL instance.\r
- @param Token Pointer to a token that has been issued by\r
- EFI_UDP4_PROTOCOL.Transmit() or\r
- EFI_UDP4_PROTOCOL.Receive().If NULL, all pending\r
- tokens are aborted.\r
+ @param[in] This Pointer to the EFI_UDP4_PROTOCOL instance.\r
+ @param[in] Token Pointer to a token that has been issued by\r
+ EFI_UDP4_PROTOCOL.Transmit() or\r
+ EFI_UDP4_PROTOCOL.Receive().If NULL, all pending\r
+ tokens are aborted.\r
\r
@retval EFI_SUCCESS The asynchronous I/O request was aborted and Token.Event\r
was signaled. When Token is NULL, all pending requests are\r
//\r
// Dispatch the DPC queued by the NotifyFunction of the cancelled token's events.\r
//\r
- NetLibDispatchDpc ();\r
+ DispatchDpc ();\r
\r
gBS->RestoreTPL (OldTpl);\r
\r
Drivers and applications that are experiencing packet loss should try calling\r
the Poll() function more often.\r
\r
- @param This Pointer to the EFI_UDP4_PROTOCOL instance.\r
+ @param[in] This Pointer to the EFI_UDP4_PROTOCOL instance.\r
\r
@retval EFI_SUCCESS Incoming or outgoing data was processed.\r
@retval EFI_INVALID_PARAMETER This is NULL.\r