mirror of https://github.com/acidanthera/audk.git
1. Mark the network volatile variables as deprecated in code comments and remove related code to set/get these variable.
2. Remove the GetTime() call when receiving Udp4/6 packets. Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Ye, Ting <ting.ye@intel.com> Reviewed-by: Wu, Jiaxin <jiaxin.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15497 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
5966402ed5
commit
d551cc64cd
|
@ -1,6 +1,6 @@
|
|||
/** @file
|
||||
|
||||
Copyright (c) 2005 - 2009, 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
|
||||
|
@ -267,151 +267,3 @@ Ip4NtohHead (
|
|||
|
||||
return Head;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Set the Ip4 variable data.
|
||||
|
||||
Save the list of all of the IPv4 addresses and subnet masks that are currently
|
||||
being used to volatile variable storage.
|
||||
|
||||
@param[in] IpSb Ip4 service binding instance
|
||||
|
||||
@retval EFI_SUCCESS Successfully set variable.
|
||||
@retval EFI_OUT_OF_RESOURCES There are not enough resources to set the variable.
|
||||
@retval other Set variable failed.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
Ip4SetVariableData (
|
||||
IN IP4_SERVICE *IpSb
|
||||
)
|
||||
{
|
||||
UINT32 NumConfiguredInstance;
|
||||
LIST_ENTRY *Entry;
|
||||
UINTN VariableDataSize;
|
||||
EFI_IP4_VARIABLE_DATA *Ip4VariableData;
|
||||
EFI_IP4_ADDRESS_PAIR *Ip4AddressPair;
|
||||
IP4_PROTOCOL *IpInstance;
|
||||
CHAR16 *NewMacString;
|
||||
EFI_STATUS Status;
|
||||
|
||||
NumConfiguredInstance = 0;
|
||||
|
||||
//
|
||||
// Go through the children list to count the configured children.
|
||||
//
|
||||
NET_LIST_FOR_EACH (Entry, &IpSb->Children) {
|
||||
IpInstance = NET_LIST_USER_STRUCT_S (Entry, IP4_PROTOCOL, Link, IP4_PROTOCOL_SIGNATURE);
|
||||
|
||||
if (IpInstance->State == IP4_STATE_CONFIGED) {
|
||||
NumConfiguredInstance++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Calculate the size of the Ip4VariableData. As there may be no IP child,
|
||||
// we should add extra buffer for the address paris only if the number of configured
|
||||
// children is more than 1.
|
||||
//
|
||||
VariableDataSize = sizeof (EFI_IP4_VARIABLE_DATA);
|
||||
|
||||
if (NumConfiguredInstance > 1) {
|
||||
VariableDataSize += sizeof (EFI_IP4_ADDRESS_PAIR) * (NumConfiguredInstance - 1);
|
||||
}
|
||||
|
||||
Ip4VariableData = AllocatePool (VariableDataSize);
|
||||
if (Ip4VariableData == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
Ip4VariableData->DriverHandle = IpSb->Image;
|
||||
Ip4VariableData->AddressCount = NumConfiguredInstance;
|
||||
|
||||
Ip4AddressPair = &Ip4VariableData->AddressPairs[0];
|
||||
|
||||
//
|
||||
// Go through the children list to fill the configured children's address pairs.
|
||||
//
|
||||
NET_LIST_FOR_EACH (Entry, &IpSb->Children) {
|
||||
IpInstance = NET_LIST_USER_STRUCT_S (Entry, IP4_PROTOCOL, Link, IP4_PROTOCOL_SIGNATURE);
|
||||
|
||||
if (IpInstance->State == IP4_STATE_CONFIGED) {
|
||||
Ip4AddressPair->InstanceHandle = IpInstance->Handle;
|
||||
EFI_IP4 (Ip4AddressPair->Ip4Address) = NTOHL (IpInstance->Interface->Ip);
|
||||
EFI_IP4 (Ip4AddressPair->SubnetMask) = NTOHL (IpInstance->Interface->SubnetMask);
|
||||
|
||||
Ip4AddressPair++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Get the mac string.
|
||||
//
|
||||
Status = NetLibGetMacString (IpSb->Controller, IpSb->Image, &NewMacString);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto ON_ERROR;
|
||||
}
|
||||
|
||||
if (IpSb->MacString != NULL) {
|
||||
//
|
||||
// The variable is set already, we're going to update it.
|
||||
//
|
||||
if (StrCmp (IpSb->MacString, NewMacString) != 0) {
|
||||
//
|
||||
// The mac address is changed, delete the previous variable first.
|
||||
//
|
||||
gRT->SetVariable (
|
||||
IpSb->MacString,
|
||||
&gEfiIp4ServiceBindingProtocolGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
0,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
FreePool (IpSb->MacString);
|
||||
}
|
||||
|
||||
IpSb->MacString = NewMacString;
|
||||
|
||||
Status = gRT->SetVariable (
|
||||
IpSb->MacString,
|
||||
&gEfiIp4ServiceBindingProtocolGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
VariableDataSize,
|
||||
(VOID *) Ip4VariableData
|
||||
);
|
||||
|
||||
ON_ERROR:
|
||||
|
||||
FreePool (Ip4VariableData);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Clear the variable and free the resource.
|
||||
|
||||
@param[in] IpSb Ip4 service binding instance
|
||||
|
||||
**/
|
||||
VOID
|
||||
Ip4ClearVariableData (
|
||||
IN IP4_SERVICE *IpSb
|
||||
)
|
||||
{
|
||||
ASSERT (IpSb->MacString != NULL);
|
||||
|
||||
gRT->SetVariable (
|
||||
IpSb->MacString,
|
||||
&gEfiIp4ServiceBindingProtocolGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
0,
|
||||
NULL
|
||||
);
|
||||
|
||||
FreePool (IpSb->MacString);
|
||||
IpSb->MacString = NULL;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Common definition for IP4.
|
||||
|
||||
Copyright (c) 2005 - 2012, 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
|
||||
|
@ -201,33 +201,4 @@ Ip4NtohHead (
|
|||
IN IP4_HEAD *Head
|
||||
);
|
||||
|
||||
/**
|
||||
Set the Ip4 variable data.
|
||||
|
||||
Save the list of all of the IPv4 addresses and subnet masks that are currently
|
||||
being used to volatile variable storage.
|
||||
|
||||
@param[in] IpSb Ip4 service binding instance
|
||||
|
||||
@retval EFI_SUCCESS Successfully set variable.
|
||||
@retval EFI_OUT_OF_RESOURCES There are not enough resources to set the variable.
|
||||
@retval other Set variable failed.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
Ip4SetVariableData (
|
||||
IN IP4_SERVICE *IpSb
|
||||
);
|
||||
|
||||
/**
|
||||
Clear the variable and free the resource.
|
||||
|
||||
@param[in] IpSb Ip4 service binding instance
|
||||
|
||||
**/
|
||||
VOID
|
||||
Ip4ClearVariableData (
|
||||
IN IP4_SERVICE *IpSb
|
||||
);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
The driver binding and service binding protocol for IP4 driver.
|
||||
|
||||
Copyright (c) 2005 - 2013, 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
|
||||
|
@ -297,8 +297,6 @@ Ip4CreateService (
|
|||
IpSb->MaxPacketSize -= NET_VLAN_TAG_LEN;
|
||||
}
|
||||
IpSb->OldMaxPacketSize = IpSb->MaxPacketSize;
|
||||
IpSb->MacString = NULL;
|
||||
|
||||
*Service = IpSb;
|
||||
return EFI_SUCCESS;
|
||||
|
||||
|
@ -519,8 +517,6 @@ Ip4DriverBindingStart (
|
|||
//
|
||||
mIp4Id = (UINT16)NET_RANDOM (NetRandomInitSeed ());
|
||||
|
||||
Ip4SetVariableData (IpSb);
|
||||
|
||||
return Status;
|
||||
|
||||
UNINSTALL_PROTOCOL:
|
||||
|
@ -716,11 +712,6 @@ Ip4DriverBindingStop (
|
|||
State = IpSb->State;
|
||||
IpSb->State = IP4_SERVICE_DESTROY;
|
||||
|
||||
//
|
||||
// Clear the variable data.
|
||||
//
|
||||
Ip4ClearVariableData (IpSb);
|
||||
|
||||
//
|
||||
// OK, clean other resources then uninstall the service binding protocol.
|
||||
//
|
||||
|
@ -975,9 +966,6 @@ Ip4ServiceBindingDestroyChild (
|
|||
}
|
||||
|
||||
Status = Ip4CleanProtocol (IpInstance);
|
||||
|
||||
Ip4SetVariableData (IpSb);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
gBS->InstallMultipleProtocolInterfaces (
|
||||
&ChildHandle,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/** @file
|
||||
|
||||
Copyright (c) 2005 - 2013, 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
|
||||
|
@ -701,8 +701,6 @@ Ip4AutoConfigCallBackDpc (
|
|||
|
||||
IpSb->State = IP4_SERVICE_CONFIGED;
|
||||
|
||||
Ip4SetVariableData (IpSb);
|
||||
|
||||
ON_EXIT:
|
||||
FreePool (Data);
|
||||
}
|
||||
|
@ -1312,11 +1310,6 @@ EfiIp4Configure (
|
|||
//
|
||||
Ip4ServiceConfigMnp (IpInstance->Service, FALSE);
|
||||
|
||||
//
|
||||
// Update the variable data.
|
||||
//
|
||||
Ip4SetVariableData (IpInstance->Service);
|
||||
|
||||
ON_EXIT:
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
return Status;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Ip4 internal functions and type defintions.
|
||||
|
||||
Copyright (c) 2005 - 2012, 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
|
||||
|
@ -202,11 +202,6 @@ struct _IP4_SERVICE {
|
|||
EFI_EVENT ReconfigEvent;
|
||||
EFI_EVENT ActiveEvent;
|
||||
|
||||
//
|
||||
// The string representation of the current mac address of the
|
||||
// NIC this IP4_SERVICE works on.
|
||||
//
|
||||
CHAR16 *MacString;
|
||||
UINT32 MaxPacketSize;
|
||||
UINT32 OldMaxPacketSize; ///< The MTU before IPsec enable.
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Tcp request dispatcher implementation.
|
||||
|
||||
Copyright (c) 2005 - 2012, 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
|
||||
|
@ -237,8 +237,6 @@ Tcp4FlushPcb (
|
|||
);
|
||||
FreePool (Sock->DevicePath);
|
||||
}
|
||||
|
||||
TcpSetVariableData (TcpProto->TcpService);
|
||||
}
|
||||
|
||||
NetbufFreeList (&Tcb->SndQue);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Tcp driver function.
|
||||
|
||||
Copyright (c) 2005 - 2013, 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
|
||||
|
@ -418,8 +418,6 @@ Tcp4DriverBindingStart (
|
|||
|
||||
InitializeListHead (&TcpServiceData->SocketList);
|
||||
|
||||
TcpSetVariableData (TcpServiceData);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
|
||||
ON_ERROR:
|
||||
|
@ -539,11 +537,6 @@ Tcp4DriverBindingStop (
|
|||
//
|
||||
Tcp4DestroyTimer ();
|
||||
|
||||
//
|
||||
// Clear the variable.
|
||||
//
|
||||
TcpClearVariableData (TcpServiceData);
|
||||
|
||||
if (gTcpControllerNameTable != NULL) {
|
||||
FreeUnicodeStringTable (gTcpControllerNameTable);
|
||||
gTcpControllerNameTable = NULL;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Tcp driver function header.
|
||||
|
||||
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
|
||||
|
@ -48,7 +48,6 @@ typedef struct _TCP4_SERVICE_DATA {
|
|||
IP_IO *IpIo; // IP Io consumed by TCP4
|
||||
EFI_SERVICE_BINDING_PROTOCOL Tcp4ServiceBinding;
|
||||
EFI_HANDLE DriverBindingHandle;
|
||||
CHAR16 *MacString;
|
||||
LIST_ENTRY SocketList;
|
||||
} TCP4_SERVICE_DATA;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Tcp function header file.
|
||||
|
||||
Copyright (c) 2005 - 2009, 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
|
||||
|
@ -764,31 +764,6 @@ TcpBackoffRto (
|
|||
IN OUT TCP_CB *Tcb
|
||||
);
|
||||
|
||||
/**
|
||||
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
|
||||
);
|
||||
|
||||
/**
|
||||
Clear the variable and free the resource.
|
||||
|
||||
@param Tcp4Service Pointer to Tcp4 service data.
|
||||
|
||||
**/
|
||||
VOID
|
||||
TcpClearVariableData (
|
||||
IN TCP4_SERVICE_DATA *Tcp4Service
|
||||
);
|
||||
|
||||
/**
|
||||
Install the device path protocol on the TCP instance.
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/** @file
|
||||
|
||||
Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2006 - 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
|
||||
|
@ -181,8 +181,6 @@ Udp4DriverBindingStart (
|
|||
if (EFI_ERROR (Status)) {
|
||||
Udp4CleanService (Udp4Service);
|
||||
FreePool (Udp4Service);
|
||||
} else {
|
||||
Udp4SetVariableData (Udp4Service);
|
||||
}
|
||||
|
||||
return Status;
|
||||
|
@ -268,9 +266,7 @@ Udp4DriverBindingStop (
|
|||
&Udp4Service->ServiceBinding,
|
||||
NULL
|
||||
);
|
||||
|
||||
Udp4ClearVariableData (Udp4Service);
|
||||
|
||||
|
||||
Udp4CleanService (Udp4Service);
|
||||
|
||||
if (gUdpControllerNameTable != NULL) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
The implementation of the Udp4 protocol.
|
||||
|
||||
Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2006 - 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
|
||||
|
@ -1633,8 +1633,6 @@ Udp4Demultiplex (
|
|||
}
|
||||
}
|
||||
|
||||
gRT->GetTime (&RxData.TimeStamp, NULL);
|
||||
|
||||
Udp4Session = &RxData.UdpSession;
|
||||
Udp4Session->SourcePort = NTOHS (Udp4Header->SrcPort);
|
||||
Udp4Session->DestinationPort = NTOHS (Udp4Header->DstPort);
|
||||
|
@ -1896,166 +1894,4 @@ Udp4NetVectorExtFree (
|
|||
VOID *Context
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Set the Udp4 variable data.
|
||||
|
||||
@param[in] Udp4Service Udp4 service data.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES There are not enough resources to set the
|
||||
variable.
|
||||
@retval EFI_SUCCESS Set variable successfully.
|
||||
@retval other Set variable failed.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
Udp4SetVariableData (
|
||||
IN UDP4_SERVICE_DATA *Udp4Service
|
||||
)
|
||||
{
|
||||
UINT32 NumConfiguredInstance;
|
||||
LIST_ENTRY *Entry;
|
||||
UINTN VariableDataSize;
|
||||
EFI_UDP4_VARIABLE_DATA *Udp4VariableData;
|
||||
EFI_UDP4_SERVICE_POINT *Udp4ServicePoint;
|
||||
UDP4_INSTANCE_DATA *Udp4Instance;
|
||||
CHAR16 *NewMacString;
|
||||
EFI_STATUS Status;
|
||||
|
||||
NumConfiguredInstance = 0;
|
||||
|
||||
//
|
||||
// Go through the children list to count the configured children.
|
||||
//
|
||||
NET_LIST_FOR_EACH (Entry, &Udp4Service->ChildrenList) {
|
||||
Udp4Instance = NET_LIST_USER_STRUCT_S (
|
||||
Entry,
|
||||
UDP4_INSTANCE_DATA,
|
||||
Link,
|
||||
UDP4_INSTANCE_DATA_SIGNATURE
|
||||
);
|
||||
|
||||
if (Udp4Instance->Configured) {
|
||||
NumConfiguredInstance++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Calculate the size of the Udp4VariableData. As there may be no Udp4 child,
|
||||
// we should add extra buffer for the service points only if the number of configured
|
||||
// children is more than 1.
|
||||
//
|
||||
VariableDataSize = sizeof (EFI_UDP4_VARIABLE_DATA);
|
||||
|
||||
if (NumConfiguredInstance > 1) {
|
||||
VariableDataSize += sizeof (EFI_UDP4_SERVICE_POINT) * (NumConfiguredInstance - 1);
|
||||
}
|
||||
|
||||
Udp4VariableData = AllocatePool (VariableDataSize);
|
||||
if (Udp4VariableData == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
Udp4VariableData->DriverHandle = Udp4Service->ImageHandle;
|
||||
Udp4VariableData->ServiceCount = NumConfiguredInstance;
|
||||
|
||||
Udp4ServicePoint = &Udp4VariableData->Services[0];
|
||||
|
||||
//
|
||||
// Go through the children list to fill the configured children's address pairs.
|
||||
//
|
||||
NET_LIST_FOR_EACH (Entry, &Udp4Service->ChildrenList) {
|
||||
Udp4Instance = NET_LIST_USER_STRUCT_S (
|
||||
Entry,
|
||||
UDP4_INSTANCE_DATA,
|
||||
Link,
|
||||
UDP4_INSTANCE_DATA_SIGNATURE
|
||||
);
|
||||
|
||||
if (Udp4Instance->Configured) {
|
||||
Udp4ServicePoint->InstanceHandle = Udp4Instance->ChildHandle;
|
||||
Udp4ServicePoint->LocalAddress = Udp4Instance->ConfigData.StationAddress;
|
||||
Udp4ServicePoint->LocalPort = Udp4Instance->ConfigData.StationPort;
|
||||
Udp4ServicePoint->RemoteAddress = Udp4Instance->ConfigData.RemoteAddress;
|
||||
Udp4ServicePoint->RemotePort = Udp4Instance->ConfigData.RemotePort;
|
||||
|
||||
Udp4ServicePoint++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Get the mac string.
|
||||
//
|
||||
Status = NetLibGetMacString (
|
||||
Udp4Service->ControllerHandle,
|
||||
Udp4Service->ImageHandle,
|
||||
&NewMacString
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto ON_ERROR;
|
||||
}
|
||||
|
||||
if (Udp4Service->MacString != NULL) {
|
||||
//
|
||||
// The variable is set already, we're going to update it.
|
||||
//
|
||||
if (StrCmp (Udp4Service->MacString, NewMacString) != 0) {
|
||||
//
|
||||
// The mac address is changed, delete the previous variable first.
|
||||
//
|
||||
gRT->SetVariable (
|
||||
Udp4Service->MacString,
|
||||
&gEfiUdp4ServiceBindingProtocolGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
0,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
FreePool (Udp4Service->MacString);
|
||||
}
|
||||
|
||||
Udp4Service->MacString = NewMacString;
|
||||
|
||||
Status = gRT->SetVariable (
|
||||
Udp4Service->MacString,
|
||||
&gEfiUdp4ServiceBindingProtocolGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
VariableDataSize,
|
||||
(VOID *) Udp4VariableData
|
||||
);
|
||||
|
||||
ON_ERROR:
|
||||
|
||||
FreePool (Udp4VariableData);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Clear the variable and free the resource.
|
||||
|
||||
@param[[in] Udp4Service Udp4 service data.
|
||||
|
||||
**/
|
||||
VOID
|
||||
Udp4ClearVariableData (
|
||||
IN UDP4_SERVICE_DATA *Udp4Service
|
||||
)
|
||||
{
|
||||
ASSERT (Udp4Service->MacString != NULL);
|
||||
|
||||
gRT->SetVariable (
|
||||
Udp4Service->MacString,
|
||||
&gEfiUdp4ServiceBindingProtocolGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
0,
|
||||
NULL
|
||||
);
|
||||
|
||||
FreePool (Udp4Service->MacString);
|
||||
Udp4Service->MacString = NULL;
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
EFI UDPv4 protocol implementation.
|
||||
|
||||
Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2006 - 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
|
||||
|
@ -72,8 +72,6 @@ typedef struct _UDP4_SERVICE_DATA_ {
|
|||
IP_IO *IpIo;
|
||||
|
||||
EFI_EVENT TimeoutEvent;
|
||||
|
||||
CHAR16 *MacString;
|
||||
} UDP4_SERVICE_DATA;
|
||||
|
||||
#define UDP4_INSTANCE_DATA_SIGNATURE SIGNATURE_32('U', 'd', 'p', 'I')
|
||||
|
@ -693,33 +691,5 @@ EFIAPI
|
|||
Udp4NetVectorExtFree (
|
||||
VOID *Context
|
||||
);
|
||||
|
||||
/**
|
||||
Set the Udp4 variable data.
|
||||
|
||||
@param[in] Udp4Service Udp4 service data.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES There are not enough resources to set the
|
||||
variable.
|
||||
@retval EFI_SUCCESS Set variable successfully.
|
||||
@retval other Set variable failed.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
Udp4SetVariableData (
|
||||
IN UDP4_SERVICE_DATA *Udp4Service
|
||||
);
|
||||
|
||||
/**
|
||||
Clear the variable and free the resource.
|
||||
|
||||
@param[[in] Udp4Service Udp4 service data.
|
||||
|
||||
**/
|
||||
VOID
|
||||
Udp4ClearVariableData (
|
||||
IN UDP4_SERVICE_DATA *Udp4Service
|
||||
);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/** @file
|
||||
|
||||
Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2006 - 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
|
||||
|
@ -280,9 +280,7 @@ Udp4Configure (
|
|||
|
||||
ASSERT (IsListEmpty (&Instance->DeliveredDgramQue));
|
||||
}
|
||||
|
||||
Udp4SetVariableData (Instance->Udp4Service);
|
||||
|
||||
|
||||
ON_EXIT:
|
||||
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
Protocol interface. It is split into the following three main
|
||||
sections:
|
||||
- EFI IPv4 Service Binding Protocol
|
||||
- EFI IPv4 Variable
|
||||
- EFI IPv4 Variable (deprecated in UEFI 2.4B)
|
||||
- EFI IPv4 Protocol.
|
||||
The EFI IPv4 Protocol provides basic network IPv4 packet I/O services,
|
||||
which includes support foR a subset of the Internet Control Message
|
||||
Protocol (ICMP) and may include support for the Internet Group Management
|
||||
Protocol (IGMP).
|
||||
|
||||
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2006 - 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 that accompanies this distribution.
|
||||
The full text of the license may be found at
|
||||
|
@ -40,13 +40,21 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
}
|
||||
|
||||
typedef struct _EFI_IP4_PROTOCOL EFI_IP4_PROTOCOL;
|
||||
|
||||
|
||||
///
|
||||
/// EFI_IP4_ADDRESS_PAIR is deprecated in the UEFI 2.4B and should not be used any more.
|
||||
/// The definition in here is only present to provide backwards compatability.
|
||||
///
|
||||
typedef struct {
|
||||
EFI_HANDLE InstanceHandle;
|
||||
EFI_IPv4_ADDRESS Ip4Address;
|
||||
EFI_IPv4_ADDRESS SubnetMask;
|
||||
} EFI_IP4_ADDRESS_PAIR;
|
||||
|
||||
///
|
||||
/// EFI_IP4_VARIABLE_DATA is deprecated in the UEFI 2.4B and should not be used any more.
|
||||
/// The definition in here is only present to provide backwards compatability.
|
||||
///
|
||||
typedef struct {
|
||||
EFI_HANDLE DriverHandle;
|
||||
UINT32 AddressCount;
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
Protocol interface. It is split into the following three main
|
||||
sections:
|
||||
- EFI IPv6 Service Binding Protocol
|
||||
- EFI IPv6 Variable
|
||||
- EFI IPv6 Variable (deprecated in UEFI 2.4B)
|
||||
- EFI IPv6 Protocol
|
||||
The EFI IPv6 Protocol provides basic network IPv6 packet I/O services,
|
||||
which includes support for Neighbor Discovery Protocol (ND), Multicast
|
||||
Listener Discovery Protocol (MLD), and a subset of the Internet Control
|
||||
Message Protocol (ICMPv6).
|
||||
|
||||
Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2008 - 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
|
||||
|
@ -43,7 +43,8 @@
|
|||
typedef struct _EFI_IP6_PROTOCOL EFI_IP6_PROTOCOL;
|
||||
|
||||
///
|
||||
/// EFI_IP6_ADDRESS_PAIR
|
||||
/// EFI_IP6_ADDRESS_PAIR is deprecated in the UEFI 2.4B and should not be used any more.
|
||||
/// The definition in here is only present to provide backwards compatability.
|
||||
///
|
||||
typedef struct{
|
||||
///
|
||||
|
@ -61,7 +62,8 @@ typedef struct{
|
|||
} EFI_IP6_ADDRESS_PAIR;
|
||||
|
||||
///
|
||||
/// EFI_IP6_VARIABLE_DATA
|
||||
/// EFI_IP6_VARIABLE_DATA is deprecated in the UEFI 2.4B and should not be used any more.
|
||||
/// The definition in here is only present to provide backwards compatability.
|
||||
///
|
||||
typedef struct {
|
||||
///
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
and destroy child of the driver to communicate with other host using TCP protocol.
|
||||
The EFI TCPv4 Protocol provides services to send and receive data stream.
|
||||
|
||||
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2006 - 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 that accompanies this distribution.
|
||||
The full text of the license may be found at
|
||||
|
@ -35,6 +35,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
|
||||
typedef struct _EFI_TCP4_PROTOCOL EFI_TCP4_PROTOCOL;
|
||||
|
||||
///
|
||||
/// EFI_TCP4_SERVICE_POINT is deprecated in the UEFI 2.4B and should not be used any more.
|
||||
/// The definition in here is only present to provide backwards compatability.
|
||||
///
|
||||
typedef struct {
|
||||
EFI_HANDLE InstanceHandle;
|
||||
EFI_IPv4_ADDRESS LocalAddress;
|
||||
|
@ -43,6 +47,10 @@ typedef struct {
|
|||
UINT16 RemotePort;
|
||||
} EFI_TCP4_SERVICE_POINT;
|
||||
|
||||
///
|
||||
/// EFI_TCP4_VARIABLE_DATA is deprecated in the UEFI 2.4B and should not be used any more.
|
||||
/// The definition in here is only present to provide backwards compatability.
|
||||
///
|
||||
typedef struct {
|
||||
EFI_HANDLE DriverHandle;
|
||||
UINT32 ServiceCount;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
and destroy child of the driver to communicate with other host using TCP protocol.
|
||||
The EFI TCPv6 Protocol provides services to send and receive data stream.
|
||||
|
||||
Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2008 - 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
|
||||
|
@ -38,7 +38,8 @@
|
|||
typedef struct _EFI_TCP6_PROTOCOL EFI_TCP6_PROTOCOL;
|
||||
|
||||
///
|
||||
/// EFI_TCP6_SERVICE_POINT
|
||||
/// EFI_TCP6_SERVICE_POINT is deprecated in the UEFI 2.4B and should not be used any more.
|
||||
/// The definition in here is only present to provide backwards compatability.
|
||||
///
|
||||
typedef struct {
|
||||
///
|
||||
|
@ -69,7 +70,8 @@ typedef struct {
|
|||
} EFI_TCP6_SERVICE_POINT;
|
||||
|
||||
///
|
||||
/// EFI_TCP6_VARIABLE_DATA
|
||||
/// EFI_TCP6_VARIABLE_DATA is deprecated in the UEFI 2.4B and should not be used any more.
|
||||
/// The definition in here is only present to provide backwards compatability.
|
||||
///
|
||||
typedef struct {
|
||||
EFI_HANDLE DriverHandle; ///< The handle of the driver that creates this entry.
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
The EFI UDPv4 Protocol provides simple packet-oriented services
|
||||
to transmit and receive UDP packets.
|
||||
|
||||
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2006 - 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 that accompanies this distribution.
|
||||
The full text of the license may be found at
|
||||
|
@ -37,6 +37,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
|
||||
typedef struct _EFI_UDP4_PROTOCOL EFI_UDP4_PROTOCOL;
|
||||
|
||||
///
|
||||
/// EFI_UDP4_SERVICE_POINT is deprecated in the UEFI 2.4B and should not be used any more.
|
||||
/// The definition in here is only present to provide backwards compatability.
|
||||
///
|
||||
typedef struct {
|
||||
EFI_HANDLE InstanceHandle;
|
||||
EFI_IPv4_ADDRESS LocalAddress;
|
||||
|
@ -45,6 +49,10 @@ typedef struct {
|
|||
UINT16 RemotePort;
|
||||
} EFI_UDP4_SERVICE_POINT;
|
||||
|
||||
///
|
||||
/// EFI_UDP4_VARIABLE_DATA is deprecated in the UEFI 2.4B and should not be used any more.
|
||||
/// The definition in here is only present to provide backwards compatability.
|
||||
///
|
||||
typedef struct {
|
||||
EFI_HANDLE DriverHandle;
|
||||
UINT32 ServiceCount;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
the EFI IPv6 Protocol and provides simple packet-oriented services to transmit and receive
|
||||
UDP packets.
|
||||
|
||||
Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2008 - 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
|
||||
|
@ -32,6 +32,10 @@
|
|||
0x4f948815, 0xb4b9, 0x43cb, {0x8a, 0x33, 0x90, 0xe0, 0x60, 0xb3, 0x49, 0x55 } \
|
||||
}
|
||||
|
||||
///
|
||||
/// EFI_UDP6_SERVICE_POINT is deprecated in the UEFI 2.4B and should not be used any more.
|
||||
/// The definition in here is only present to provide backwards compatability.
|
||||
///
|
||||
typedef struct {
|
||||
///
|
||||
/// The EFI UDPv6 Protocol instance handle that is using this address/port pair.
|
||||
|
@ -59,6 +63,10 @@ typedef struct {
|
|||
UINT16 RemotePort;
|
||||
} EFI_UDP6_SERVICE_POINT;
|
||||
|
||||
///
|
||||
/// EFI_UDP6_VARIABLE_DATA is deprecated in the UEFI 2.4B and should not be used any more.
|
||||
/// The definition in here is only present to provide backwards compatability.
|
||||
///
|
||||
typedef struct {
|
||||
///
|
||||
/// The handle of the driver that creates this entry.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
The implementation of common functions shared by IP6 driver.
|
||||
|
||||
Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2009 - 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
|
||||
|
@ -650,146 +650,6 @@ Ip6GetMulticastMac (
|
|||
return Mnp->McastIpToMac (Mnp, TRUE, &EfiIp, Mac);
|
||||
}
|
||||
|
||||
/**
|
||||
Set the Ip6 variable data.
|
||||
|
||||
@param[in] IpSb Points to an IP6 service binding instance.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES There are not enough resources to set the variable.
|
||||
@retval other Set variable failed.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
Ip6SetVariableData (
|
||||
IN IP6_SERVICE *IpSb
|
||||
)
|
||||
{
|
||||
UINT32 NumConfiguredInstance;
|
||||
LIST_ENTRY *Entry;
|
||||
UINTN VariableDataSize;
|
||||
EFI_IP6_VARIABLE_DATA *Ip6VariableData;
|
||||
EFI_IP6_ADDRESS_PAIR *Ip6AddressPair;
|
||||
IP6_PROTOCOL *IpInstance;
|
||||
CHAR16 *NewMacString;
|
||||
EFI_STATUS Status;
|
||||
|
||||
NumConfiguredInstance = 0;
|
||||
|
||||
//
|
||||
// Go through the children list to count the configured children.
|
||||
//
|
||||
NET_LIST_FOR_EACH (Entry, &IpSb->Children) {
|
||||
IpInstance = NET_LIST_USER_STRUCT_S (Entry, IP6_PROTOCOL, Link, IP6_PROTOCOL_SIGNATURE);
|
||||
|
||||
if (IpInstance->State == IP6_STATE_CONFIGED) {
|
||||
NumConfiguredInstance++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Calculate the size of the Ip6VariableData. As there may be no IP child,
|
||||
// we should add extra buffer for the address paris only if the number of configured
|
||||
// children is more than 1.
|
||||
//
|
||||
VariableDataSize = sizeof (EFI_IP6_VARIABLE_DATA);
|
||||
|
||||
if (NumConfiguredInstance > 1) {
|
||||
VariableDataSize += sizeof (EFI_IP6_ADDRESS_PAIR) * (NumConfiguredInstance - 1);
|
||||
}
|
||||
|
||||
Ip6VariableData = AllocatePool (VariableDataSize);
|
||||
if (Ip6VariableData == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
Ip6VariableData->DriverHandle = IpSb->Image;
|
||||
Ip6VariableData->AddressCount = NumConfiguredInstance;
|
||||
|
||||
Ip6AddressPair = &Ip6VariableData->AddressPairs[0];
|
||||
|
||||
//
|
||||
// Go through the children list to fill the configured children's address pairs.
|
||||
//
|
||||
NET_LIST_FOR_EACH (Entry, &IpSb->Children) {
|
||||
IpInstance = NET_LIST_USER_STRUCT_S (Entry, IP6_PROTOCOL, Link, IP6_PROTOCOL_SIGNATURE);
|
||||
|
||||
if (IpInstance->State == IP6_STATE_CONFIGED) {
|
||||
Ip6AddressPair->InstanceHandle = IpInstance->Handle;
|
||||
Ip6AddressPair->PrefixLength = IpInstance->PrefixLength;
|
||||
IP6_COPY_ADDRESS (&Ip6AddressPair->Ip6Address, &IpInstance->ConfigData.StationAddress);
|
||||
|
||||
Ip6AddressPair++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Get the mac string.
|
||||
//
|
||||
Status = NetLibGetMacString (IpSb->Controller, IpSb->Image, &NewMacString);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
if (IpSb->MacString != NULL) {
|
||||
//
|
||||
// The variable is set already, we're going to update it.
|
||||
//
|
||||
if (StrCmp (IpSb->MacString, NewMacString) != 0) {
|
||||
//
|
||||
// The mac address is changed, delete the previous variable first.
|
||||
//
|
||||
gRT->SetVariable (
|
||||
IpSb->MacString,
|
||||
&gEfiIp6ServiceBindingProtocolGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
0,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
FreePool (IpSb->MacString);
|
||||
}
|
||||
|
||||
IpSb->MacString = NewMacString;
|
||||
|
||||
Status = gRT->SetVariable (
|
||||
IpSb->MacString,
|
||||
&gEfiIp6ServiceBindingProtocolGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
VariableDataSize,
|
||||
(VOID *) Ip6VariableData
|
||||
);
|
||||
|
||||
Exit:
|
||||
FreePool (Ip6VariableData);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
Clear the variable and free the resource.
|
||||
|
||||
@param[in] IpSb Ip6 service binding instance.
|
||||
|
||||
**/
|
||||
VOID
|
||||
Ip6ClearVariableData (
|
||||
IN IP6_SERVICE *IpSb
|
||||
)
|
||||
{
|
||||
ASSERT (IpSb->MacString != NULL);
|
||||
|
||||
gRT->SetVariable (
|
||||
IpSb->MacString,
|
||||
&gEfiIp6ServiceBindingProtocolGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
0,
|
||||
NULL
|
||||
);
|
||||
|
||||
FreePool (IpSb->MacString);
|
||||
IpSb->MacString = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
Convert the multibyte field in IP header's byter order.
|
||||
In spite of its name, it can also be used to convert from
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Common definition and functions for IP6 driver.
|
||||
|
||||
Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2009 - 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
|
||||
|
@ -279,31 +279,6 @@ Ip6RemoveAddr (
|
|||
IN UINT8 PrefixLength
|
||||
);
|
||||
|
||||
/**
|
||||
Set the Ip6 variable data.
|
||||
|
||||
@param[in] IpSb Points to an IP6 service binding instance
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES There are not enough resources to set the variable.
|
||||
@retval other Set variable failed.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
Ip6SetVariableData (
|
||||
IN IP6_SERVICE *IpSb
|
||||
);
|
||||
|
||||
/**
|
||||
Clear the variable and free the resource.
|
||||
|
||||
@param[in] IpSb Ip6 service binding instance.
|
||||
|
||||
**/
|
||||
VOID
|
||||
Ip6ClearVariableData (
|
||||
IN IP6_SERVICE *IpSb
|
||||
);
|
||||
|
||||
/**
|
||||
Get the MAC address for a multicast IP address. Call
|
||||
Mnp's McastIpToMac to find the MAC address instead of
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
The driver binding and service binding protocol for IP6 driver.
|
||||
|
||||
Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2009 - 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
|
||||
|
@ -573,8 +573,6 @@ Ip6DriverBindingStart (
|
|||
//
|
||||
mIp6Id = NET_RANDOM (NetRandomInitSeed ());
|
||||
|
||||
Ip6SetVariableData (IpSb);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -701,11 +699,6 @@ Ip6DriverBindingStop (
|
|||
State = IpSb->State;
|
||||
IpSb->State = IP6_SERVICE_DESTROY;
|
||||
|
||||
//
|
||||
// Clear the variable data.
|
||||
//
|
||||
Ip6ClearVariableData (IpSb);
|
||||
|
||||
Status = Ip6CleanService (IpSb);
|
||||
if (EFI_ERROR (Status)) {
|
||||
IpSb->State = State;
|
||||
|
@ -943,9 +936,6 @@ Ip6ServiceBindingDestroyChild (
|
|||
}
|
||||
|
||||
Status = Ip6CleanProtocol (IpInstance);
|
||||
|
||||
Ip6SetVariableData (IpSb);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
gBS->InstallMultipleProtocolInterfaces (
|
||||
&ChildHandle,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Implementation of EFI_IP6_PROTOCOL protocol interfaces.
|
||||
|
||||
Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2009 - 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
|
||||
|
@ -705,11 +705,6 @@ EfiIp6Configure (
|
|||
//
|
||||
Ip6ServiceConfigMnp (IpInstance->Service, FALSE);
|
||||
|
||||
//
|
||||
// Update the variable data.
|
||||
//
|
||||
Ip6SetVariableData (IpInstance->Service);
|
||||
|
||||
Exit:
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
return Status;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
The implementation of a dispatch routine for processing TCP requests.
|
||||
|
||||
Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2009 - 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
|
||||
|
@ -327,8 +327,6 @@ TcpFlushPcb (
|
|||
FreePool (Sock->DevicePath);
|
||||
Sock->DevicePath = NULL;
|
||||
}
|
||||
|
||||
TcpSetVariableData (TcpProto->TcpService);
|
||||
}
|
||||
|
||||
NetbufFreeList (&Tcb->SndQue);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
The driver binding and service binding protocol for the TCP driver.
|
||||
|
||||
Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2009 - 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
|
||||
|
@ -349,8 +349,6 @@ TcpCreateService (
|
|||
goto ON_ERROR;
|
||||
}
|
||||
|
||||
TcpSetVariableData (TcpServiceData);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
|
||||
ON_ERROR:
|
||||
|
@ -499,11 +497,6 @@ TcpDestroyService (
|
|||
//
|
||||
TcpDestroyTimer ();
|
||||
|
||||
//
|
||||
// Clear the variable.
|
||||
//
|
||||
TcpClearVariableData (TcpServiceData);
|
||||
|
||||
//
|
||||
// Release the TCP service data
|
||||
//
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
The prototype of driver binding and service binding protocol for TCP driver.
|
||||
|
||||
Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2009 - 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
|
||||
|
@ -33,7 +33,6 @@ typedef struct _TCP_SERVICE_DATA {
|
|||
UINT8 IpVersion;
|
||||
IP_IO *IpIo;
|
||||
EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
|
||||
CHAR16 *MacString;
|
||||
LIST_ENTRY SocketList;
|
||||
} TCP_SERVICE_DATA;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Declaration of external functions shared in TCP driver.
|
||||
|
||||
Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2009 - 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
|
||||
|
@ -276,31 +276,6 @@ TcpResetConnection (
|
|||
IN TCP_CB *Tcb
|
||||
);
|
||||
|
||||
/**
|
||||
Set the Tcp variable data.
|
||||
|
||||
@param[in] TcpService Tcp 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 TCP_SERVICE_DATA *TcpService
|
||||
);
|
||||
|
||||
/**
|
||||
Clear the variable and free the resource.
|
||||
|
||||
@param[in] TcpService Tcp service data.
|
||||
|
||||
**/
|
||||
VOID
|
||||
TcpClearVariableData (
|
||||
IN TCP_SERVICE_DATA *TcpService
|
||||
);
|
||||
|
||||
/**
|
||||
Install the device path protocol on the TCP instance.
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Misc support routines for TCP driver.
|
||||
|
||||
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2009 - 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
|
||||
|
@ -467,7 +467,6 @@ TcpInsertTcb (
|
|||
InsertHeadList (Head, &Tcb->List);
|
||||
|
||||
TcpProto = (TCP_PROTO_DATA *) Tcb->Sk->ProtoReserved;
|
||||
TcpSetVariableData (TcpProto->TcpService);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -943,266 +942,6 @@ TcpResetConnection (
|
|||
NetbufFree (Nbuf);
|
||||
}
|
||||
|
||||
/**
|
||||
Set the Tcp variable data.
|
||||
|
||||
@param[in] TcpService Tcp 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 TCP_SERVICE_DATA *TcpService
|
||||
)
|
||||
{
|
||||
EFI_GUID *ServiceBindingGuid;
|
||||
UINT32 NumConfiguredInstance;
|
||||
LIST_ENTRY *Entry;
|
||||
TCP_CB *TcpPcb;
|
||||
TCP_PROTO_DATA *TcpProto;
|
||||
UINTN VariableDataSize;
|
||||
EFI_TCP4_VARIABLE_DATA *Tcp4VariableData;
|
||||
EFI_TCP4_SERVICE_POINT *Tcp4ServicePoint;
|
||||
EFI_TCP6_VARIABLE_DATA *Tcp6VariableData;
|
||||
EFI_TCP6_SERVICE_POINT *Tcp6ServicePoint;
|
||||
VOID *VariableData;
|
||||
CHAR16 *NewMacString;
|
||||
EFI_STATUS Status;
|
||||
|
||||
if (TcpService->IpVersion == IP_VERSION_4) {
|
||||
ServiceBindingGuid = &gEfiTcp4ServiceBindingProtocolGuid;
|
||||
} else {
|
||||
ServiceBindingGuid = &gEfiTcp6ServiceBindingProtocolGuid;
|
||||
}
|
||||
|
||||
NumConfiguredInstance = 0;
|
||||
Tcp4VariableData = NULL;
|
||||
Tcp6VariableData = NULL;
|
||||
|
||||
//
|
||||
// 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 = (TCP_PROTO_DATA *) TcpPcb->Sk->ProtoReserved;
|
||||
|
||||
if (TcpProto->TcpService == TcpService) {
|
||||
//
|
||||
// This tcp instance belongs to the TcpService.
|
||||
//
|
||||
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 = (TCP_PROTO_DATA *) TcpPcb->Sk->ProtoReserved;
|
||||
|
||||
if (TcpProto->TcpService == TcpService) {
|
||||
//
|
||||
// This tcp instance belongs to the TcpService.
|
||||
//
|
||||
NumConfiguredInstance++;
|
||||
}
|
||||
}
|
||||
|
||||
Tcp4ServicePoint = NULL;
|
||||
Tcp6ServicePoint = NULL;
|
||||
|
||||
//
|
||||
// Calculate the size of the Tcp4VariableData. As there may be no Tcp4 child,
|
||||
// we should add extra buffers for the service points only if the number of configured
|
||||
// children is more than one.
|
||||
//
|
||||
if (TcpService->IpVersion == IP_VERSION_4) {
|
||||
VariableDataSize = sizeof (EFI_TCP4_VARIABLE_DATA);
|
||||
|
||||
if (NumConfiguredInstance > 1) {
|
||||
VariableDataSize += sizeof (EFI_TCP4_SERVICE_POINT) * (NumConfiguredInstance - 1);
|
||||
}
|
||||
|
||||
Tcp4VariableData = AllocateZeroPool (VariableDataSize);
|
||||
if (Tcp4VariableData == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
Tcp4VariableData->DriverHandle = TcpService->DriverBindingHandle;
|
||||
Tcp4VariableData->ServiceCount = NumConfiguredInstance;
|
||||
|
||||
Tcp4ServicePoint = &Tcp4VariableData->Services[0];
|
||||
VariableData = Tcp4VariableData;
|
||||
} else {
|
||||
VariableDataSize = sizeof (EFI_TCP6_VARIABLE_DATA);
|
||||
|
||||
if (NumConfiguredInstance > 1) {
|
||||
VariableDataSize += sizeof (EFI_TCP6_SERVICE_POINT) * (NumConfiguredInstance - 1);
|
||||
}
|
||||
|
||||
Tcp6VariableData = AllocateZeroPool (VariableDataSize);
|
||||
if (Tcp6VariableData == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
Tcp6VariableData->DriverHandle = TcpService->DriverBindingHandle;
|
||||
Tcp6VariableData->ServiceCount = NumConfiguredInstance;
|
||||
|
||||
Tcp6ServicePoint = &Tcp6VariableData->Services[0];
|
||||
VariableData = Tcp6VariableData;
|
||||
}
|
||||
|
||||
//
|
||||
// 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 = (TCP_PROTO_DATA *) TcpPcb->Sk->ProtoReserved;
|
||||
|
||||
if (TcpProto->TcpService == TcpService) {
|
||||
//
|
||||
// This tcp instance belongs to the TcpService.
|
||||
//
|
||||
if (TcpService->IpVersion == IP_VERSION_4) {
|
||||
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++;
|
||||
} else {
|
||||
Tcp6ServicePoint->InstanceHandle = TcpPcb->Sk->SockHandle;
|
||||
IP6_COPY_ADDRESS (&Tcp6ServicePoint->LocalAddress, &TcpPcb->LocalEnd.Ip);
|
||||
Tcp6ServicePoint->LocalPort = NTOHS (TcpPcb->LocalEnd.Port);
|
||||
IP6_COPY_ADDRESS (&Tcp6ServicePoint->RemoteAddress, &TcpPcb->RemoteEnd.Ip);
|
||||
Tcp6ServicePoint->RemotePort = NTOHS (TcpPcb->RemoteEnd.Port);
|
||||
|
||||
Tcp6ServicePoint++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// 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 = (TCP_PROTO_DATA *) TcpPcb->Sk->ProtoReserved;
|
||||
|
||||
if (TcpProto->TcpService == TcpService) {
|
||||
//
|
||||
// This tcp instance belongs to the TcpService.
|
||||
//
|
||||
if (TcpService->IpVersion == IP_VERSION_4) {
|
||||
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++;
|
||||
} else {
|
||||
Tcp6ServicePoint->InstanceHandle = TcpPcb->Sk->SockHandle;
|
||||
IP6_COPY_ADDRESS (&Tcp6ServicePoint->LocalAddress, &TcpPcb->LocalEnd.Ip);
|
||||
Tcp6ServicePoint->LocalPort = NTOHS (TcpPcb->LocalEnd.Port);
|
||||
IP6_COPY_ADDRESS (&Tcp6ServicePoint->RemoteAddress, &TcpPcb->RemoteEnd.Ip);
|
||||
Tcp6ServicePoint->RemotePort = NTOHS (TcpPcb->RemoteEnd.Port);
|
||||
|
||||
Tcp6ServicePoint++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Get the mac string.
|
||||
//
|
||||
Status = NetLibGetMacString (
|
||||
TcpService->ControllerHandle,
|
||||
TcpService->DriverBindingHandle,
|
||||
&NewMacString
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto ON_ERROR;
|
||||
}
|
||||
|
||||
if (TcpService->MacString != NULL) {
|
||||
//
|
||||
// The variable is set already. We're going to update it.
|
||||
//
|
||||
if (StrCmp (TcpService->MacString, NewMacString) != 0) {
|
||||
//
|
||||
// The mac address is changed. Delete the previous variable first.
|
||||
//
|
||||
gRT->SetVariable (
|
||||
TcpService->MacString,
|
||||
ServiceBindingGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
0,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
FreePool (TcpService->MacString);
|
||||
}
|
||||
|
||||
TcpService->MacString = NewMacString;
|
||||
|
||||
Status = gRT->SetVariable (
|
||||
TcpService->MacString,
|
||||
ServiceBindingGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
VariableDataSize,
|
||||
VariableData
|
||||
);
|
||||
|
||||
ON_ERROR:
|
||||
|
||||
FreePool (VariableData);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
Clear the variable and free the resource.
|
||||
|
||||
@param[in] TcpService Tcp service data.
|
||||
|
||||
**/
|
||||
VOID
|
||||
TcpClearVariableData (
|
||||
IN TCP_SERVICE_DATA *TcpService
|
||||
)
|
||||
{
|
||||
EFI_GUID *ServiceBindingGuid;
|
||||
|
||||
ASSERT (TcpService->MacString != NULL);
|
||||
|
||||
if (TcpService->IpVersion == IP_VERSION_4) {
|
||||
ServiceBindingGuid = &gEfiTcp4ServiceBindingProtocolGuid;
|
||||
} else {
|
||||
ServiceBindingGuid = &gEfiTcp6ServiceBindingProtocolGuid;
|
||||
}
|
||||
|
||||
gRT->SetVariable (
|
||||
TcpService->MacString,
|
||||
ServiceBindingGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
0,
|
||||
NULL
|
||||
);
|
||||
|
||||
FreePool (TcpService->MacString);
|
||||
TcpService->MacString = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
Install the device path protocol on the TCP instance.
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Driver Binding functions and Service Binding functions for the Network driver module.
|
||||
|
||||
Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2009 - 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
|
||||
|
@ -165,8 +165,6 @@ Udp6DriverBindingStart (
|
|||
if (EFI_ERROR (Status)) {
|
||||
Udp6CleanService (Udp6Service);
|
||||
goto EXIT;
|
||||
} else {
|
||||
Status = Udp6SetVariableData (Udp6Service);
|
||||
}
|
||||
|
||||
EXIT:
|
||||
|
@ -298,9 +296,7 @@ Udp6DriverBindingStop (
|
|||
&Udp6Service->ServiceBinding,
|
||||
NULL
|
||||
);
|
||||
|
||||
Udp6ClearVariableData (Udp6Service);
|
||||
|
||||
|
||||
Udp6CleanService (Udp6Service);
|
||||
|
||||
FreePool (Udp6Service);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Udp6 driver's whole implementation.
|
||||
|
||||
Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2009 - 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
|
||||
|
@ -1623,8 +1623,6 @@ Udp6Demultiplex (
|
|||
}
|
||||
}
|
||||
|
||||
gRT->GetTime (&RxData.TimeStamp, NULL);
|
||||
|
||||
Udp6Session = &RxData.UdpSession;
|
||||
Udp6Session->SourcePort = NTOHS (Udp6Header->SrcPort);
|
||||
Udp6Session->DestinationPort = NTOHS (Udp6Header->DstPort);
|
||||
|
@ -1933,175 +1931,7 @@ Udp6NetVectorExtFree (
|
|||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Set the Udp6 variable data.
|
||||
|
||||
@param[in] Udp6Service Udp6 service data.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES There are not enough resources to set the
|
||||
variable.
|
||||
@retval other Set variable failed.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
Udp6SetVariableData (
|
||||
IN UDP6_SERVICE_DATA *Udp6Service
|
||||
)
|
||||
{
|
||||
UINT32 NumConfiguredInstance;
|
||||
LIST_ENTRY *Entry;
|
||||
UINTN VariableDataSize;
|
||||
EFI_UDP6_VARIABLE_DATA *Udp6VariableData;
|
||||
EFI_UDP6_SERVICE_POINT *Udp6ServicePoint;
|
||||
UDP6_INSTANCE_DATA *Udp6Instance;
|
||||
CHAR16 *NewMacString;
|
||||
EFI_STATUS Status;
|
||||
|
||||
NumConfiguredInstance = 0;
|
||||
|
||||
//
|
||||
// Go through the children list to count the configured children.
|
||||
//
|
||||
NET_LIST_FOR_EACH (Entry, &Udp6Service->ChildrenList) {
|
||||
Udp6Instance = NET_LIST_USER_STRUCT_S (
|
||||
Entry,
|
||||
UDP6_INSTANCE_DATA,
|
||||
Link,
|
||||
UDP6_INSTANCE_DATA_SIGNATURE
|
||||
);
|
||||
|
||||
if (Udp6Instance->Configured) {
|
||||
NumConfiguredInstance++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Calculate the size of the Udp6VariableData. As there may be no Udp6 child,
|
||||
// we should add extra buffer for the service points only if the number of configured
|
||||
// children is more than 1.
|
||||
//
|
||||
VariableDataSize = sizeof (EFI_UDP6_VARIABLE_DATA);
|
||||
|
||||
if (NumConfiguredInstance > 1) {
|
||||
VariableDataSize += sizeof (EFI_UDP6_SERVICE_POINT) * (NumConfiguredInstance - 1);
|
||||
}
|
||||
|
||||
Udp6VariableData = AllocateZeroPool (VariableDataSize);
|
||||
if (Udp6VariableData == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
Udp6VariableData->DriverHandle = Udp6Service->ImageHandle;
|
||||
Udp6VariableData->ServiceCount = NumConfiguredInstance;
|
||||
|
||||
Udp6ServicePoint = &Udp6VariableData->Services[0];
|
||||
|
||||
//
|
||||
// Go through the children list to fill the configured children's address pairs.
|
||||
//
|
||||
NET_LIST_FOR_EACH (Entry, &Udp6Service->ChildrenList) {
|
||||
Udp6Instance = NET_LIST_USER_STRUCT_S (
|
||||
Entry,
|
||||
UDP6_INSTANCE_DATA,
|
||||
Link,
|
||||
UDP6_INSTANCE_DATA_SIGNATURE
|
||||
);
|
||||
|
||||
if (Udp6Instance->Configured) {
|
||||
Udp6ServicePoint->InstanceHandle = Udp6Instance->ChildHandle;
|
||||
Udp6ServicePoint->LocalPort = Udp6Instance->ConfigData.StationPort;
|
||||
Udp6ServicePoint->RemotePort = Udp6Instance->ConfigData.RemotePort;
|
||||
|
||||
IP6_COPY_ADDRESS (
|
||||
&Udp6ServicePoint->LocalAddress,
|
||||
&Udp6Instance->ConfigData.StationAddress
|
||||
);
|
||||
IP6_COPY_ADDRESS (
|
||||
&Udp6ServicePoint->RemoteAddress,
|
||||
&Udp6Instance->ConfigData.RemoteAddress
|
||||
);
|
||||
Udp6ServicePoint++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Get the MAC string.
|
||||
//
|
||||
Status = NetLibGetMacString (
|
||||
Udp6Service->ControllerHandle,
|
||||
Udp6Service->ImageHandle,
|
||||
&NewMacString
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
if (Udp6Service->MacString != NULL) {
|
||||
//
|
||||
// The variable is set already, we're going to update it.
|
||||
//
|
||||
if (StrCmp (Udp6Service->MacString, NewMacString) != 0) {
|
||||
//
|
||||
// The MAC address is changed, delete the previous variable first.
|
||||
//
|
||||
gRT->SetVariable (
|
||||
Udp6Service->MacString,
|
||||
&gEfiUdp6ServiceBindingProtocolGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
0,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
FreePool (Udp6Service->MacString);
|
||||
}
|
||||
|
||||
Udp6Service->MacString = NewMacString;
|
||||
|
||||
Status = gRT->SetVariable (
|
||||
Udp6Service->MacString,
|
||||
&gEfiUdp6ServiceBindingProtocolGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
VariableDataSize,
|
||||
(VOID *) Udp6VariableData
|
||||
);
|
||||
|
||||
EXIT:
|
||||
|
||||
FreePool (Udp6VariableData);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Clear the variable and free the resource.
|
||||
|
||||
@param[in, out] Udp6Service Udp6 service data.
|
||||
|
||||
**/
|
||||
VOID
|
||||
Udp6ClearVariableData (
|
||||
IN OUT UDP6_SERVICE_DATA *Udp6Service
|
||||
)
|
||||
{
|
||||
ASSERT (Udp6Service->MacString != NULL);
|
||||
|
||||
gRT->SetVariable (
|
||||
Udp6Service->MacString,
|
||||
&gEfiUdp6ServiceBindingProtocolGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
0,
|
||||
NULL
|
||||
);
|
||||
|
||||
FreePool (Udp6Service->MacString);
|
||||
Udp6Service->MacString = NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
Find the key in the netmap.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Udp6 driver's whole implementation and internal data structures.
|
||||
|
||||
Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2009 - 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
|
||||
|
@ -79,8 +79,7 @@ typedef struct _UDP6_SERVICE_DATA {
|
|||
UINTN ChildrenNumber;
|
||||
IP_IO *IpIo;
|
||||
EFI_EVENT TimeoutEvent;
|
||||
CHAR16 *MacString;
|
||||
} UDP6_SERVICE_DATA;
|
||||
} UDP6_SERVICE_DATA;
|
||||
|
||||
typedef struct _UDP6_INSTANCE_DATA {
|
||||
UINT32 Signature;
|
||||
|
@ -145,22 +144,7 @@ Udp6CreateService (
|
|||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_HANDLE ControllerHandle
|
||||
);
|
||||
|
||||
/**
|
||||
Set the Udp6 variable data.
|
||||
|
||||
@param[in] Udp6Service Udp6 service data.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES There are not enough resources to set the
|
||||
variable.
|
||||
@retval other Set variable failed.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
Udp6SetVariableData (
|
||||
IN UDP6_SERVICE_DATA *Udp6Service
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
This function cleans the udp instance.
|
||||
|
||||
|
@ -171,18 +155,7 @@ VOID
|
|||
Udp6CleanInstance (
|
||||
IN OUT UDP6_INSTANCE_DATA *Instance
|
||||
);
|
||||
|
||||
/**
|
||||
Clear the variable and free the resource.
|
||||
|
||||
@param[in, out] Udp6Service Udp6 service data.
|
||||
|
||||
**/
|
||||
VOID
|
||||
Udp6ClearVariableData (
|
||||
IN OUT UDP6_SERVICE_DATA *Udp6Service
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
This function intializes the new created udp instance.
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Contains all EFI_UDP6_PROTOCOL interfaces.
|
||||
|
||||
Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2009 - 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
|
||||
|
@ -275,7 +275,7 @@ Udp6Configure (
|
|||
//
|
||||
// Cancel all the user tokens.
|
||||
//
|
||||
Status = Instance->Udp6Proto.Cancel (&Instance->Udp6Proto, NULL);
|
||||
Instance->Udp6Proto.Cancel (&Instance->Udp6Proto, NULL);
|
||||
|
||||
//
|
||||
// Remove the buffered RxData for this instance.
|
||||
|
@ -284,9 +284,7 @@ Udp6Configure (
|
|||
|
||||
ASSERT (IsListEmpty (&Instance->DeliveredDgramQue));
|
||||
}
|
||||
|
||||
Status = Udp6SetVariableData (Instance->Udp6Service);
|
||||
|
||||
|
||||
ON_EXIT:
|
||||
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
|
|
Loading…
Reference in New Issue