]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c
Clean codes per ECC.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Dhcp4Dxe / Dhcp4Impl.c
index 09de4cdaab5dd1767a66c8d0e94bbc1921b0f117..6097f0d3d728e59ac24cd12283a8cf71b5708aac 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-Copyright (c) 2006 - 2007, Intel Corporation\r
+Copyright (c) 2006 - 2008, Intel Corporation\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
@@ -35,7 +35,6 @@ Abstract:
                                  operation parameter.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 EfiDhcp4GetModeData (\r
@@ -57,7 +56,7 @@ EfiDhcp4GetModeData (
   }\r
 \r
   Instance = DHCP_INSTANCE_FROM_THIS (This);\r
-  \r
+\r
   OldTpl  = gBS->RaiseTPL (TPL_CALLBACK);\r
   DhcpSb  = Instance->Service;\r
 \r
@@ -286,7 +285,6 @@ DhcpYieldControl (
   @retval EFI_SUCCESS            The child is configured.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 EfiDhcp4Configure (\r
@@ -407,7 +405,6 @@ ON_EXIT:
   @retval EFI_SUCCESS            The DHCP process is started.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 EfiDhcp4Start (\r
@@ -497,7 +494,6 @@ ON_ERROR:
   @retval EFI_SUCCESS            The DHCP is renewed/rebound.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 EfiDhcp4RenewRebind (\r
@@ -597,7 +593,6 @@ ON_ERROR:
   @retval EFI_SUCCESS            The lease is released.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 EfiDhcp4Release (\r
@@ -664,7 +659,6 @@ ON_EXIT:
   @retval EFI_SUCCESS            The DHCP process is stopped.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 EfiDhcp4Stop (\r
@@ -719,7 +713,6 @@ EfiDhcp4Stop (
   @retval EFI_SUCCESS            The packet is build.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 EfiDhcp4Build (\r
@@ -762,7 +755,6 @@ EfiDhcp4Build (
            );\r
 }\r
 \r
-STATIC\r
 EFI_STATUS\r
 Dhcp4InstanceConfigUdpIo (\r
   IN UDP_IO_PORT  *UdpIo,\r
@@ -801,7 +793,6 @@ Dhcp4InstanceConfigUdpIo (
   return UdpIo->Udp->Configure (UdpIo->Udp, &UdpConfigData);\r
 }\r
 \r
-STATIC\r
 EFI_STATUS\r
 Dhcp4InstanceCreateUdpIo (\r
   IN DHCP_PROTOCOL  *Instance\r
@@ -820,7 +811,6 @@ Dhcp4InstanceCreateUdpIo (
   }\r
 }\r
 \r
-STATIC\r
 VOID\r
 DhcpDummyExtFree (\r
   IN VOID                   *Arg\r
@@ -840,7 +830,7 @@ Returns:
   None\r
 \r
 --*/\r
-{  \r
+{\r
 }\r
 \r
 VOID\r
@@ -873,14 +863,14 @@ PxeDhcpInput (
   }\r
 \r
   ASSERT (UdpPacket != NULL);\r
-  \r
+\r
   //\r
   // Validate the packet received\r
   //\r
   if (UdpPacket->TotalSize < sizeof (EFI_DHCP4_HEADER)) {\r
     goto RESTART;\r
   }\r
-  \r
+\r
   //\r
   // Copy the DHCP message to a continuous memory block, make the buffer size\r
   // of the EFI_DHCP4_PACKET a multiple of 4-byte.\r
@@ -900,16 +890,16 @@ PxeDhcpInput (
   if (Packet->Length != UdpPacket->TotalSize) {\r
     goto RESTART;\r
   }\r
-  \r
+\r
   //\r
   // Is this packet the answer to our packet?\r
   //\r
   if ((Head->OpCode != BOOTP_REPLY) ||\r
       (Head->Xid != Token->Packet->Dhcp4.Header.Xid) ||\r
-      !NET_MAC_EQUAL (&DhcpSb->Mac, Head->ClientHwAddr, DhcpSb->HwLen)) {\r
+      (CompareMem (DhcpSb->ClientAddressSendOut, Head->ClientHwAddr, Head->HwAddrLen) != 0)) {\r
     goto RESTART;\r
   }\r
-  \r
+\r
   //\r
   // Validate the options and retrieve the interested options\r
   //\r
@@ -979,21 +969,25 @@ SIGNAL_USER:
 \r
   if (Token->CompletionEvent != NULL) {\r
     gBS->SignalEvent (Token->CompletionEvent);\r
-  }  \r
+  }\r
 }\r
 \r
 \r
 /**\r
-  Transmit and receive a packet through this DHCP service.\r
-  This is unsupported.\r
+  Transmits a DHCP formatted packet and optionally waits for responses.\r
 \r
-  @param  This                   The DHCP protocol instance\r
-  @param  Token                  The transmit and receive instance\r
+  @param  This    Pointer to the EFI_DHCP4_PROTOCOL instance.\r
+  @param  Token   Pointer to the EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN structure.\r
 \r
-  @retval EFI_UNSUPPORTED        It always returns unsupported.\r
+  @retval EFI_SUCCESS           The packet was successfully queued for transmission.\r
+  @retval EFI_INVALID_PARAMETER Some parameter is NULL.\r
+  @retval EFI_NOT_READY         The previous call to this function has not finished yet. Try to call\r
+                                this function after collection process completes.\r
+  @retval EFI_NO_MAPPING        The default station address is not available yet.\r
+  @retval EFI_OUT_OF_RESOURCES  Required system resources could not be allocated.\r
+  @retval Others                Some other unexpected error occurred.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 EfiDhcp4TransmitReceive (\r
@@ -1061,6 +1055,11 @@ EfiDhcp4TransmitReceive (
     goto ON_ERROR;\r
   }\r
 \r
+  //\r
+  // Save the Client Address is sent out\r
+  //\r
+  CopyMem (&DhcpSb->ClientAddressSendOut[0], &Token->Packet->Dhcp4.Header.ClientHwAddr[0], Token->Packet->Dhcp4.Header.HwAddrLen);\r
+\r
   //\r
   // Wrap the DHCP packet into a net buffer.\r
   //\r
@@ -1155,7 +1154,6 @@ ON_ERROR:
   @retval EFI_SUCCESS            It always returns EFI_SUCCESS\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 Dhcp4ParseCheckOption (\r
   IN UINT8                  Tag,\r
@@ -1197,7 +1195,6 @@ Dhcp4ParseCheckOption (
   @retval EFI_SUCCESS            The options are parsed.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 EfiDhcp4Parse (\r