]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c
NetworkPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / NetworkPkg / Dhcp6Dxe / Dhcp6Utility.c
index a65ed6d5892b59c861ab6181e632b67a37a6413d..a8a938211572d49048557487e470317ea4391668 100644 (file)
@@ -2,15 +2,9 @@
   Dhcp6 support functions implementation.\r
 \r
   (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>\r
-  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
 \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
-\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
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -68,7 +62,7 @@ Dhcp6GenerateClientId (
     //\r
     //\r
     //  The format of DUID-UUID:\r
-    //   \r
+    //\r
     //    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1\r
     //   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
     //   |          DUID-Type (4)        |    UUID (128 bits)            |\r
@@ -91,16 +85,16 @@ Dhcp6GenerateClientId (
     // sizeof (Duid-type + UUID-size) = 18 bytes\r
     //\r
     Duid->Length = (UINT16) (18);\r
-  \r
+\r
     //\r
     // Set the Duid-type and copy UUID.\r
     //\r
     WriteUnaligned16 ((UINT16 *) (Duid->Duid), HTONS (Dhcp6DuidTypeUuid));\r
-  \r
+\r
     CopyMem (Duid->Duid + 2, &Uuid, sizeof(EFI_GUID));\r
 \r
   } else {\r
-      \r
+\r
     //\r
     //\r
     //  The format of DUID-LLT:\r
@@ -123,7 +117,7 @@ Dhcp6GenerateClientId (
     gRT->GetTime (&Time, NULL);\r
     Stamp = (UINT32)\r
       (\r
-        (((((Time.Year - 2000) * 360 + (Time.Month - 1)) * 30 + (Time.Day - 1)) * 24 + Time.Hour) * 60 + Time.Minute) *\r
+        ((((UINT32)(Time.Year - 2000) * 360 + (Time.Month - 1) * 30 + (Time.Day - 1)) * 24 + Time.Hour) * 60 + Time.Minute) *\r
         60 +\r
         Time.Second\r
       );\r
@@ -135,12 +129,12 @@ Dhcp6GenerateClientId (
     if (Duid == NULL) {\r
       return NULL;\r
     }\r
-  \r
+\r
     //\r
     // sizeof (Duid-type + hardware-type + time) = 8 bytes\r
     //\r
     Duid->Length = (UINT16) (Mode->HwAddressSize + 8);\r
-  \r
+\r
     //\r
     // Set the Duid-type, hardware-type, time and copy the hardware address.\r
     //\r
@@ -687,7 +681,7 @@ Dhcp6AppendIaAddrOption (
   //      .                        IAaddr-options                         .\r
   //      .                                                               .\r
   //      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
-  \r
+\r
   //\r
   // Fill the value of Ia Address option type\r
   //\r
@@ -881,14 +875,14 @@ SetElapsedTime (
   // Generate a time stamp of the centiseconds from 2000/1/1, assume 30day/month.\r
   //\r
   gRT->GetTime (&Time, NULL);\r
-  CurrentStamp = (UINT64)\r
-    (\r
-      ((((((Time.Year - 2000) * 360 +\r
-       (Time.Month - 1)) * 30 +\r
-       (Time.Day - 1)) * 24 + Time.Hour) * 60 +\r
-       Time.Minute) * 60 + Time.Second) * 100\r
-       + DivU64x32(Time.Nanosecond, 10000000)\r
-    );\r
+  CurrentStamp = MultU64x32 (\r
+                   ((((UINT32)(Time.Year - 2000) * 360 + (Time.Month - 1) * 30 + (Time.Day - 1)) * 24 + Time.Hour) * 60 + Time.Minute) * 60 + Time.Second,\r
+                   100\r
+                   ) +\r
+                 DivU64x32(\r
+                   Time.Nanosecond,\r
+                   10000000\r
+                   );\r
 \r
   //\r
   // Sentinel value of 0 means that this is the first DHCP packet that we are\r
@@ -1000,7 +994,7 @@ Dhcp6SeekIaOption (
 }\r
 \r
 /**\r
-  Check whether the incoming IPv6 address in IaAddr is one of the maintained \r
+  Check whether the incoming IPv6 address in IaAddr is one of the maintained\r
   addresses in the IA control blcok.\r
 \r
   @param[in]  IaAddr            The pointer to the IA Address to be checked.\r
@@ -1019,7 +1013,7 @@ Dhcp6AddrIsInCurrentIa (
   UINT32    Index;\r
 \r
   ASSERT (IaAddr != NULL && CurrentIa != NULL);\r
-  \r
+\r
   for (Index = 0; Index < CurrentIa->IaAddressCount; Index++) {\r
     if (EFI_IP6_EQUAL(&IaAddr->IpAddress, &CurrentIa->IaAddress[Index].IpAddress)) {\r
       return TRUE;\r
@@ -1303,7 +1297,7 @@ EFI_STATUS
 Dhcp6GetMappingTimeOut (\r
   IN  EFI_IP6_CONFIG_PROTOCOL       *Ip6Cfg,\r
   OUT UINTN                         *TimeOut\r
-  ) \r
+  )\r
 {\r
   EFI_STATUS            Status;\r
   UINTN                 DataSize;\r
@@ -1323,8 +1317,8 @@ Dhcp6GetMappingTimeOut (
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
-  \r
+\r
   *TimeOut = TICKS_PER_SECOND * DadXmits.DupAddrDetectTransmits + DHCP6_DAD_ADDITIONAL_DELAY;\r
-  \r
+\r
   return EFI_SUCCESS;\r
 }\r