]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Misc.c
1. Mark the network volatile variables as deprecated in code comments and remove...
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Tcp4Dxe / Tcp4Misc.c
index bf04b5a55b110bc8d80ab3439241c1c9c09d8153..5b18d20497d782b75152dc5e465336320ce42585 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Misc support routines for tcp.\r
 \r
-Copyright (c) 2005 - 2011, 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
@@ -392,7 +392,6 @@ TcpInsertTcb (
   InsertHeadList (Head, &Tcb->List);\r
 \r
   TcpProto = (TCP4_PROTO_DATA *) Tcb->Sk->ProtoReserved;\r
-  TcpSetVariableData (TcpProto->TcpService);\r
 \r
   return 0;\r
 }\r
@@ -878,205 +877,6 @@ TcpOnAppAbort (
   TcpSetState (Tcb, TCP_CLOSED);\r
 }\r
 \r
-\r
-/**\r
-  Set the Tdp4 variable data.\r
-\r
-  @param  Tcp4Service           Pointer to Tcp4 service data.\r
-\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
-TcpSetVariableData (\r
-  IN TCP4_SERVICE_DATA  *Tcp4Service\r
-  )\r
-{\r
-  UINT32                  NumConfiguredInstance;\r
-  LIST_ENTRY              *Entry;\r
-  TCP_CB                  *TcpPcb;\r
-  TCP4_PROTO_DATA         *TcpProto;\r
-  UINTN                   VariableDataSize;\r
-  EFI_TCP4_VARIABLE_DATA  *Tcp4VariableData;\r
-  EFI_TCP4_SERVICE_POINT  *Tcp4ServicePoint;\r
-  CHAR16                  *NewMacString;\r
-  EFI_STATUS              Status;\r
-\r
-  NumConfiguredInstance = 0;\r
-\r
-  //\r
-  // Go through the running queue to count the instances.\r
-  //\r
-  NET_LIST_FOR_EACH (Entry, &mTcpRunQue) {\r
-    TcpPcb = NET_LIST_USER_STRUCT (Entry, TCP_CB, List);\r
-\r
-    TcpProto = (TCP4_PROTO_DATA *) TcpPcb->Sk->ProtoReserved;\r
-\r
-    if (TcpProto->TcpService == Tcp4Service) {\r
-      //\r
-      // This tcp instance belongs to the Tcp4Service.\r
-      //\r
-      NumConfiguredInstance++;\r
-    }\r
-  }\r
-\r
-  //\r
-  // Go through the listening queue to count the instances.\r
-  //\r
-  NET_LIST_FOR_EACH (Entry, &mTcpListenQue) {\r
-    TcpPcb = NET_LIST_USER_STRUCT (Entry, TCP_CB, List);\r
-\r
-    TcpProto = (TCP4_PROTO_DATA *) TcpPcb->Sk->ProtoReserved;\r
-\r
-    if (TcpProto->TcpService == Tcp4Service) {\r
-      //\r
-      // This tcp instance belongs to the Tcp4Service.\r
-      //\r
-      NumConfiguredInstance++;\r
-    }\r
-  }\r
-\r
-  //\r
-  // Calculate the size of the Tcp4VariableData. As there may be no Tcp4 child,\r
-  // we should add extra buffer for the service points only if the number of configured\r
-  // children is more than 1.\r
-  //\r
-  VariableDataSize = sizeof (EFI_TCP4_VARIABLE_DATA);\r
-\r
-  if (NumConfiguredInstance > 1) {\r
-    VariableDataSize += sizeof (EFI_TCP4_SERVICE_POINT) * (NumConfiguredInstance - 1);\r
-  }\r
-\r
-  Tcp4VariableData = AllocatePool (VariableDataSize);\r
-  if (Tcp4VariableData == NULL) {\r
-    return EFI_OUT_OF_RESOURCES;\r
-  }\r
-\r
-  Tcp4VariableData->DriverHandle = Tcp4Service->DriverBindingHandle;\r
-  Tcp4VariableData->ServiceCount = NumConfiguredInstance;\r
-\r
-  Tcp4ServicePoint = &Tcp4VariableData->Services[0];\r
-\r
-  //\r
-  // Go through the running queue to fill the service points.\r
-  //\r
-  NET_LIST_FOR_EACH (Entry, &mTcpRunQue) {\r
-    TcpPcb = NET_LIST_USER_STRUCT (Entry, TCP_CB, List);\r
-\r
-    TcpProto = (TCP4_PROTO_DATA *) TcpPcb->Sk->ProtoReserved;\r
-\r
-    if (TcpProto->TcpService == Tcp4Service) {\r
-      //\r
-      // This tcp instance belongs to the Tcp4Service.\r
-      //\r
-      Tcp4ServicePoint->InstanceHandle          = TcpPcb->Sk->SockHandle;\r
-      CopyMem (&Tcp4ServicePoint->LocalAddress, &TcpPcb->LocalEnd.Ip, sizeof (EFI_IPv4_ADDRESS));\r
-      Tcp4ServicePoint->LocalPort               = NTOHS (TcpPcb->LocalEnd.Port);\r
-      CopyMem (&Tcp4ServicePoint->RemoteAddress, &TcpPcb->RemoteEnd.Ip, sizeof (EFI_IPv4_ADDRESS));\r
-      Tcp4ServicePoint->RemotePort              = NTOHS (TcpPcb->RemoteEnd.Port);\r
-\r
-      Tcp4ServicePoint++;\r
-    }\r
-  }\r
-\r
-  //\r
-  // Go through the listening queue to fill the service points.\r
-  //\r
-  NET_LIST_FOR_EACH (Entry, &mTcpListenQue) {\r
-    TcpPcb = NET_LIST_USER_STRUCT (Entry, TCP_CB, List);\r
-\r
-    TcpProto = (TCP4_PROTO_DATA *) TcpPcb->Sk->ProtoReserved;\r
-\r
-    if (TcpProto->TcpService == Tcp4Service) {\r
-      //\r
-      // This tcp instance belongs to the Tcp4Service.\r
-      //\r
-      Tcp4ServicePoint->InstanceHandle          = TcpPcb->Sk->SockHandle;\r
-      CopyMem (&Tcp4ServicePoint->LocalAddress, &TcpPcb->LocalEnd.Ip, sizeof (EFI_IPv4_ADDRESS));\r
-      Tcp4ServicePoint->LocalPort               = NTOHS (TcpPcb->LocalEnd.Port);\r
-      CopyMem (&Tcp4ServicePoint->RemoteAddress, &TcpPcb->RemoteEnd.Ip, sizeof (EFI_IPv4_ADDRESS));\r
-      Tcp4ServicePoint->RemotePort              = NTOHS (TcpPcb->RemoteEnd.Port);\r
-\r
-      Tcp4ServicePoint++;\r
-    }\r
-  }\r
-\r
-  //\r
-  // Get the mac string.\r
-  //\r
-  Status = NetLibGetMacString (\r
-             Tcp4Service->ControllerHandle,\r
-             Tcp4Service->DriverBindingHandle,\r
-             &NewMacString\r
-             );\r
-  if (EFI_ERROR (Status)) {\r
-    goto ON_ERROR;\r
-  }\r
-\r
-  if (Tcp4Service->MacString != NULL) {\r
-    //\r
-    // The variable is set already, we're going to update it.\r
-    //\r
-    if (StrCmp (Tcp4Service->MacString, NewMacString) != 0) {\r
-      //\r
-      // The mac address is changed, delete the previous variable first.\r
-      //\r
-      gRT->SetVariable (\r
-             Tcp4Service->MacString,\r
-             &gEfiTcp4ServiceBindingProtocolGuid,\r
-             EFI_VARIABLE_BOOTSERVICE_ACCESS,\r
-             0,\r
-             NULL\r
-             );\r
-    }\r
-\r
-    FreePool (Tcp4Service->MacString);\r
-  }\r
-\r
-  Tcp4Service->MacString = NewMacString;\r
-\r
-  Status = gRT->SetVariable (\r
-                  Tcp4Service->MacString,\r
-                  &gEfiTcp4ServiceBindingProtocolGuid,\r
-                  EFI_VARIABLE_BOOTSERVICE_ACCESS,\r
-                  VariableDataSize,\r
-                  (VOID *) Tcp4VariableData\r
-                  );\r
-\r
-ON_ERROR:\r
-\r
-  FreePool (Tcp4VariableData);\r
-\r
-  return Status;\r
-}\r
-\r
-\r
-/**\r
-  Clear the variable and free the resource.\r
-\r
-  @param  Tcp4Service           Pointer to Tcp4 service data.\r
-\r
-**/\r
-VOID\r
-TcpClearVariableData (\r
-  IN TCP4_SERVICE_DATA  *Tcp4Service\r
-  )\r
-{\r
-  ASSERT (Tcp4Service->MacString != NULL);\r
-\r
-  gRT->SetVariable (\r
-         Tcp4Service->MacString,\r
-         &gEfiTcp4ServiceBindingProtocolGuid,\r
-         EFI_VARIABLE_BOOTSERVICE_ACCESS,\r
-         0,\r
-         NULL\r
-         );\r
-\r
-  FreePool (Tcp4Service->MacString);\r
-  Tcp4Service->MacString = NULL;\r
-}\r
-\r
 /**\r
   Install the device path protocol on the TCP instance.\r
 \r