]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Common.c
1. Mark the network volatile variables as deprecated in code comments and remove...
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Ip4Dxe / Ip4Common.c
index 16b88aeb85823f65d98bf911e8f300c1b12f47fa..004a8bc7034d0488d5ab5d43e7bfe8796ca1f303 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-Copyright (c) 2005 - 2009, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2005 - 2014, 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
@@ -267,151 +267,3 @@ Ip4NtohHead (
 \r
   return Head;\r
 }\r
-\r
-\r
-/**\r
-  Set the Ip4 variable data.\r
-  \r
-  Save the list of all of the IPv4 addresses and subnet masks that are currently\r
-  being used to volatile variable storage.\r
-\r
-  @param[in]  IpSb                  Ip4 service binding instance\r
-\r
-  @retval EFI_SUCCESS           Successfully set variable.\r
-  @retval EFI_OUT_OF_RESOURCES  There are not enough resources to set the variable.\r
-  @retval other                 Set variable failed.\r
-\r
-**/\r
-EFI_STATUS\r
-Ip4SetVariableData (\r
-  IN IP4_SERVICE  *IpSb\r
-  )\r
-{\r
-  UINT32                 NumConfiguredInstance;\r
-  LIST_ENTRY             *Entry;\r
-  UINTN                  VariableDataSize;\r
-  EFI_IP4_VARIABLE_DATA  *Ip4VariableData;\r
-  EFI_IP4_ADDRESS_PAIR   *Ip4AddressPair;\r
-  IP4_PROTOCOL           *IpInstance;\r
-  CHAR16                 *NewMacString;\r
-  EFI_STATUS             Status;\r
-\r
-  NumConfiguredInstance = 0;\r
-\r
-  //\r
-  // Go through the children list to count the configured children.\r
-  //\r
-  NET_LIST_FOR_EACH (Entry, &IpSb->Children) {\r
-    IpInstance = NET_LIST_USER_STRUCT_S (Entry, IP4_PROTOCOL, Link, IP4_PROTOCOL_SIGNATURE);\r
-\r
-    if (IpInstance->State == IP4_STATE_CONFIGED) {\r
-      NumConfiguredInstance++;\r
-    }\r
-  }\r
-\r
-  //\r
-  // Calculate the size of the Ip4VariableData. As there may be no IP child,\r
-  // we should add extra buffer for the address paris only if the number of configured\r
-  // children is more than 1.\r
-  //\r
-  VariableDataSize = sizeof (EFI_IP4_VARIABLE_DATA);\r
-\r
-  if (NumConfiguredInstance > 1) {\r
-    VariableDataSize += sizeof (EFI_IP4_ADDRESS_PAIR) * (NumConfiguredInstance - 1);\r
-  }\r
-\r
-  Ip4VariableData = AllocatePool (VariableDataSize);\r
-  if (Ip4VariableData == NULL) {\r
-    return EFI_OUT_OF_RESOURCES;\r
-  }\r
-\r
-  Ip4VariableData->DriverHandle = IpSb->Image;\r
-  Ip4VariableData->AddressCount = NumConfiguredInstance;\r
-\r
-  Ip4AddressPair = &Ip4VariableData->AddressPairs[0];\r
-\r
-  //\r
-  // Go through the children list to fill the configured children's address pairs.\r
-  //\r
-  NET_LIST_FOR_EACH (Entry, &IpSb->Children) {\r
-    IpInstance = NET_LIST_USER_STRUCT_S (Entry, IP4_PROTOCOL, Link, IP4_PROTOCOL_SIGNATURE);\r
-\r
-    if (IpInstance->State == IP4_STATE_CONFIGED) {\r
-      Ip4AddressPair->InstanceHandle       = IpInstance->Handle;\r
-      EFI_IP4 (Ip4AddressPair->Ip4Address) = NTOHL (IpInstance->Interface->Ip);\r
-      EFI_IP4 (Ip4AddressPair->SubnetMask) = NTOHL (IpInstance->Interface->SubnetMask);\r
-\r
-      Ip4AddressPair++;\r
-    }\r
-  }\r
-\r
-  //\r
-  // Get the mac string.\r
-  //\r
-  Status = NetLibGetMacString (IpSb->Controller, IpSb->Image, &NewMacString);\r
-  if (EFI_ERROR (Status)) {\r
-    goto ON_ERROR;\r
-  }\r
-\r
-  if (IpSb->MacString != NULL) {\r
-    //\r
-    // The variable is set already, we're going to update it.\r
-    //\r
-    if (StrCmp (IpSb->MacString, NewMacString) != 0) {\r
-      //\r
-      // The mac address is changed, delete the previous variable first.\r
-      //\r
-      gRT->SetVariable (\r
-             IpSb->MacString,\r
-             &gEfiIp4ServiceBindingProtocolGuid,\r
-             EFI_VARIABLE_BOOTSERVICE_ACCESS,\r
-             0,\r
-             NULL\r
-             );\r
-    }\r
-\r
-    FreePool (IpSb->MacString);\r
-  }\r
-\r
-  IpSb->MacString = NewMacString;\r
-\r
-  Status = gRT->SetVariable (\r
-                  IpSb->MacString,\r
-                  &gEfiIp4ServiceBindingProtocolGuid,\r
-                  EFI_VARIABLE_BOOTSERVICE_ACCESS,\r
-                  VariableDataSize,\r
-                  (VOID *) Ip4VariableData\r
-                  );\r
-\r
-ON_ERROR:\r
-\r
-  FreePool (Ip4VariableData);\r
-\r
-  return Status;\r
-}\r
-\r
-\r
-/**\r
-  Clear the variable and free the resource.\r
-\r
-  @param[in]  IpSb                  Ip4 service binding instance\r
-\r
-**/\r
-VOID\r
-Ip4ClearVariableData (\r
-  IN IP4_SERVICE  *IpSb\r
-  )\r
-{\r
-  ASSERT (IpSb->MacString != NULL);\r
-\r
-  gRT->SetVariable (\r
-         IpSb->MacString,\r
-         &gEfiIp4ServiceBindingProtocolGuid,\r
-         EFI_VARIABLE_BOOTSERVICE_ACCESS,\r
-         0,\r
-         NULL\r
-         );\r
-\r
-  FreePool (IpSb->MacString);\r
-  IpSb->MacString = NULL;\r
-}\r