]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c
Make doxygen type comment for Nt32Pkg.dec file.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Dhcp4Dxe / Dhcp4Io.c
index 9cead840bd1824da9a87039a0696bd28506c0108..1f168c6dfff06eb1f87e74ccd718e61bee037b94 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
@@ -82,7 +82,6 @@ DhcpInitRequest (
   @retval EFI_ABORTED           The user function ask it to abort.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 DhcpCallUser (\r
   IN  DHCP_SERVICE          *DhcpSb,\r
@@ -250,7 +249,6 @@ DhcpSetState (
   @return None\r
 \r
 **/\r
-STATIC\r
 VOID\r
 DhcpSetTransmitTimer (\r
   IN DHCP_SERVICE           *DhcpSb\r
@@ -272,9 +270,7 @@ DhcpSetTransmitTimer (
 \r
   DhcpSb->PacketToLive = Times[DhcpSb->CurRetry];\r
 \r
-  if (DhcpSb->DhcpState == Dhcp4Selecting) {\r
-    DhcpSb->WaitOffer = DhcpSb->PacketToLive;\r
-  }\r
+  return;\r
 }\r
 \r
 /**\r
@@ -289,7 +285,6 @@ DhcpSetTransmitTimer (
   @return None\r
 \r
 **/\r
-STATIC\r
 VOID\r
 DhcpComputeLease (\r
   IN DHCP_SERVICE           *DhcpSb,\r
@@ -398,7 +393,6 @@ DhcpConfigLeaseIoPort (
   @retval EFI_SUCCESS           The lease is recorded.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 DhcpLeaseAcquired (\r
   IN DHCP_SERVICE           *DhcpSb\r
@@ -497,7 +491,6 @@ DhcpCleanLease (
   DhcpSb->PacketToLive  = 0;\r
   DhcpSb->CurRetry      = 0;\r
   DhcpSb->MaxRetries    = 0;\r
-  DhcpSb->WaitOffer     = 0;\r
   DhcpSb->LeaseLife     = 0;\r
 }\r
 \r
@@ -512,7 +505,6 @@ DhcpCleanLease (
   @retval EFI_SUCCESS           One of the offer is selected.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 DhcpChooseOffer (\r
   IN DHCP_SERVICE           *DhcpSb\r
@@ -525,11 +517,6 @@ DhcpChooseOffer (
 \r
   ASSERT (DhcpSb->LastOffer != NULL);\r
 \r
-  //\r
-  // Stop waiting more offers\r
-  //\r
-  DhcpSb->WaitOffer = 0;\r
-\r
   //\r
   // User will cache previous offers if he wants to select\r
   // from multiple offers. If user provides an invalid packet,\r
@@ -599,7 +586,6 @@ DhcpChooseOffer (
   @return None\r
 \r
 **/\r
-STATIC\r
 VOID\r
 DhcpEndSession (\r
   IN DHCP_SERVICE           *DhcpSb,\r
@@ -631,7 +617,6 @@ DhcpEndSession (
   @retval Others                Some error occured.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 DhcpHandleSelect (\r
   IN DHCP_SERVICE           *DhcpSb,\r
@@ -706,7 +691,6 @@ ON_EXIT:
   @retval Others                Some error occured.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 DhcpHandleRequest (\r
   IN DHCP_SERVICE           *DhcpSb,\r
@@ -799,7 +783,6 @@ ON_EXIT:
   @retval Others                Some error occured.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 DhcpHandleRenewRebind (\r
   IN DHCP_SERVICE           *DhcpSb,\r
@@ -858,7 +841,7 @@ DhcpHandleRenewRebind (
   DhcpSb->LeaseLife = 0;\r
   DhcpSetState (DhcpSb, Dhcp4Bound, TRUE);\r
 \r
-  if (DhcpSb->ExtraRefresh) {\r
+  if (DhcpSb->ExtraRefresh != 0) {\r
     DhcpSb->ExtraRefresh  = FALSE;\r
 \r
     DhcpSb->IoStatus      = EFI_SUCCESS;\r
@@ -883,7 +866,6 @@ ON_EXIT:
   @retval Others                Some error occured.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 DhcpHandleReboot (\r
   IN DHCP_SERVICE           *DhcpSb,\r
@@ -1501,30 +1483,27 @@ DhcpOnTimerTick (
 \r
   DhcpSb   = (DHCP_SERVICE *) Context;\r
   Instance = DhcpSb->ActiveChild;\r
-\r
+  \r
   //\r
-  // Check the time to wait offer\r
+  // Check the retransmit timer\r
   //\r
-  if ((DhcpSb->WaitOffer > 0) && (--DhcpSb->WaitOffer == 0)) {\r
+  if ((DhcpSb->PacketToLive > 0) && (--DhcpSb->PacketToLive == 0)) {\r
+\r
     //\r
-    // OK, offer collection finished, select a offer\r
+    // Select offer at each timeout if any offer received.\r
     //\r
-    ASSERT (DhcpSb->DhcpState == Dhcp4Selecting);\r
+    if (DhcpSb->DhcpState == Dhcp4Selecting && DhcpSb->LastOffer != NULL) {\r
 \r
-    if (DhcpSb->LastOffer == NULL) {\r
-      goto END_SESSION;\r
-    }\r
+      Status = DhcpChooseOffer (DhcpSb);\r
 \r
-    if (EFI_ERROR (DhcpChooseOffer (DhcpSb))) {\r
-      goto END_SESSION;\r
+      if (EFI_ERROR(Status)) {\r
+        FreePool (DhcpSb->LastOffer);\r
+        DhcpSb->LastOffer = NULL;\r
+      } else {\r
+        goto ON_EXIT;\r
+      }\r
     }\r
-  }\r
-\r
-  //\r
-  // Check the retransmit timer\r
-  //\r
-  if ((DhcpSb->PacketToLive > 0) && (--DhcpSb->PacketToLive == 0)) {\r
-\r
+    \r
     if (++DhcpSb->CurRetry < DhcpSb->MaxRetries) {\r
       //\r
       // Still has another try\r
@@ -1532,17 +1511,14 @@ DhcpOnTimerTick (
       DhcpRetransmit (DhcpSb);\r
       DhcpSetTransmitTimer (DhcpSb);\r
 \r
-    } else {\r
-      if (!DHCP_CONNECTED (DhcpSb->DhcpState)) {\r
-        goto END_SESSION;\r
-      }\r
+    } else if (DHCP_CONNECTED (DhcpSb->DhcpState)) {\r
 \r
       //\r
       // Retransmission failed, if the DHCP request is initiated by\r
       // user, adjust the current state according to the lease life.\r
       // Otherwise do nothing to wait the lease to timeout\r
       //\r
-      if (DhcpSb->ExtraRefresh) {\r
+      if (DhcpSb->ExtraRefresh != 0) {\r
         Status = EFI_SUCCESS;\r
 \r
         if (DhcpSb->LeaseLife < DhcpSb->T1) {\r
@@ -1562,9 +1538,11 @@ DhcpOnTimerTick (
         DhcpSb->IoStatus = EFI_TIMEOUT;\r
         DhcpNotifyUser (DhcpSb, DHCP_NOTIFY_RENEWREBIND);\r
       }\r
+    } else {\r
+      goto END_SESSION;\r
     }\r
   }\r
-\r
+  \r
   //\r
   // If an address has been acquired, check whether need to\r
   // refresh or whether it has expired.\r
@@ -1576,7 +1554,7 @@ DhcpOnTimerTick (
     // Don't timeout the lease, only count the life if user is\r
     // requesting extra renew/rebind. Adjust the state after that.\r
     //\r
-    if (DhcpSb->ExtraRefresh) {\r
+    if (DhcpSb->ExtraRefresh != 0) {\r
       return ;\r
     }\r
 \r
@@ -1628,9 +1606,7 @@ DhcpOnTimerTick (
     }\r
   }\r
 \r
-  //\r
-  //\r
-  //\r
+ON_EXIT:\r
   if ((Instance != NULL) && (Instance->Token != NULL)) {\r
     Instance->Timeout--;\r
     if (Instance->Timeout == 0) {\r