summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Misc.c')
-rw-r--r--MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Misc.c202
1 files changed, 1 insertions, 201 deletions
diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Misc.c b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Misc.c
index bf04b5a55b..5b18d20497 100644
--- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Misc.c
+++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Misc.c
@@ -1,7 +1,7 @@
/** @file
Misc support routines for tcp.
-Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -392,7 +392,6 @@ TcpInsertTcb (
InsertHeadList (Head, &Tcb->List);
TcpProto = (TCP4_PROTO_DATA *) Tcb->Sk->ProtoReserved;
- TcpSetVariableData (TcpProto->TcpService);
return 0;
}
@@ -878,205 +877,6 @@ TcpOnAppAbort (
TcpSetState (Tcb, TCP_CLOSED);
}
-
-/**
- Set the Tdp4 variable data.
-
- @param Tcp4Service Pointer to Tcp4 service data.
-
- @retval EFI_OUT_OF_RESOURCES There are not enough resources to set the variable.
- @retval other Set variable failed.
-
-**/
-EFI_STATUS
-TcpSetVariableData (
- IN TCP4_SERVICE_DATA *Tcp4Service
- )
-{
- UINT32 NumConfiguredInstance;
- LIST_ENTRY *Entry;
- TCP_CB *TcpPcb;
- TCP4_PROTO_DATA *TcpProto;
- UINTN VariableDataSize;
- EFI_TCP4_VARIABLE_DATA *Tcp4VariableData;
- EFI_TCP4_SERVICE_POINT *Tcp4ServicePoint;
- CHAR16 *NewMacString;
- EFI_STATUS Status;
-
- NumConfiguredInstance = 0;
-
- //
- // Go through the running queue to count the instances.
- //
- NET_LIST_FOR_EACH (Entry, &mTcpRunQue) {
- TcpPcb = NET_LIST_USER_STRUCT (Entry, TCP_CB, List);
-
- TcpProto = (TCP4_PROTO_DATA *) TcpPcb->Sk->ProtoReserved;
-
- if (TcpProto->TcpService == Tcp4Service) {
- //
- // This tcp instance belongs to the Tcp4Service.
- //
- NumConfiguredInstance++;
- }
- }
-
- //
- // Go through the listening queue to count the instances.
- //
- NET_LIST_FOR_EACH (Entry, &mTcpListenQue) {
- TcpPcb = NET_LIST_USER_STRUCT (Entry, TCP_CB, List);
-
- TcpProto = (TCP4_PROTO_DATA *) TcpPcb->Sk->ProtoReserved;
-
- if (TcpProto->TcpService == Tcp4Service) {
- //
- // This tcp instance belongs to the Tcp4Service.
- //
- NumConfiguredInstance++;
- }
- }
-
- //
- // Calculate the size of the Tcp4VariableData. As there may be no Tcp4 child,
- // we should add extra buffer for the service points only if the number of configured
- // children is more than 1.
- //
- VariableDataSize = sizeof (EFI_TCP4_VARIABLE_DATA);
-
- if (NumConfiguredInstance > 1) {
- VariableDataSize += sizeof (EFI_TCP4_SERVICE_POINT) * (NumConfiguredInstance - 1);
- }
-
- Tcp4VariableData = AllocatePool (VariableDataSize);
- if (Tcp4VariableData == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Tcp4VariableData->DriverHandle = Tcp4Service->DriverBindingHandle;
- Tcp4VariableData->ServiceCount = NumConfiguredInstance;
-
- Tcp4ServicePoint = &Tcp4VariableData->Services[0];
-
- //
- // Go through the running queue to fill the service points.
- //
- NET_LIST_FOR_EACH (Entry, &mTcpRunQue) {
- TcpPcb = NET_LIST_USER_STRUCT (Entry, TCP_CB, List);
-
- TcpProto = (TCP4_PROTO_DATA *) TcpPcb->Sk->ProtoReserved;
-
- if (TcpProto->TcpService == Tcp4Service) {
- //
- // This tcp instance belongs to the Tcp4Service.
- //
- Tcp4ServicePoint->InstanceHandle = TcpPcb->Sk->SockHandle;
- CopyMem (&Tcp4ServicePoint->LocalAddress, &TcpPcb->LocalEnd.Ip, sizeof (EFI_IPv4_ADDRESS));
- Tcp4ServicePoint->LocalPort = NTOHS (TcpPcb->LocalEnd.Port);
- CopyMem (&Tcp4ServicePoint->RemoteAddress, &TcpPcb->RemoteEnd.Ip, sizeof (EFI_IPv4_ADDRESS));
- Tcp4ServicePoint->RemotePort = NTOHS (TcpPcb->RemoteEnd.Port);
-
- Tcp4ServicePoint++;
- }
- }
-
- //
- // Go through the listening queue to fill the service points.
- //
- NET_LIST_FOR_EACH (Entry, &mTcpListenQue) {
- TcpPcb = NET_LIST_USER_STRUCT (Entry, TCP_CB, List);
-
- TcpProto = (TCP4_PROTO_DATA *) TcpPcb->Sk->ProtoReserved;
-
- if (TcpProto->TcpService == Tcp4Service) {
- //
- // This tcp instance belongs to the Tcp4Service.
- //
- Tcp4ServicePoint->InstanceHandle = TcpPcb->Sk->SockHandle;
- CopyMem (&Tcp4ServicePoint->LocalAddress, &TcpPcb->LocalEnd.Ip, sizeof (EFI_IPv4_ADDRESS));
- Tcp4ServicePoint->LocalPort = NTOHS (TcpPcb->LocalEnd.Port);
- CopyMem (&Tcp4ServicePoint->RemoteAddress, &TcpPcb->RemoteEnd.Ip, sizeof (EFI_IPv4_ADDRESS));
- Tcp4ServicePoint->RemotePort = NTOHS (TcpPcb->RemoteEnd.Port);
-
- Tcp4ServicePoint++;
- }
- }
-
- //
- // Get the mac string.
- //
- Status = NetLibGetMacString (
- Tcp4Service->ControllerHandle,
- Tcp4Service->DriverBindingHandle,
- &NewMacString
- );
- if (EFI_ERROR (Status)) {
- goto ON_ERROR;
- }
-
- if (Tcp4Service->MacString != NULL) {
- //
- // The variable is set already, we're going to update it.
- //
- if (StrCmp (Tcp4Service->MacString, NewMacString) != 0) {
- //
- // The mac address is changed, delete the previous variable first.
- //
- gRT->SetVariable (
- Tcp4Service->MacString,
- &gEfiTcp4ServiceBindingProtocolGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS,
- 0,
- NULL
- );
- }
-
- FreePool (Tcp4Service->MacString);
- }
-
- Tcp4Service->MacString = NewMacString;
-
- Status = gRT->SetVariable (
- Tcp4Service->MacString,
- &gEfiTcp4ServiceBindingProtocolGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS,
- VariableDataSize,
- (VOID *) Tcp4VariableData
- );
-
-ON_ERROR:
-
- FreePool (Tcp4VariableData);
-
- return Status;
-}
-
-
-/**
- Clear the variable and free the resource.
-
- @param Tcp4Service Pointer to Tcp4 service data.
-
-**/
-VOID
-TcpClearVariableData (
- IN TCP4_SERVICE_DATA *Tcp4Service
- )
-{
- ASSERT (Tcp4Service->MacString != NULL);
-
- gRT->SetVariable (
- Tcp4Service->MacString,
- &gEfiTcp4ServiceBindingProtocolGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS,
- 0,
- NULL
- );
-
- FreePool (Tcp4Service->MacString);
- Tcp4Service->MacString = NULL;
-}
-
/**
Install the device path protocol on the TCP instance.