]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c
Scrubbed part of the code.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Dhcp4Dxe / Dhcp4Io.c
index 415ffa8ab7838e9d6dd9270878060e7c38f68fca..da42e670b5ce381f4770df7febe2c722a2a064e6 100644 (file)
@@ -33,6 +33,7 @@ UINT32  mDhcp4DefaultTimeout[4] = { 4, 8, 16, 32 };
   @param  DhcpSb                The DHCP service instance\r
 \r
   @retval EFI_SUCCESS           The request has been sent\r
+  @retval other                 Some error occurs when sending the request.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -82,7 +83,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
@@ -141,7 +141,7 @@ DhcpCallUser (
   Notify the user about the operation result.\r
 \r
   @param  DhcpSb                DHCP service instance\r
-  @param  Which                 which notify function to signal\r
+  @param  Which                 Which notify function to signal\r
 \r
   @return None\r
 \r
@@ -159,14 +159,16 @@ DhcpNotifyUser (
   }\r
 \r
   if ((Child->CompletionEvent != NULL) &&\r
-     ((Which == DHCP_NOTIFY_COMPLETION) || (Which == DHCP_NOTIFY_ALL))) {\r
+      ((Which == DHCP_NOTIFY_COMPLETION) || (Which == DHCP_NOTIFY_ALL))\r
+      ) {\r
 \r
     gBS->SignalEvent (Child->CompletionEvent);\r
     Child->CompletionEvent = NULL;\r
   }\r
 \r
   if ((Child->RenewRebindEvent != NULL) &&\r
-     ((Which == DHCP_NOTIFY_RENEWREBIND) || (Which == DHCP_NOTIFY_ALL))) {\r
+      ((Which == DHCP_NOTIFY_RENEWREBIND) || (Which == DHCP_NOTIFY_ALL))\r
+      ) {\r
 \r
     gBS->SignalEvent (Child->RenewRebindEvent);\r
     Child->RenewRebindEvent = NULL;\r
@@ -192,9 +194,9 @@ DhcpNotifyUser (
 **/\r
 EFI_STATUS\r
 DhcpSetState (\r
-  IN DHCP_SERVICE           *DhcpSb,\r
-  IN INTN                   State,\r
-  IN BOOLEAN                CallUser\r
+  IN OUT DHCP_SERVICE           *DhcpSb,\r
+  IN     INTN                   State,\r
+  IN     BOOLEAN                CallUser\r
   )\r
 {\r
   EFI_STATUS                Status;\r
@@ -250,10 +252,9 @@ DhcpSetState (
   @return None\r
 \r
 **/\r
-STATIC\r
 VOID\r
 DhcpSetTransmitTimer (\r
-  IN DHCP_SERVICE           *DhcpSb\r
+  IN OUT DHCP_SERVICE           *DhcpSb\r
   )\r
 {\r
   UINT32                    *Times;\r
@@ -287,11 +288,10 @@ DhcpSetTransmitTimer (
   @return None\r
 \r
 **/\r
-STATIC\r
 VOID\r
 DhcpComputeLease (\r
-  IN DHCP_SERVICE           *DhcpSb,\r
-  IN DHCP_PARAMETER         *Para\r
+  IN OUT DHCP_SERVICE           *DhcpSb,\r
+  IN     DHCP_PARAMETER         *Para\r
   )\r
 {\r
   ASSERT (Para != NULL);\r
@@ -320,7 +320,7 @@ DhcpComputeLease (
   such as DHCP release.\r
 \r
   @param  UdpIo                 The UDP IO port to configure\r
-  @param  Context               The opaque parameter to the function.\r
+  @param  Context               Dhcp service instance.\r
 \r
   @retval EFI_SUCCESS           The UDP IO port is successfully configured.\r
   @retval Others                It failed to configure the port.\r
@@ -396,10 +396,9 @@ DhcpConfigLeaseIoPort (
   @retval EFI_SUCCESS           The lease is recorded.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 DhcpLeaseAcquired (\r
-  IN DHCP_SERVICE           *DhcpSb\r
+  IN OUT DHCP_SERVICE           *DhcpSb\r
   )\r
 {\r
   INTN                      Class;\r
@@ -413,7 +412,7 @@ DhcpLeaseAcquired (
 \r
   if (DhcpSb->Netmask == 0) {\r
     Class           = NetGetIpClass (DhcpSb->ClientAddr);\r
-    DhcpSb->Netmask = mIp4AllMasks[Class << 3];\r
+    DhcpSb->Netmask = gIp4AllMasks[Class << 3];\r
   }\r
 \r
   if (DhcpSb->LeaseIoPort != NULL) {\r
@@ -509,7 +508,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
@@ -591,7 +589,6 @@ DhcpChooseOffer (
   @return None\r
 \r
 **/\r
-STATIC\r
 VOID\r
 DhcpEndSession (\r
   IN DHCP_SERVICE           *DhcpSb,\r
@@ -623,7 +620,6 @@ DhcpEndSession (
   @retval Others                Some error occured.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 DhcpHandleSelect (\r
   IN DHCP_SERVICE           *DhcpSb,\r
@@ -642,7 +638,8 @@ DhcpHandleSelect (
   // Don't return a error for these two case otherwise the session is ended.\r
   //\r
   if (!DHCP_IS_BOOTP (Para) &&\r
-     ((Para->DhcpType != DHCP_MSG_OFFER) || (Para->ServerId == 0))) {\r
+      ((Para->DhcpType != DHCP_MSG_OFFER) || (Para->ServerId == 0))\r
+      ) {\r
     goto ON_EXIT;\r
   }\r
 \r
@@ -698,7 +695,6 @@ ON_EXIT:
   @retval Others                Some error occured.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 DhcpHandleRequest (\r
   IN DHCP_SERVICE           *DhcpSb,\r
@@ -720,8 +716,9 @@ DhcpHandleRequest (
   // Ignore the BOOTP message and DHCP messages other than DHCP ACK/NACK.\r
   //\r
   if (DHCP_IS_BOOTP (Para) ||\r
-     (Para->ServerId != DhcpSb->Para->ServerId) ||\r
-     ((Para->DhcpType != DHCP_MSG_ACK) && (Para->DhcpType != DHCP_MSG_NAK))) {\r
+      (Para->ServerId != DhcpSb->Para->ServerId) ||\r
+      ((Para->DhcpType != DHCP_MSG_ACK) && (Para->DhcpType != DHCP_MSG_NAK))\r
+      ) {\r
 \r
     Status = EFI_SUCCESS;\r
     goto ON_EXIT;\r
@@ -791,7 +788,6 @@ ON_EXIT:
   @retval Others                Some error occured.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 DhcpHandleRenewRebind (\r
   IN DHCP_SERVICE           *DhcpSb,\r
@@ -812,8 +808,9 @@ DhcpHandleRenewRebind (
   // Ignore the BOOTP message and DHCP messages other than DHCP ACK/NACK\r
   //\r
   if (DHCP_IS_BOOTP (Para) ||\r
-     (Para->ServerId != DhcpSb->Para->ServerId) ||\r
-     ((Para->DhcpType != DHCP_MSG_ACK) && (Para->DhcpType != DHCP_MSG_NAK))) {\r
+      (Para->ServerId != DhcpSb->Para->ServerId) ||\r
+      ((Para->DhcpType != DHCP_MSG_ACK) && (Para->DhcpType != DHCP_MSG_NAK))\r
+      ) {\r
 \r
     Status = EFI_SUCCESS;\r
     goto ON_EXIT;\r
@@ -850,7 +847,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
@@ -875,7 +872,6 @@ ON_EXIT:
   @retval Others                Some error occured.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 DhcpHandleReboot (\r
   IN DHCP_SERVICE           *DhcpSb,\r
@@ -892,7 +888,8 @@ DhcpHandleReboot (
   // Ignore the BOOTP message and DHCP messages other than DHCP ACK/NACK\r
   //\r
   if (DHCP_IS_BOOTP (Para) ||\r
-     ((Para->DhcpType != DHCP_MSG_ACK) && (Para->DhcpType != DHCP_MSG_NAK))) {\r
+      ((Para->DhcpType != DHCP_MSG_ACK) && (Para->DhcpType != DHCP_MSG_NAK))\r
+      ) {\r
 \r
     Status = EFI_SUCCESS;\r
     goto ON_EXIT;\r
@@ -954,7 +951,7 @@ ON_EXIT:
 \r
 \r
 /**\r
-  Handle the received DHCP packets. This function drivers the DHCP\r
+  Handle the received DHCP packets. This function drives the DHCP\r
   state machine.\r
 \r
   @param  UdpPacket             The UDP packets received.\r
@@ -1168,6 +1165,7 @@ DhcpOnPacketSent (
   @retval EFI_OUT_OF_RESOURCES  Failed to allocate resources for the packet\r
   @retval EFI_ACCESS_DENIED     Failed to transmit the packet through UDP\r
   @retval EFI_SUCCESS           The message is sent\r
+  @retval other                 Other error occurs\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1249,7 +1247,8 @@ DhcpSendMessage (
   //   3. DHCP request to confirm one lease.\r
   //\r
   if ((Type == DHCP_MSG_DECLINE) || (Type == DHCP_MSG_RELEASE) ||\r
-      ((Type == DHCP_MSG_REQUEST) && (DhcpSb->DhcpState == Dhcp4Requesting))) {\r
+      ((Type == DHCP_MSG_REQUEST) && (DhcpSb->DhcpState == Dhcp4Requesting))\r
+      ) {\r
 \r
     ASSERT ((Para != NULL) && (Para->ServerId != 0));\r
 \r
@@ -1356,7 +1355,11 @@ DhcpSendMessage (
   //\r
   // Save the Client Address will be sent out\r
   //\r
-  CopyMem (&DhcpSb->ClientAddressSendOut[0], &Packet->Dhcp4.Header.ClientHwAddr[0], Packet->Dhcp4.Header.HwAddrLen);\r
+  CopyMem (\r
+    &DhcpSb->ClientAddressSendOut[0],\r
+    &Packet->Dhcp4.Header.ClientHwAddr[0],\r
+    Packet->Dhcp4.Header.HwAddrLen\r
+    );\r
 \r
 \r
   //\r
@@ -1528,7 +1531,7 @@ DhcpOnTimerTick (
       // 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
@@ -1564,7 +1567,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