]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Main.c
Update the copyright notice format
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Udp4Dxe / Udp4Main.c
index 7bb83b06f66a717b54f9b64ef4020705595aec84..ed997e1930326a1ebf9e1d0ae4ee8802a18df063 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 \r
-Copyright (c) 2006 - 2009, Intel Corporation.<BR>\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r
+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
 http://opensource.org/licenses/bsd-license.php\r
@@ -33,11 +33,11 @@ EFI_UDP4_PROTOCOL  mUdp4Protocol = {
   optionally to retrieve the operational mode data of underlying networks or\r
   drivers.\r
 \r
-  @param  This           Pointer to the EFI_UDP4_PROTOCOL instance.\r
-  @param  Udp4ConfigData Pointer to the buffer to receive the current configuration data.\r
-  @param  Ip4ModeData    Pointer to the EFI IPv4 Protocol mode data structure.\r
-  @param  MnpConfigData  Pointer to the managed network configuration data structure.\r
-  @param  SnpModeData    Pointer to the simple network mode data structure.\r
+  @param[in]  This              Pointer to the EFI_UDP4_PROTOCOL instance.\r
+  @param[out] Udp4ConfigData    Pointer to the buffer to receive the current configuration data.\r
+  @param[out] Ip4ModeData       Pointer to the EFI IPv4 Protocol mode data structure.\r
+  @param[out] MnpConfigData     Pointer to the managed network configuration data structure.\r
+  @param[out] SnpModeData       Pointer to the simple network mode data structure.\r
 \r
   @retval EFI_SUCCESS           The mode data was read.\r
   @retval EFI_NOT_STARTED       When Udp4ConfigData is queried, no configuration data is\r
@@ -171,8 +171,8 @@ Udp4Configure (
 \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
@@ -507,7 +507,7 @@ Udp4Transmit (
   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
@@ -516,6 +516,7 @@ Udp4Transmit (
   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
@@ -575,7 +576,7 @@ Udp4Transmit (
   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
@@ -585,11 +586,11 @@ Udp4Transmit (
   //\r
   Udp4Header->SrcPort      = HTONS (ConfigData->StationPort);\r
   Udp4Header->DstPort      = HTONS (ConfigData->RemotePort);\r
-  Udp4Header->Length       = HTONS (Packet->TotalSize);\r
+  Udp4Header->Length       = HTONS ((UINT16) Packet->TotalSize);\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
@@ -597,7 +598,7 @@ Udp4Transmit (
     // 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
@@ -608,7 +609,7 @@ Udp4Transmit (
       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
@@ -644,15 +645,15 @@ Udp4Transmit (
   // 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
@@ -665,13 +666,14 @@ Udp4Transmit (
   //\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