NetworkPkg: Apply uncrustify changes

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737

Apply uncrustify changes to .c/.h files in the NetworkPkg package

Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
This commit is contained in:
Michael Kubacki
2021-12-05 14:54:07 -08:00
committed by mergify[bot]
parent 2f88bd3a12
commit d1050b9dff
294 changed files with 29888 additions and 30440 deletions

View File

@@ -11,6 +11,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// EFI Component Name Functions
//
/**
Retrieves a Unicode string that is the user-readable name of the EFI Driver.
@@ -85,13 +86,12 @@ EFI_STATUS
EFIAPI
DnsComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
);
///
/// Component Name Protocol instance
///
@@ -107,8 +107,8 @@ EFI_COMPONENT_NAME_PROTOCOL gDnsComponentName = {
///
GLOBAL_REMOVE_IF_UNREFERENCED
EFI_COMPONENT_NAME2_PROTOCOL gDnsComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) DnsComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) DnsComponentNameGetControllerName,
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME)DnsComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)DnsComponentNameGetControllerName,
"en"
};
@@ -116,12 +116,12 @@ EFI_COMPONENT_NAME2_PROTOCOL gDnsComponentName2 = {
/// Table of driver names
///
GLOBAL_REMOVE_IF_UNREFERENCED
EFI_UNICODE_STRING_TABLE mDnsDriverNameTable[] = {
EFI_UNICODE_STRING_TABLE mDnsDriverNameTable[] = {
{ "eng;en", (CHAR16 *)L"DNS Network Service Driver" },
{ NULL, NULL }
{ NULL, NULL }
};
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE *gDnsControllerNameTable = NULL;
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE *gDnsControllerNameTable = NULL;
/**
Retrieves a Unicode string that is the user-readable name of the EFI Driver.
@@ -174,12 +174,12 @@ DnsComponentNameGetDriverName (
**/
EFI_STATUS
UpdateDns4Name (
EFI_DNS4_PROTOCOL *Dns4
EFI_DNS4_PROTOCOL *Dns4
)
{
EFI_STATUS Status;
CHAR16 HandleName[80];
EFI_DNS4_MODE_DATA ModeData;
EFI_STATUS Status;
CHAR16 HandleName[80];
EFI_DNS4_MODE_DATA ModeData;
if (Dns4 == NULL) {
return EFI_INVALID_PARAMETER;
@@ -208,6 +208,7 @@ UpdateDns4Name (
if (ModeData.DnsCacheList != NULL) {
FreePool (ModeData.DnsCacheList);
}
if (ModeData.DnsServerList != NULL) {
FreePool (ModeData.DnsServerList);
}
@@ -249,13 +250,13 @@ UpdateDns4Name (
**/
EFI_STATUS
UpdateDns6Name (
EFI_DNS6_PROTOCOL *Dns6
EFI_DNS6_PROTOCOL *Dns6
)
{
EFI_STATUS Status;
CHAR16 HandleName[128];
EFI_DNS6_MODE_DATA ModeData;
CHAR16 Address[sizeof"ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"];
EFI_STATUS Status;
CHAR16 HandleName[128];
EFI_DNS6_MODE_DATA ModeData;
CHAR16 Address[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"];
if (Dns6 == NULL) {
return EFI_INVALID_PARAMETER;
@@ -274,6 +275,7 @@ UpdateDns6Name (
if (EFI_ERROR (Status)) {
return Status;
}
UnicodeSPrint (
HandleName,
sizeof (HandleName),
@@ -285,6 +287,7 @@ UpdateDns6Name (
if (ModeData.DnsCacheList != NULL) {
FreePool (ModeData.DnsCacheList);
}
if (ModeData.DnsServerList != NULL) {
FreePool (ModeData.DnsServerList);
}
@@ -358,15 +361,15 @@ EFI_STATUS
EFIAPI
DnsComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
)
{
EFI_STATUS Status;
EFI_DNS4_PROTOCOL *Dns4;
EFI_DNS6_PROTOCOL *Dns6;
EFI_STATUS Status;
EFI_DNS4_PROTOCOL *Dns4;
EFI_DNS6_PROTOCOL *Dns6;
//
// ChildHandle must be NULL for a Device Driver

View File

@@ -19,22 +19,22 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
VOID
DnsInitSeedPacket (
OUT EFI_DHCP4_PACKET *Seed,
IN EFI_IP4_CONFIG2_INTERFACE_INFO *InterfaceInfo
OUT EFI_DHCP4_PACKET *Seed,
IN EFI_IP4_CONFIG2_INTERFACE_INFO *InterfaceInfo
)
{
EFI_DHCP4_HEADER *Header;
EFI_DHCP4_HEADER *Header;
//
// Get IfType and HwAddressSize from SNP mode data.
//
Seed->Size = sizeof (EFI_DHCP4_PACKET);
Seed->Length = sizeof (Seed->Dhcp4);
Header = &Seed->Dhcp4.Header;
Seed->Size = sizeof (EFI_DHCP4_PACKET);
Seed->Length = sizeof (Seed->Dhcp4);
Header = &Seed->Dhcp4.Header;
ZeroMem (Header, sizeof (EFI_DHCP4_HEADER));
Header->OpCode = DHCP4_OPCODE_REQUEST;
Header->HwType = InterfaceInfo->IfType;
Header->HwAddrLen = (UINT8) InterfaceInfo->HwAddressSize;
Header->OpCode = DHCP4_OPCODE_REQUEST;
Header->HwType = InterfaceInfo->IfType;
Header->HwAddrLen = (UINT8)InterfaceInfo->HwAddressSize;
CopyMem (Header->ClientHwAddr, &(InterfaceInfo->HwAddress), Header->HwAddrLen);
Seed->Dhcp4.Magik = DHCP4_MAGIC;
@@ -56,10 +56,10 @@ DhcpCommonNotify (
)
{
if ((Event == NULL) || (Context == NULL)) {
return ;
return;
}
*((BOOLEAN *) Context) = TRUE;
*((BOOLEAN *)Context) = TRUE;
}
/**
@@ -77,26 +77,26 @@ DhcpCommonNotify (
**/
EFI_STATUS
ParseDhcp4Ack (
IN EFI_DHCP4_PROTOCOL *Dhcp4,
IN EFI_DHCP4_PACKET *Packet,
IN DNS4_SERVER_INFOR *DnsServerInfor
IN EFI_DHCP4_PROTOCOL *Dhcp4,
IN EFI_DHCP4_PACKET *Packet,
IN DNS4_SERVER_INFOR *DnsServerInfor
)
{
EFI_STATUS Status;
UINT32 OptionCount;
EFI_DHCP4_PACKET_OPTION **OptionList;
UINT32 ServerCount;
EFI_IPv4_ADDRESS *ServerList;
UINT32 Index;
UINT32 Count;
EFI_STATUS Status;
UINT32 OptionCount;
EFI_DHCP4_PACKET_OPTION **OptionList;
UINT32 ServerCount;
EFI_IPv4_ADDRESS *ServerList;
UINT32 Index;
UINT32 Count;
ServerCount = 0;
ServerList = NULL;
ServerList = NULL;
OptionCount = 0;
OptionList = NULL;
Status = Dhcp4->Parse (Dhcp4, Packet, &OptionCount, OptionList);
Status = Dhcp4->Parse (Dhcp4, Packet, &OptionCount, OptionList);
if (Status != EFI_BUFFER_TOO_SMALL) {
return EFI_DEVICE_ERROR;
}
@@ -119,19 +119,18 @@ ParseDhcp4Ack (
// Get DNS server addresses
//
if (OptionList[Index]->OpCode == DHCP4_TAG_DNS_SERVER) {
if (((OptionList[Index]->Length & 0x3) != 0) || (OptionList[Index]->Length == 0)) {
Status = EFI_DEVICE_ERROR;
break;
}
ServerCount = OptionList[Index]->Length/4;
ServerList = AllocatePool (ServerCount * sizeof (EFI_IPv4_ADDRESS));
ServerList = AllocatePool (ServerCount * sizeof (EFI_IPv4_ADDRESS));
if (ServerList == NULL) {
return EFI_OUT_OF_RESOURCES;
}
for (Count=0; Count < ServerCount; Count++) {
for (Count = 0; Count < ServerCount; Count++) {
CopyMem (ServerList + Count, &OptionList[Index]->Data[4 * Count], sizeof (EFI_IPv4_ADDRESS));
}
@@ -167,25 +166,25 @@ ParseDhcp4Ack (
EFI_STATUS
EFIAPI
ParseDhcp6Ack (
IN EFI_DHCP6_PROTOCOL *This,
IN VOID *Context,
IN EFI_DHCP6_PACKET *Packet
IN EFI_DHCP6_PROTOCOL *This,
IN VOID *Context,
IN EFI_DHCP6_PACKET *Packet
)
{
EFI_STATUS Status;
UINT32 OptionCount;
EFI_DHCP6_PACKET_OPTION **OptionList;
DNS6_SERVER_INFOR *DnsServerInfor;
UINT32 ServerCount;
EFI_IPv6_ADDRESS *ServerList;
UINT32 Index;
UINT32 Count;
EFI_STATUS Status;
UINT32 OptionCount;
EFI_DHCP6_PACKET_OPTION **OptionList;
DNS6_SERVER_INFOR *DnsServerInfor;
UINT32 ServerCount;
EFI_IPv6_ADDRESS *ServerList;
UINT32 Index;
UINT32 Count;
OptionCount = 0;
ServerCount = 0;
ServerList = NULL;
Status = This->Parse (This, Packet, &OptionCount, NULL);
Status = This->Parse (This, Packet, &OptionCount, NULL);
if (Status != EFI_BUFFER_TOO_SMALL) {
return EFI_DEVICE_ERROR;
}
@@ -201,7 +200,7 @@ ParseDhcp6Ack (
return EFI_DEVICE_ERROR;
}
DnsServerInfor = (DNS6_SERVER_INFOR *) Context;
DnsServerInfor = (DNS6_SERVER_INFOR *)Context;
for (Index = 0; Index < OptionCount; Index++) {
OptionList[Index]->OpCode = NTOHS (OptionList[Index]->OpCode);
@@ -211,7 +210,6 @@ ParseDhcp6Ack (
// Get DNS server addresses from this reply packet.
//
if (OptionList[Index]->OpCode == DHCP6_TAG_DNS_SERVER) {
if (((OptionList[Index]->OpLen & 0xf) != 0) || (OptionList[Index]->OpLen == 0)) {
Status = EFI_DEVICE_ERROR;
gBS->FreePool (OptionList);
@@ -219,13 +217,13 @@ ParseDhcp6Ack (
}
ServerCount = OptionList[Index]->OpLen/16;
ServerList = AllocatePool (ServerCount * sizeof (EFI_IPv6_ADDRESS));
ServerList = AllocatePool (ServerCount * sizeof (EFI_IPv6_ADDRESS));
if (ServerList == NULL) {
gBS->FreePool (OptionList);
return EFI_OUT_OF_RESOURCES;
}
for (Count=0; Count < ServerCount; Count++) {
for (Count = 0; Count < ServerCount; Count++) {
CopyMem (ServerList + Count, &OptionList[Index]->Data[16 * Count], sizeof (EFI_IPv6_ADDRESS));
}
@@ -237,7 +235,6 @@ ParseDhcp6Ack (
gBS->FreePool (OptionList);
return Status;
}
/**
@@ -255,47 +252,47 @@ ParseDhcp6Ack (
**/
EFI_STATUS
GetDns4ServerFromDhcp4 (
IN DNS_INSTANCE *Instance,
OUT UINT32 *DnsServerCount,
OUT EFI_IPv4_ADDRESS **DnsServerList
IN DNS_INSTANCE *Instance,
OUT UINT32 *DnsServerCount,
OUT EFI_IPv4_ADDRESS **DnsServerList
)
{
EFI_STATUS Status;
EFI_HANDLE Image;
EFI_HANDLE Controller;
EFI_STATUS MediaStatus;
EFI_HANDLE MnpChildHandle;
EFI_MANAGED_NETWORK_PROTOCOL *Mnp;
EFI_MANAGED_NETWORK_CONFIG_DATA MnpConfigData;
EFI_HANDLE Dhcp4Handle;
EFI_DHCP4_PROTOCOL *Dhcp4;
EFI_IP4_CONFIG2_PROTOCOL *Ip4Config2;
UINTN DataSize;
VOID *Data;
EFI_IP4_CONFIG2_INTERFACE_INFO *InterfaceInfo;
EFI_DHCP4_PACKET SeedPacket;
EFI_DHCP4_PACKET_OPTION *ParaList[2];
DNS4_SERVER_INFOR DnsServerInfor;
EFI_STATUS Status;
EFI_HANDLE Image;
EFI_HANDLE Controller;
EFI_STATUS MediaStatus;
EFI_HANDLE MnpChildHandle;
EFI_MANAGED_NETWORK_PROTOCOL *Mnp;
EFI_MANAGED_NETWORK_CONFIG_DATA MnpConfigData;
EFI_HANDLE Dhcp4Handle;
EFI_DHCP4_PROTOCOL *Dhcp4;
EFI_IP4_CONFIG2_PROTOCOL *Ip4Config2;
UINTN DataSize;
VOID *Data;
EFI_IP4_CONFIG2_INTERFACE_INFO *InterfaceInfo;
EFI_DHCP4_PACKET SeedPacket;
EFI_DHCP4_PACKET_OPTION *ParaList[2];
DNS4_SERVER_INFOR DnsServerInfor;
EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN Token;
BOOLEAN IsDone;
UINTN Index;
EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN Token;
BOOLEAN IsDone;
UINTN Index;
Image = Instance->Service->ImageHandle;
Controller = Instance->Service->ControllerHandle;
Image = Instance->Service->ImageHandle;
Controller = Instance->Service->ControllerHandle;
MnpChildHandle = NULL;
Mnp = NULL;
MnpChildHandle = NULL;
Mnp = NULL;
Dhcp4Handle = NULL;
Dhcp4 = NULL;
Dhcp4Handle = NULL;
Dhcp4 = NULL;
Ip4Config2 = NULL;
DataSize = 0;
Data = NULL;
InterfaceInfo = NULL;
Ip4Config2 = NULL;
DataSize = 0;
Data = NULL;
InterfaceInfo = NULL;
ZeroMem ((UINT8 *) ParaList, sizeof (ParaList));
ZeroMem ((UINT8 *)ParaList, sizeof (ParaList));
ZeroMem (&MnpConfigData, sizeof (EFI_MANAGED_NETWORK_CONFIG_DATA));
@@ -332,7 +329,7 @@ GetDns4ServerFromDhcp4 (
Status = gBS->OpenProtocol (
MnpChildHandle,
&gEfiManagedNetworkProtocolGuid,
(VOID **) &Mnp,
(VOID **)&Mnp,
Image,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -352,7 +349,7 @@ GetDns4ServerFromDhcp4 (
MnpConfigData.EnableReceiveTimestamps = FALSE;
MnpConfigData.DisableBackgroundPolling = FALSE;
Status = Mnp->Configure(Mnp, &MnpConfigData);
Status = Mnp->Configure (Mnp, &MnpConfigData);
if (EFI_ERROR (Status)) {
goto ON_EXIT;
}
@@ -373,7 +370,7 @@ GetDns4ServerFromDhcp4 (
Status = gBS->OpenProtocol (
Dhcp4Handle,
&gEfiDhcp4ProtocolGuid,
(VOID **) &Dhcp4,
(VOID **)&Dhcp4,
Image,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -385,13 +382,13 @@ GetDns4ServerFromDhcp4 (
//
// Get Ip4Config2 instance info.
//
Status = gBS->HandleProtocol (Controller, &gEfiIp4Config2ProtocolGuid, (VOID **) &Ip4Config2);
Status = gBS->HandleProtocol (Controller, &gEfiIp4Config2ProtocolGuid, (VOID **)&Ip4Config2);
if (EFI_ERROR (Status)) {
goto ON_EXIT;
}
Status = Ip4Config2->GetData (Ip4Config2, Ip4Config2DataTypeInterfaceInfo, &DataSize, Data);
if (EFI_ERROR (Status) && Status != EFI_BUFFER_TOO_SMALL) {
if (EFI_ERROR (Status) && (Status != EFI_BUFFER_TOO_SMALL)) {
goto ON_EXIT;
}
@@ -470,7 +467,7 @@ GetDns4ServerFromDhcp4 (
Status = Dhcp4->Build (Dhcp4, &SeedPacket, 0, NULL, 2, ParaList, &Token.Packet);
Token.Packet->Dhcp4.Header.Xid = HTONL(NET_RANDOM (NetRandomInitSeed ()));
Token.Packet->Dhcp4.Header.Xid = HTONL (NET_RANDOM (NetRandomInitSeed ()));
Token.Packet->Dhcp4.Header.Reserved = HTONS ((UINT16)0x8000);
@@ -601,10 +598,10 @@ ON_EXIT:
**/
EFI_STATUS
GetDns6ServerFromDhcp6 (
IN EFI_HANDLE Image,
IN EFI_HANDLE Controller,
OUT UINT32 *DnsServerCount,
OUT EFI_IPv6_ADDRESS **DnsServerList
IN EFI_HANDLE Image,
IN EFI_HANDLE Controller,
OUT UINT32 *DnsServerCount,
OUT EFI_IPv6_ADDRESS **DnsServerList
)
{
EFI_HANDLE Dhcp6Handle;
@@ -651,7 +648,7 @@ GetDns6ServerFromDhcp6 (
Status = gBS->OpenProtocol (
Dhcp6Handle,
&gEfiDhcp6ProtocolGuid,
(VOID **) &Dhcp6,
(VOID **)&Dhcp6,
Image,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -724,7 +721,7 @@ GetDns6ServerFromDhcp6 (
} while (TimerStatus == EFI_NOT_READY);
}
*DnsServerList = DnsServerInfor.ServerList;
*DnsServerList = DnsServerInfor.ServerList;
ON_EXIT:
@@ -753,6 +750,4 @@ ON_EXIT:
);
return Status;
}

View File

@@ -14,39 +14,38 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
#pragma pack(1)
#define IP4_ETHER_PROTO 0x0800
#define IP4_ETHER_PROTO 0x0800
#define DHCP4_OPCODE_REQUEST 1
#define DHCP4_MAGIC 0x63538263 /// network byte order
#define DHCP4_TAG_EOP 255 /// End Option
#define DHCP4_OPCODE_REQUEST 1
#define DHCP4_MAGIC 0x63538263 /// network byte order
#define DHCP4_TAG_EOP 255 /// End Option
#define DHCP4_TAG_TYPE 53
#define DHCP4_MSG_REQUEST 3
#define DHCP4_MSG_INFORM 8
#define DHCP4_TAG_TYPE 53
#define DHCP4_MSG_REQUEST 3
#define DHCP4_MSG_INFORM 8
#define DHCP4_TAG_PARA_LIST 55
#define DHCP4_TAG_DNS_SERVER 6
#define DHCP4_TAG_PARA_LIST 55
#define DHCP4_TAG_DNS_SERVER 6
#define DHCP6_TAG_DNS_REQUEST 6
#define DHCP6_TAG_DNS_SERVER 23
#define DHCP6_TAG_DNS_REQUEST 6
#define DHCP6_TAG_DNS_SERVER 23
#define DNS_CHECK_MEDIA_GET_DHCP_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)
#define DNS_CHECK_MEDIA_GET_DHCP_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)
//
// The required Dns4 server information.
//
typedef struct {
UINT32 *ServerCount;
EFI_IPv4_ADDRESS *ServerList;
UINT32 *ServerCount;
EFI_IPv4_ADDRESS *ServerList;
} DNS4_SERVER_INFOR;
//
// The required Dns6 server information.
//
typedef struct {
UINT32 *ServerCount;
EFI_IPv6_ADDRESS *ServerList;
UINT32 *ServerCount;
EFI_IPv6_ADDRESS *ServerList;
} DNS6_SERVER_INFOR;
#pragma pack()
@@ -66,9 +65,9 @@ typedef struct {
**/
EFI_STATUS
ParseDhcp4Ack (
IN EFI_DHCP4_PROTOCOL *Dhcp4,
IN EFI_DHCP4_PACKET *Packet,
IN DNS4_SERVER_INFOR *DnsServerInfor
IN EFI_DHCP4_PROTOCOL *Dhcp4,
IN EFI_DHCP4_PACKET *Packet,
IN DNS4_SERVER_INFOR *DnsServerInfor
);
/**
@@ -91,9 +90,9 @@ ParseDhcp4Ack (
EFI_STATUS
EFIAPI
ParseDhcp6Ack (
IN EFI_DHCP6_PROTOCOL *This,
IN VOID *Context,
IN EFI_DHCP6_PACKET *Packet
IN EFI_DHCP6_PROTOCOL *This,
IN VOID *Context,
IN EFI_DHCP6_PACKET *Packet
);
/**
@@ -111,9 +110,9 @@ ParseDhcp6Ack (
**/
EFI_STATUS
GetDns4ServerFromDhcp4 (
IN DNS_INSTANCE *Instance,
OUT UINT32 *DnsServerCount,
OUT EFI_IPv4_ADDRESS **DnsServerList
IN DNS_INSTANCE *Instance,
OUT UINT32 *DnsServerCount,
OUT EFI_IPv4_ADDRESS **DnsServerList
);
/**
@@ -132,10 +131,10 @@ GetDns4ServerFromDhcp4 (
**/
EFI_STATUS
GetDns6ServerFromDhcp6 (
IN EFI_HANDLE Image,
IN EFI_HANDLE Controller,
OUT UINT32 *DnsServerCount,
OUT EFI_IPv6_ADDRESS **DnsServerList
IN EFI_HANDLE Image,
IN EFI_HANDLE Controller,
OUT UINT32 *DnsServerCount,
OUT EFI_IPv6_ADDRESS **DnsServerList
);
#endif

View File

@@ -8,7 +8,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "DnsImpl.h"
EFI_DRIVER_BINDING_PROTOCOL gDns4DriverBinding = {
EFI_DRIVER_BINDING_PROTOCOL gDns4DriverBinding = {
Dns4DriverBindingSupported,
Dns4DriverBindingStart,
Dns4DriverBindingStop,
@@ -17,7 +17,7 @@ EFI_DRIVER_BINDING_PROTOCOL gDns4DriverBinding = {
NULL
};
EFI_DRIVER_BINDING_PROTOCOL gDns6DriverBinding = {
EFI_DRIVER_BINDING_PROTOCOL gDns6DriverBinding = {
Dns6DriverBindingSupported,
Dns6DriverBindingStart,
Dns6DriverBindingStop,
@@ -26,17 +26,17 @@ EFI_DRIVER_BINDING_PROTOCOL gDns6DriverBinding = {
NULL
};
EFI_SERVICE_BINDING_PROTOCOL mDns4ServiceBinding = {
EFI_SERVICE_BINDING_PROTOCOL mDns4ServiceBinding = {
Dns4ServiceBindingCreateChild,
Dns4ServiceBindingDestroyChild
};
EFI_SERVICE_BINDING_PROTOCOL mDns6ServiceBinding = {
EFI_SERVICE_BINDING_PROTOCOL mDns6ServiceBinding = {
Dns6ServiceBindingCreateChild,
Dns6ServiceBindingDestroyChild
};
DNS_DRIVER_DATA *mDriverData = NULL;
DNS_DRIVER_DATA *mDriverData = NULL;
/**
Destroy the DNS instance and recycle the resources.
@@ -46,7 +46,7 @@ DNS_DRIVER_DATA *mDriverData = NULL;
**/
VOID
DnsDestroyInstance (
IN DNS_INSTANCE *Instance
IN DNS_INSTANCE *Instance
)
{
ZeroMem (&Instance->Dns4CfgData, sizeof (EFI_DNS4_CONFIG_DATA));
@@ -61,7 +61,7 @@ DnsDestroyInstance (
Dns6InstanceCancelToken (Instance, NULL);
}
if (Instance->UdpIo!= NULL) {
if (Instance->UdpIo != NULL) {
UdpIoFreeIo (Instance->UdpIo);
}
@@ -80,11 +80,11 @@ DnsDestroyInstance (
**/
EFI_STATUS
DnsCreateInstance (
IN DNS_SERVICE *Service,
OUT DNS_INSTANCE **Instance
IN DNS_SERVICE *Service,
OUT DNS_INSTANCE **Instance
)
{
DNS_INSTANCE *DnsIns;
DNS_INSTANCE *DnsIns;
*Instance = NULL;
@@ -137,8 +137,8 @@ DnsCreateInstance (
EFI_STATUS
EFIAPI
DnsDestroyChildEntryInHandleBuffer (
IN LIST_ENTRY *Entry,
IN VOID *Context
IN LIST_ENTRY *Entry,
IN VOID *Context
)
{
DNS_INSTANCE *Instance;
@@ -146,14 +146,14 @@ DnsDestroyChildEntryInHandleBuffer (
UINTN NumberOfChildren;
EFI_HANDLE *ChildHandleBuffer;
if (Entry == NULL || Context == NULL) {
if ((Entry == NULL) || (Context == NULL)) {
return EFI_INVALID_PARAMETER;
}
Instance = NET_LIST_USER_STRUCT_S (Entry, DNS_INSTANCE, Link, DNS_INSTANCE_SIGNATURE);
ServiceBinding = ((DNS_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->ServiceBinding;
NumberOfChildren = ((DNS_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->NumberOfChildren;
ChildHandleBuffer = ((DNS_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->ChildHandleBuffer;
Instance = NET_LIST_USER_STRUCT_S (Entry, DNS_INSTANCE, Link, DNS_INSTANCE_SIGNATURE);
ServiceBinding = ((DNS_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *)Context)->ServiceBinding;
NumberOfChildren = ((DNS_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *)Context)->NumberOfChildren;
ChildHandleBuffer = ((DNS_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *)Context)->ChildHandleBuffer;
if (!NetIsInHandleBuffer (Instance->ChildHandle, NumberOfChildren, ChildHandleBuffer)) {
return EFI_SUCCESS;
@@ -177,8 +177,8 @@ DnsDestroyChildEntryInHandleBuffer (
EFI_STATUS
EFIAPI
DnsConfigNullUdp (
IN UDP_IO *UdpIo,
IN VOID *Context
IN UDP_IO *UdpIo,
IN VOID *Context
)
{
return EFI_SUCCESS;
@@ -192,7 +192,7 @@ DnsConfigNullUdp (
**/
VOID
DnsDestroyService (
IN DNS_SERVICE *DnsSb
IN DNS_SERVICE *DnsSb
)
{
UdpIoFreeIo (DnsSb->ConnectUdp);
@@ -227,19 +227,19 @@ DnsDestroyService (
**/
EFI_STATUS
DnsCreateService (
IN EFI_HANDLE Controller,
IN EFI_HANDLE Image,
IN UINT8 IpVersion,
OUT DNS_SERVICE **Service
IN EFI_HANDLE Controller,
IN EFI_HANDLE Image,
IN UINT8 IpVersion,
OUT DNS_SERVICE **Service
)
{
EFI_STATUS Status;
DNS_SERVICE *DnsSb;
EFI_STATUS Status;
DNS_SERVICE *DnsSb;
Status = EFI_SUCCESS;
DnsSb = NULL;
Status = EFI_SUCCESS;
DnsSb = NULL;
*Service = NULL;
*Service = NULL;
DnsSb = AllocateZeroPool (sizeof (DNS_SERVICE));
if (DnsSb == NULL) {
@@ -263,11 +263,11 @@ DnsCreateService (
DnsSb->ControllerHandle = Controller;
DnsSb->ImageHandle = Image;
DnsSb->TimerToGetMap = NULL;
DnsSb->TimerToGetMap = NULL;
DnsSb->Timer = NULL;
DnsSb->Timer = NULL;
DnsSb->IpVersion = IpVersion;
DnsSb->IpVersion = IpVersion;
//
// Create the timer used to time out the procedure which is used to
@@ -299,6 +299,7 @@ DnsCreateService (
if (DnsSb->TimerToGetMap != NULL) {
gBS->CloseEvent (DnsSb->TimerToGetMap);
}
FreePool (DnsSb);
return Status;
}
@@ -315,6 +316,7 @@ DnsCreateService (
if (DnsSb->TimerToGetMap != NULL) {
gBS->CloseEvent (DnsSb->TimerToGetMap);
}
gBS->CloseEvent (DnsSb->Timer);
FreePool (DnsSb);
return EFI_DEVICE_ERROR;
@@ -341,11 +343,11 @@ DnsUnload (
{
EFI_STATUS Status;
LIST_ENTRY *Entry;
DNS4_CACHE *ItemCache4;
DNS4_SERVER_IP *ItemServerIp4;
DNS6_CACHE *ItemCache6;
DNS6_SERVER_IP *ItemServerIp6;
LIST_ENTRY *Entry;
DNS4_CACHE *ItemCache4;
DNS4_SERVER_IP *ItemServerIp4;
DNS6_CACHE *ItemCache6;
DNS6_SERVER_IP *ItemServerIp6;
ItemCache4 = NULL;
ItemServerIp4 = NULL;
@@ -355,7 +357,7 @@ DnsUnload (
//
// Disconnect the driver specified by ImageHandle
//
Status = NetLibDefaultUnload(ImageHandle);
Status = NetLibDefaultUnload (ImageHandle);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -493,25 +495,25 @@ DnsDriverEntryPoint (
return Status;
Error4:
gBS->CloseEvent (mDriverData->Timer);
Error4:
gBS->CloseEvent (mDriverData->Timer);
Error3:
FreePool (mDriverData);
Error3:
FreePool (mDriverData);
Error2:
EfiLibUninstallDriverBindingComponentName2 (
&gDns6DriverBinding,
&gDnsComponentName,
&gDnsComponentName2
);
Error2:
EfiLibUninstallDriverBindingComponentName2 (
&gDns6DriverBinding,
&gDnsComponentName,
&gDnsComponentName2
);
Error1:
EfiLibUninstallDriverBindingComponentName2 (
&gDns4DriverBinding,
&gDnsComponentName,
&gDnsComponentName2
);
Error1:
EfiLibUninstallDriverBindingComponentName2 (
&gDns4DriverBinding,
&gDnsComponentName,
&gDnsComponentName2
);
return Status;
}
@@ -641,8 +643,8 @@ Dns4DriverBindingStart (
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
)
{
DNS_SERVICE *DnsSb;
EFI_STATUS Status;
DNS_SERVICE *DnsSb;
EFI_STATUS Status;
Status = DnsCreateService (ControllerHandle, This->DriverBindingHandle, IP_VERSION_4, &DnsSb);
if (EFI_ERROR (Status)) {
@@ -712,12 +714,12 @@ Dns4DriverBindingStop (
IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
)
{
EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
DNS_SERVICE *DnsSb;
EFI_HANDLE NicHandle;
EFI_STATUS Status;
LIST_ENTRY *List;
DNS_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT Context;
EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
DNS_SERVICE *DnsSb;
EFI_HANDLE NicHandle;
EFI_STATUS Status;
LIST_ENTRY *List;
DNS_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT Context;
//
// DNS driver opens UDP child, So, Controller is a UDP
@@ -733,7 +735,7 @@ Dns4DriverBindingStop (
Status = gBS->OpenProtocol (
NicHandle,
&gEfiDns4ServiceBindingProtocolGuid,
(VOID **) &ServiceBinding,
(VOID **)&ServiceBinding,
This->DriverBindingHandle,
NicHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -748,19 +750,19 @@ Dns4DriverBindingStop (
//
// Destroy the Dns child instance in ChildHandleBuffer.
//
List = &DnsSb->Dns4ChildrenList;
List = &DnsSb->Dns4ChildrenList;
Context.ServiceBinding = ServiceBinding;
Context.NumberOfChildren = NumberOfChildren;
Context.ChildHandleBuffer = ChildHandleBuffer;
Status = NetDestroyLinkList (
List,
DnsDestroyChildEntryInHandleBuffer,
&Context,
NULL
);
Status = NetDestroyLinkList (
List,
DnsDestroyChildEntryInHandleBuffer,
&Context,
NULL
);
}
if (NumberOfChildren == 0 && IsListEmpty (&DnsSb->Dns4ChildrenList)) {
if ((NumberOfChildren == 0) && IsListEmpty (&DnsSb->Dns4ChildrenList)) {
gBS->UninstallProtocolInterface (
NicHandle,
&gEfiDns4ServiceBindingProtocolGuid,
@@ -905,8 +907,8 @@ Dns6DriverBindingStart (
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
)
{
DNS_SERVICE *DnsSb;
EFI_STATUS Status;
DNS_SERVICE *DnsSb;
EFI_STATUS Status;
Status = DnsCreateService (ControllerHandle, This->DriverBindingHandle, IP_VERSION_6, &DnsSb);
if (EFI_ERROR (Status)) {
@@ -977,12 +979,12 @@ Dns6DriverBindingStop (
IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
)
{
EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
DNS_SERVICE *DnsSb;
EFI_HANDLE NicHandle;
EFI_STATUS Status;
LIST_ENTRY *List;
DNS_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT Context;
EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
DNS_SERVICE *DnsSb;
EFI_HANDLE NicHandle;
EFI_STATUS Status;
LIST_ENTRY *List;
DNS_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT Context;
//
// DNS driver opens UDP child, So, Controller is a UDP
@@ -998,7 +1000,7 @@ Dns6DriverBindingStop (
Status = gBS->OpenProtocol (
NicHandle,
&gEfiDns6ServiceBindingProtocolGuid,
(VOID **) &ServiceBinding,
(VOID **)&ServiceBinding,
This->DriverBindingHandle,
NicHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -1013,19 +1015,19 @@ Dns6DriverBindingStop (
//
// Destroy the Dns child instance in ChildHandleBuffer.
//
List = &DnsSb->Dns6ChildrenList;
List = &DnsSb->Dns6ChildrenList;
Context.ServiceBinding = ServiceBinding;
Context.NumberOfChildren = NumberOfChildren;
Context.ChildHandleBuffer = ChildHandleBuffer;
Status = NetDestroyLinkList (
List,
DnsDestroyChildEntryInHandleBuffer,
&Context,
NULL
);
Status = NetDestroyLinkList (
List,
DnsDestroyChildEntryInHandleBuffer,
&Context,
NULL
);
}
if (NumberOfChildren == 0 && IsListEmpty (&DnsSb->Dns6ChildrenList)) {
if ((NumberOfChildren == 0) && IsListEmpty (&DnsSb->Dns6ChildrenList)) {
gBS->UninstallProtocolInterface (
NicHandle,
&gEfiDns6ServiceBindingProtocolGuid,
@@ -1071,11 +1073,11 @@ Dns4ServiceBindingCreateChild (
IN EFI_HANDLE *ChildHandle
)
{
DNS_SERVICE *DnsSb;
DNS_INSTANCE *Instance;
EFI_STATUS Status;
EFI_TPL OldTpl;
VOID *Udp4;
DNS_SERVICE *DnsSb;
DNS_INSTANCE *Instance;
EFI_STATUS Status;
EFI_TPL OldTpl;
VOID *Udp4;
if ((This == NULL) || (ChildHandle == NULL)) {
return EFI_INVALID_PARAMETER;
@@ -1087,6 +1089,7 @@ Dns4ServiceBindingCreateChild (
if (EFI_ERROR (Status)) {
return Status;
}
ASSERT (Instance != NULL);
//
@@ -1110,7 +1113,7 @@ Dns4ServiceBindingCreateChild (
Status = gBS->OpenProtocol (
DnsSb->ConnectUdp->UdpHandle,
&gEfiUdp4ProtocolGuid,
(VOID **) &Udp4,
(VOID **)&Udp4,
gDns4DriverBinding.DriverBindingHandle,
Instance->ChildHandle,
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
@@ -1132,7 +1135,7 @@ Dns4ServiceBindingCreateChild (
Status = gBS->OpenProtocol (
Instance->UdpIo->UdpHandle,
&gEfiUdp4ProtocolGuid,
(VOID **) &Udp4,
(VOID **)&Udp4,
gDns4DriverBinding.DriverBindingHandle,
Instance->ChildHandle,
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
@@ -1148,12 +1151,12 @@ Dns4ServiceBindingCreateChild (
*ChildHandle
);
gBS->UninstallMultipleProtocolInterfaces (
Instance->ChildHandle,
&gEfiDns4ProtocolGuid,
&Instance->Dns4,
NULL
);
gBS->UninstallMultipleProtocolInterfaces (
Instance->ChildHandle,
&gEfiDns4ProtocolGuid,
&Instance->Dns4,
NULL
);
goto ON_ERROR;
}
@@ -1201,12 +1204,12 @@ Dns4ServiceBindingDestroyChild (
IN EFI_HANDLE ChildHandle
)
{
DNS_SERVICE *DnsSb;
DNS_INSTANCE *Instance;
DNS_SERVICE *DnsSb;
DNS_INSTANCE *Instance;
EFI_DNS4_PROTOCOL *Dns4;
EFI_STATUS Status;
EFI_TPL OldTpl;
EFI_DNS4_PROTOCOL *Dns4;
EFI_STATUS Status;
EFI_TPL OldTpl;
if ((This == NULL) || (ChildHandle == NULL)) {
return EFI_INVALID_PARAMETER;
@@ -1218,7 +1221,7 @@ Dns4ServiceBindingDestroyChild (
Status = gBS->OpenProtocol (
ChildHandle,
&gEfiDns4ProtocolGuid,
(VOID **) &Dns4,
(VOID **)&Dns4,
gDns4DriverBinding.DriverBindingHandle,
ChildHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -1228,8 +1231,8 @@ Dns4ServiceBindingDestroyChild (
return EFI_UNSUPPORTED;
}
Instance = DNS_INSTANCE_FROM_THIS_PROTOCOL4 (Dns4);
DnsSb = DNS_SERVICE_FROM_THIS (This);
Instance = DNS_INSTANCE_FROM_THIS_PROTOCOL4 (Dns4);
DnsSb = DNS_SERVICE_FROM_THIS (This);
if (Instance->Service != DnsSb) {
return EFI_INVALID_PARAMETER;
@@ -1314,11 +1317,11 @@ Dns6ServiceBindingCreateChild (
IN EFI_HANDLE *ChildHandle
)
{
DNS_SERVICE *DnsSb;
DNS_INSTANCE *Instance;
EFI_STATUS Status;
EFI_TPL OldTpl;
VOID *Udp6;
DNS_SERVICE *DnsSb;
DNS_INSTANCE *Instance;
EFI_STATUS Status;
EFI_TPL OldTpl;
VOID *Udp6;
if ((This == NULL) || (ChildHandle == NULL)) {
return EFI_INVALID_PARAMETER;
@@ -1330,6 +1333,7 @@ Dns6ServiceBindingCreateChild (
if (EFI_ERROR (Status)) {
return Status;
}
ASSERT (Instance != NULL);
//
@@ -1353,7 +1357,7 @@ Dns6ServiceBindingCreateChild (
Status = gBS->OpenProtocol (
DnsSb->ConnectUdp->UdpHandle,
&gEfiUdp6ProtocolGuid,
(VOID **) &Udp6,
(VOID **)&Udp6,
gDns6DriverBinding.DriverBindingHandle,
Instance->ChildHandle,
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
@@ -1375,7 +1379,7 @@ Dns6ServiceBindingCreateChild (
Status = gBS->OpenProtocol (
Instance->UdpIo->UdpHandle,
&gEfiUdp6ProtocolGuid,
(VOID **) &Udp6,
(VOID **)&Udp6,
gDns6DriverBinding.DriverBindingHandle,
Instance->ChildHandle,
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
@@ -1391,12 +1395,12 @@ Dns6ServiceBindingCreateChild (
*ChildHandle
);
gBS->UninstallMultipleProtocolInterfaces (
Instance->ChildHandle,
&gEfiDns6ProtocolGuid,
&Instance->Dns6,
NULL
);
gBS->UninstallMultipleProtocolInterfaces (
Instance->ChildHandle,
&gEfiDns6ProtocolGuid,
&Instance->Dns6,
NULL
);
goto ON_ERROR;
}
@@ -1444,12 +1448,12 @@ Dns6ServiceBindingDestroyChild (
IN EFI_HANDLE ChildHandle
)
{
DNS_SERVICE *DnsSb;
DNS_INSTANCE *Instance;
DNS_SERVICE *DnsSb;
DNS_INSTANCE *Instance;
EFI_DNS6_PROTOCOL *Dns6;
EFI_STATUS Status;
EFI_TPL OldTpl;
EFI_DNS6_PROTOCOL *Dns6;
EFI_STATUS Status;
EFI_TPL OldTpl;
if ((This == NULL) || (ChildHandle == NULL)) {
return EFI_INVALID_PARAMETER;
@@ -1461,7 +1465,7 @@ Dns6ServiceBindingDestroyChild (
Status = gBS->OpenProtocol (
ChildHandle,
&gEfiDns6ProtocolGuid,
(VOID **) &Dns6,
(VOID **)&Dns6,
gDns6DriverBinding.DriverBindingHandle,
ChildHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -1471,8 +1475,8 @@ Dns6ServiceBindingDestroyChild (
return EFI_UNSUPPORTED;
}
Instance = DNS_INSTANCE_FROM_THIS_PROTOCOL6 (Dns6);
DnsSb = DNS_SERVICE_FROM_THIS (This);
Instance = DNS_INSTANCE_FROM_THIS_PROTOCOL6 (Dns6);
DnsSb = DNS_SERVICE_FROM_THIS (This);
if (Instance->Service != DnsSb) {
return EFI_INVALID_PARAMETER;

View File

@@ -15,84 +15,84 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
///
/// Dns service block
///
typedef struct _DNS_DRIVER_DATA DNS_DRIVER_DATA;
typedef struct _DNS_DRIVER_DATA DNS_DRIVER_DATA;
///
/// Dns service block
///
typedef struct _DNS_SERVICE DNS_SERVICE;
typedef struct _DNS_SERVICE DNS_SERVICE;
///
/// Dns instance block
///
typedef struct _DNS_INSTANCE DNS_INSTANCE;
#define DNS_SERVICE_SIGNATURE SIGNATURE_32 ('D', 'N', 'S', 'S')
#define DNS_SERVICE_SIGNATURE SIGNATURE_32 ('D', 'N', 'S', 'S')
#define DNS_INSTANCE_SIGNATURE SIGNATURE_32 ('D', 'N', 'S', 'I')
#define DNS_INSTANCE_SIGNATURE SIGNATURE_32 ('D', 'N', 'S', 'I')
struct _DNS_DRIVER_DATA {
EFI_EVENT Timer; /// Ticking timer for DNS cache update.
EFI_EVENT Timer; /// Ticking timer for DNS cache update.
LIST_ENTRY Dns4CacheList;
LIST_ENTRY Dns4ServerList;
LIST_ENTRY Dns4CacheList;
LIST_ENTRY Dns4ServerList;
LIST_ENTRY Dns6CacheList;
LIST_ENTRY Dns6ServerList;
LIST_ENTRY Dns6CacheList;
LIST_ENTRY Dns6ServerList;
};
struct _DNS_SERVICE {
UINT32 Signature;
EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
UINT32 Signature;
EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
UINT16 Dns4ChildrenNum;
LIST_ENTRY Dns4ChildrenList;
UINT16 Dns4ChildrenNum;
LIST_ENTRY Dns4ChildrenList;
UINT16 Dns6ChildrenNum;
LIST_ENTRY Dns6ChildrenList;
UINT16 Dns6ChildrenNum;
LIST_ENTRY Dns6ChildrenList;
EFI_HANDLE ControllerHandle;
EFI_HANDLE ImageHandle;
EFI_HANDLE ControllerHandle;
EFI_HANDLE ImageHandle;
EFI_EVENT TimerToGetMap;
EFI_EVENT TimerToGetMap;
EFI_EVENT Timer; /// Ticking timer for packet retransmission.
EFI_EVENT Timer; /// Ticking timer for packet retransmission.
UINT8 IpVersion;
UDP_IO *ConnectUdp;
UINT8 IpVersion;
UDP_IO *ConnectUdp;
};
struct _DNS_INSTANCE {
UINT32 Signature;
LIST_ENTRY Link;
UINT32 Signature;
LIST_ENTRY Link;
EFI_DNS4_PROTOCOL Dns4;
EFI_DNS6_PROTOCOL Dns6;
EFI_DNS4_PROTOCOL Dns4;
EFI_DNS6_PROTOCOL Dns6;
INTN State;
BOOLEAN InDestroy;
INTN State;
BOOLEAN InDestroy;
DNS_SERVICE *Service;
EFI_HANDLE ChildHandle;
DNS_SERVICE *Service;
EFI_HANDLE ChildHandle;
EFI_DNS4_CONFIG_DATA Dns4CfgData;
EFI_DNS6_CONFIG_DATA Dns6CfgData;
EFI_DNS4_CONFIG_DATA Dns4CfgData;
EFI_DNS6_CONFIG_DATA Dns6CfgData;
EFI_IP_ADDRESS SessionDnsServer;
EFI_IP_ADDRESS SessionDnsServer;
NET_MAP Dns4TxTokens;
NET_MAP Dns6TxTokens;
NET_MAP Dns4TxTokens;
NET_MAP Dns6TxTokens;
UDP_IO *UdpIo;
UDP_IO *UdpIo;
};
typedef struct {
EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
UINTN NumberOfChildren;
EFI_HANDLE *ChildHandleBuffer;
EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
UINTN NumberOfChildren;
EFI_HANDLE *ChildHandleBuffer;
} DNS_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT;
extern DNS_DRIVER_DATA *mDriverData;
extern DNS_DRIVER_DATA *mDriverData;
#define DNS_SERVICE_FROM_THIS(a) \
CR (a, DNS_SERVICE, ServiceBinding, DNS_SERVICE_SIGNATURE)
@@ -103,7 +103,6 @@ extern DNS_DRIVER_DATA *mDriverData;
#define DNS_INSTANCE_FROM_THIS_PROTOCOL6(a) \
CR (a, DNS_INSTANCE, Dns6, DNS_INSTANCE_SIGNATURE)
/**
Destroy the DNS instance and recycle the resources.
@@ -112,7 +111,7 @@ extern DNS_DRIVER_DATA *mDriverData;
**/
VOID
DnsDestroyInstance (
IN DNS_INSTANCE *Instance
IN DNS_INSTANCE *Instance
);
/**
@@ -127,8 +126,8 @@ DnsDestroyInstance (
**/
EFI_STATUS
DnsCreateInstance (
IN DNS_SERVICE *Service,
OUT DNS_INSTANCE **Instance
IN DNS_SERVICE *Service,
OUT DNS_INSTANCE **Instance
);
/**
@@ -144,8 +143,8 @@ DnsCreateInstance (
EFI_STATUS
EFIAPI
DnsDestroyChildEntryInHandleBuffer (
IN LIST_ENTRY *Entry,
IN VOID *Context
IN LIST_ENTRY *Entry,
IN VOID *Context
);
/**
@@ -163,8 +162,8 @@ DnsDestroyChildEntryInHandleBuffer (
EFI_STATUS
EFIAPI
DnsConfigNullUdp (
IN UDP_IO *UdpIo,
IN VOID *Context
IN UDP_IO *UdpIo,
IN VOID *Context
);
/**
@@ -175,7 +174,7 @@ DnsConfigNullUdp (
**/
VOID
DnsDestroyService (
IN DNS_SERVICE *DnsSb
IN DNS_SERVICE *DnsSb
);
/**
@@ -197,10 +196,10 @@ DnsDestroyService (
**/
EFI_STATUS
DnsCreateService (
IN EFI_HANDLE Controller,
IN EFI_HANDLE Image,
IN UINT8 IpVersion,
OUT DNS_SERVICE **Service
IN EFI_HANDLE Controller,
IN EFI_HANDLE Image,
IN UINT8 IpVersion,
OUT DNS_SERVICE **Service
);
/**
@@ -594,5 +593,4 @@ Dns6ServiceBindingDestroyChild (
IN EFI_HANDLE ChildHandle
);
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -70,110 +70,109 @@ extern EFI_DNS6_PROTOCOL mDns6Protocol;
//
// DNS related
//
#define DNS_SERVER_PORT 53
#define DNS_SERVER_PORT 53
#define DNS_PROTOCOL_UDP EFI_IP_PROTO_UDP
#define DNS_PROTOCOL_TCP EFI_IP_PROTO_TCP
#define DNS_PROTOCOL_UDP EFI_IP_PROTO_UDP
#define DNS_PROTOCOL_TCP EFI_IP_PROTO_TCP
#define DNS_STATE_UNCONFIGED 0
#define DNS_STATE_CONFIGED 1
#define DNS_STATE_DESTROY 2
#define DNS_STATE_UNCONFIGED 0
#define DNS_STATE_CONFIGED 1
#define DNS_STATE_DESTROY 2
#define DNS_DEFAULT_TIMEOUT 2
#define DNS_DEFAULT_TIMEOUT 2
#define DNS_TIME_TO_GETMAP 5
#define DNS_TIME_TO_GETMAP 5
#pragma pack(1)
typedef union _DNS_FLAGS DNS_FLAGS;
typedef union _DNS_FLAGS DNS_FLAGS;
typedef struct {
LIST_ENTRY AllCacheLink;
EFI_DNS4_CACHE_ENTRY DnsCache;
LIST_ENTRY AllCacheLink;
EFI_DNS4_CACHE_ENTRY DnsCache;
} DNS4_CACHE;
typedef struct {
LIST_ENTRY AllCacheLink;
EFI_DNS6_CACHE_ENTRY DnsCache;
LIST_ENTRY AllCacheLink;
EFI_DNS6_CACHE_ENTRY DnsCache;
} DNS6_CACHE;
typedef struct {
LIST_ENTRY AllServerLink;
EFI_IPv4_ADDRESS Dns4ServerIp;
LIST_ENTRY AllServerLink;
EFI_IPv4_ADDRESS Dns4ServerIp;
} DNS4_SERVER_IP;
typedef struct {
LIST_ENTRY AllServerLink;
EFI_IPv6_ADDRESS Dns6ServerIp;
LIST_ENTRY AllServerLink;
EFI_IPv6_ADDRESS Dns6ServerIp;
} DNS6_SERVER_IP;
typedef struct {
UINT32 RetryCounting;
UINT32 PacketToLive;
CHAR16 *QueryHostName;
EFI_IPv4_ADDRESS QueryIpAddress;
BOOLEAN GeneralLookUp;
EFI_DNS4_COMPLETION_TOKEN *Token;
UINT32 RetryCounting;
UINT32 PacketToLive;
CHAR16 *QueryHostName;
EFI_IPv4_ADDRESS QueryIpAddress;
BOOLEAN GeneralLookUp;
EFI_DNS4_COMPLETION_TOKEN *Token;
} DNS4_TOKEN_ENTRY;
typedef struct {
UINT32 RetryCounting;
UINT32 PacketToLive;
CHAR16 *QueryHostName;
EFI_IPv6_ADDRESS QueryIpAddress;
BOOLEAN GeneralLookUp;
EFI_DNS6_COMPLETION_TOKEN *Token;
UINT32 RetryCounting;
UINT32 PacketToLive;
CHAR16 *QueryHostName;
EFI_IPv6_ADDRESS QueryIpAddress;
BOOLEAN GeneralLookUp;
EFI_DNS6_COMPLETION_TOKEN *Token;
} DNS6_TOKEN_ENTRY;
union _DNS_FLAGS {
struct {
UINT16 RCode:4;
UINT16 Zero:3;
UINT16 RA:1;
UINT16 RD:1;
UINT16 TC:1;
UINT16 AA:1;
UINT16 OpCode:4;
UINT16 QR:1;
UINT16 RCode : 4;
UINT16 Zero : 3;
UINT16 RA : 1;
UINT16 RD : 1;
UINT16 TC : 1;
UINT16 AA : 1;
UINT16 OpCode : 4;
UINT16 QR : 1;
} Bits;
UINT16 Uint16;
UINT16 Uint16;
};
#define DNS_FLAGS_QR_QUERY 0
#define DNS_FLAGS_QR_RESPONSE 1
#define DNS_FLAGS_OPCODE_STANDARD 0
#define DNS_FLAGS_OPCODE_INVERSE 1
#define DNS_FLAGS_OPCODE_SERVER_STATE 2
#define DNS_FLAGS_OPCODE_STANDARD 0
#define DNS_FLAGS_OPCODE_INVERSE 1
#define DNS_FLAGS_OPCODE_SERVER_STATE 2
#define DNS_FLAGS_RCODE_NO_ERROR 0
#define DNS_FLAGS_RCODE_NAME_ERROR 3
typedef struct {
UINT16 Identification;
DNS_FLAGS Flags;
UINT16 QuestionsNum;
UINT16 AnswersNum;
UINT16 AuthorityNum;
UINT16 AditionalNum;
UINT16 Identification;
DNS_FLAGS Flags;
UINT16 QuestionsNum;
UINT16 AnswersNum;
UINT16 AuthorityNum;
UINT16 AditionalNum;
} DNS_HEADER;
typedef struct {
UINT16 Type;
UINT16 Class;
UINT16 Type;
UINT16 Class;
} DNS_QUERY_SECTION;
typedef struct {
UINT16 Type;
UINT16 Class;
UINT32 Ttl;
UINT16 DataLength;
UINT16 Type;
UINT16 Class;
UINT32 Ttl;
UINT16 DataLength;
} DNS_ANSWER_SECTION;
#define DNS4_DOMAIN L"in-addr.arpa"
#define DNS6_DOMAIN L"IP6.ARPA"
#pragma pack()
/**
@@ -188,8 +187,8 @@ typedef struct {
**/
EFI_STATUS
Dns4RemoveTokenEntry (
IN NET_MAP *TokenMap,
IN DNS4_TOKEN_ENTRY *TokenEntry
IN NET_MAP *TokenMap,
IN DNS4_TOKEN_ENTRY *TokenEntry
);
/**
@@ -204,8 +203,8 @@ Dns4RemoveTokenEntry (
**/
EFI_STATUS
Dns6RemoveTokenEntry (
IN NET_MAP *TokenMap,
IN DNS6_TOKEN_ENTRY *TokenEntry
IN NET_MAP *TokenMap,
IN DNS6_TOKEN_ENTRY *TokenEntry
);
/**
@@ -270,9 +269,9 @@ Dns6CancelTokens (
EFI_STATUS
EFIAPI
GetDns4TokenEntry (
IN NET_MAP *TokensMap,
IN EFI_DNS4_COMPLETION_TOKEN *Token,
OUT DNS4_TOKEN_ENTRY **TokenEntry
IN NET_MAP *TokensMap,
IN EFI_DNS4_COMPLETION_TOKEN *Token,
OUT DNS4_TOKEN_ENTRY **TokenEntry
);
/**
@@ -289,9 +288,9 @@ GetDns4TokenEntry (
EFI_STATUS
EFIAPI
GetDns6TokenEntry (
IN NET_MAP *TokensMap,
IN EFI_DNS6_COMPLETION_TOKEN *Token,
OUT DNS6_TOKEN_ENTRY **TokenEntry
IN NET_MAP *TokensMap,
IN EFI_DNS6_COMPLETION_TOKEN *Token,
OUT DNS6_TOKEN_ENTRY **TokenEntry
);
/**
@@ -395,7 +394,7 @@ Dns6CopyConfigure (
VOID
EFIAPI
DnsDummyExtFree (
IN VOID *Arg
IN VOID *Arg
);
/**
@@ -415,9 +414,9 @@ DnsDummyExtFree (
**/
BOOLEAN
Dns4GetMapping (
IN DNS_INSTANCE *Instance,
IN UDP_IO *UdpIo,
IN EFI_UDP4_CONFIG_DATA *UdpCfgData
IN DNS_INSTANCE *Instance,
IN UDP_IO *UdpIo,
IN EFI_UDP4_CONFIG_DATA *UdpCfgData
);
/**
@@ -434,9 +433,9 @@ Dns4GetMapping (
**/
BOOLEAN
Dns6GetMapping (
IN DNS_INSTANCE *Instance,
IN UDP_IO *UdpIo,
IN EFI_UDP6_CONFIG_DATA *UdpCfgData
IN DNS_INSTANCE *Instance,
IN UDP_IO *UdpIo,
IN EFI_UDP6_CONFIG_DATA *UdpCfgData
);
/**
@@ -451,8 +450,8 @@ Dns6GetMapping (
**/
EFI_STATUS
Dns4ConfigUdp (
IN DNS_INSTANCE *Instance,
IN UDP_IO *UdpIo
IN DNS_INSTANCE *Instance,
IN UDP_IO *UdpIo
);
/**
@@ -467,8 +466,8 @@ Dns4ConfigUdp (
**/
EFI_STATUS
Dns6ConfigUdp (
IN DNS_INSTANCE *Instance,
IN UDP_IO *UdpIo
IN DNS_INSTANCE *Instance,
IN UDP_IO *UdpIo
);
/**
@@ -488,10 +487,10 @@ Dns6ConfigUdp (
EFI_STATUS
EFIAPI
UpdateDns4Cache (
IN LIST_ENTRY *Dns4CacheList,
IN BOOLEAN DeleteFlag,
IN BOOLEAN Override,
IN EFI_DNS4_CACHE_ENTRY DnsCacheEntry
IN LIST_ENTRY *Dns4CacheList,
IN BOOLEAN DeleteFlag,
IN BOOLEAN Override,
IN EFI_DNS4_CACHE_ENTRY DnsCacheEntry
);
/**
@@ -510,10 +509,10 @@ UpdateDns4Cache (
EFI_STATUS
EFIAPI
UpdateDns6Cache (
IN LIST_ENTRY *Dns6CacheList,
IN BOOLEAN DeleteFlag,
IN BOOLEAN Override,
IN EFI_DNS6_CACHE_ENTRY DnsCacheEntry
IN LIST_ENTRY *Dns6CacheList,
IN BOOLEAN DeleteFlag,
IN BOOLEAN Override,
IN EFI_DNS6_CACHE_ENTRY DnsCacheEntry
);
/**
@@ -529,8 +528,8 @@ UpdateDns6Cache (
EFI_STATUS
EFIAPI
AddDns4ServerIp (
IN LIST_ENTRY *Dns4ServerList,
IN EFI_IPv4_ADDRESS ServerIp
IN LIST_ENTRY *Dns4ServerList,
IN EFI_IPv4_ADDRESS ServerIp
);
/**
@@ -546,8 +545,8 @@ AddDns4ServerIp (
EFI_STATUS
EFIAPI
AddDns6ServerIp (
IN LIST_ENTRY *Dns6ServerList,
IN EFI_IPv6_ADDRESS ServerIp
IN LIST_ENTRY *Dns6ServerList,
IN EFI_IPv6_ADDRESS ServerIp
);
/**
@@ -565,11 +564,11 @@ AddDns6ServerIp (
**/
BOOLEAN
IsValidDnsResponse (
IN NET_MAP *TokensMap,
IN UINT16 Identification,
IN UINT16 Type,
IN UINT16 Class,
OUT NET_MAP_ITEM **Item
IN NET_MAP *TokensMap,
IN UINT16 Identification,
IN UINT16 Type,
IN UINT16 Class,
OUT NET_MAP_ITEM **Item
);
/**
@@ -586,10 +585,10 @@ IsValidDnsResponse (
**/
EFI_STATUS
ParseDnsResponse (
IN OUT DNS_INSTANCE *Instance,
IN UINT8 *RxString,
IN UINT32 Length,
OUT BOOLEAN *Completed
IN OUT DNS_INSTANCE *Instance,
IN UINT8 *RxString,
IN UINT32 Length,
OUT BOOLEAN *Completed
);
/**
@@ -604,10 +603,10 @@ ParseDnsResponse (
VOID
EFIAPI
DnsOnPacketReceived (
NET_BUF *Packet,
UDP_END_POINT *EndPoint,
EFI_STATUS IoStatus,
VOID *Context
NET_BUF *Packet,
UDP_END_POINT *EndPoint,
EFI_STATUS IoStatus,
VOID *Context
);
/**
@@ -622,10 +621,10 @@ DnsOnPacketReceived (
VOID
EFIAPI
DnsOnPacketSent (
NET_BUF *Packet,
UDP_END_POINT *EndPoint,
EFI_STATUS IoStatus,
VOID *Context
NET_BUF *Packet,
UDP_END_POINT *EndPoint,
EFI_STATUS IoStatus,
VOID *Context
);
/**
@@ -640,8 +639,8 @@ DnsOnPacketSent (
**/
EFI_STATUS
DoDnsQuery (
IN DNS_INSTANCE *Instance,
IN NET_BUF *Packet
IN DNS_INSTANCE *Instance,
IN NET_BUF *Packet
);
/**
@@ -659,11 +658,11 @@ DoDnsQuery (
**/
EFI_STATUS
ConstructDNSQuery (
IN DNS_INSTANCE *Instance,
IN CHAR8 *QueryName,
IN UINT16 Type,
IN UINT16 Class,
OUT NET_BUF **Packet
IN DNS_INSTANCE *Instance,
IN CHAR8 *QueryName,
IN UINT16 Type,
IN UINT16 Class,
OUT NET_BUF **Packet
);
/**
@@ -678,8 +677,8 @@ ConstructDNSQuery (
**/
EFI_STATUS
DnsRetransmit (
IN DNS_INSTANCE *Instance,
IN NET_BUF *Packet
IN DNS_INSTANCE *Instance,
IN NET_BUF *Packet
);
/**
@@ -692,8 +691,8 @@ DnsRetransmit (
VOID
EFIAPI
DnsOnTimerRetransmit (
IN EFI_EVENT Event,
IN VOID *Context
IN EFI_EVENT Event,
IN VOID *Context
);
/**
@@ -706,11 +705,10 @@ DnsOnTimerRetransmit (
VOID
EFIAPI
DnsOnTimerUpdate (
IN EFI_EVENT Event,
IN VOID *Context
IN EFI_EVENT Event,
IN VOID *Context
);
/**
Retrieve mode data of this DNS instance.
@@ -729,8 +727,8 @@ DnsOnTimerUpdate (
EFI_STATUS
EFIAPI
Dns4GetModeData (
IN EFI_DNS4_PROTOCOL *This,
OUT EFI_DNS4_MODE_DATA *DnsModeData
IN EFI_DNS4_PROTOCOL *This,
OUT EFI_DNS4_MODE_DATA *DnsModeData
);
/**
@@ -761,8 +759,8 @@ Dns4GetModeData (
EFI_STATUS
EFIAPI
Dns4Configure (
IN EFI_DNS4_PROTOCOL *This,
IN EFI_DNS4_CONFIG_DATA *DnsConfigData
IN EFI_DNS4_PROTOCOL *This,
IN EFI_DNS4_CONFIG_DATA *DnsConfigData
);
/**
@@ -789,7 +787,7 @@ EFI_STATUS
EFIAPI
Dns4HostNameToIp (
IN EFI_DNS4_PROTOCOL *This,
IN CHAR16 *HostName,
IN CHAR16 *HostName,
IN EFI_DNS4_COMPLETION_TOKEN *Token
);
@@ -818,9 +816,9 @@ Dns4HostNameToIp (
EFI_STATUS
EFIAPI
Dns4IpToHostName (
IN EFI_DNS4_PROTOCOL *This,
IN EFI_IPv4_ADDRESS IpAddress,
IN EFI_DNS4_COMPLETION_TOKEN *Token
IN EFI_DNS4_PROTOCOL *This,
IN EFI_IPv4_ADDRESS IpAddress,
IN EFI_DNS4_COMPLETION_TOKEN *Token
);
/**
@@ -853,11 +851,11 @@ Dns4IpToHostName (
EFI_STATUS
EFIAPI
Dns4GeneralLookUp (
IN EFI_DNS4_PROTOCOL *This,
IN CHAR8 *QName,
IN UINT16 QType,
IN UINT16 QClass,
IN EFI_DNS4_COMPLETION_TOKEN *Token
IN EFI_DNS4_PROTOCOL *This,
IN CHAR8 *QName,
IN UINT16 QType,
IN UINT16 QClass,
IN EFI_DNS4_COMPLETION_TOKEN *Token
);
/**
@@ -889,10 +887,10 @@ Dns4GeneralLookUp (
EFI_STATUS
EFIAPI
Dns4UpdateDnsCache (
IN EFI_DNS4_PROTOCOL *This,
IN EFI_DNS4_PROTOCOL *This,
IN BOOLEAN DeleteFlag,
IN BOOLEAN Override,
IN EFI_DNS4_CACHE_ENTRY DnsCacheEntry
IN EFI_DNS4_CACHE_ENTRY DnsCacheEntry
);
/**
@@ -919,7 +917,7 @@ Dns4UpdateDnsCache (
EFI_STATUS
EFIAPI
Dns4Poll (
IN EFI_DNS4_PROTOCOL *This
IN EFI_DNS4_PROTOCOL *This
);
/**
@@ -954,7 +952,6 @@ Dns4Cancel (
IN EFI_DNS4_COMPLETION_TOKEN *Token
);
/**
Retrieve mode data of this DNS instance.
@@ -974,8 +971,8 @@ Dns4Cancel (
EFI_STATUS
EFIAPI
Dns6GetModeData (
IN EFI_DNS6_PROTOCOL *This,
OUT EFI_DNS6_MODE_DATA *DnsModeData
IN EFI_DNS6_PROTOCOL *This,
OUT EFI_DNS6_MODE_DATA *DnsModeData
);
/**
@@ -1004,8 +1001,8 @@ Dns6GetModeData (
EFI_STATUS
EFIAPI
Dns6Configure (
IN EFI_DNS6_PROTOCOL *This,
IN EFI_DNS6_CONFIG_DATA *DnsConfigData
IN EFI_DNS6_PROTOCOL *This,
IN EFI_DNS6_CONFIG_DATA *DnsConfigData
);
/**
@@ -1064,9 +1061,9 @@ Dns6HostNameToIp (
EFI_STATUS
EFIAPI
Dns6IpToHostName (
IN EFI_DNS6_PROTOCOL *This,
IN EFI_IPv6_ADDRESS IpAddress,
IN EFI_DNS6_COMPLETION_TOKEN *Token
IN EFI_DNS6_PROTOCOL *This,
IN EFI_IPv6_ADDRESS IpAddress,
IN EFI_DNS6_COMPLETION_TOKEN *Token
);
/**
@@ -1101,11 +1098,11 @@ Dns6IpToHostName (
EFI_STATUS
EFIAPI
Dns6GeneralLookUp (
IN EFI_DNS6_PROTOCOL *This,
IN CHAR8 *QName,
IN UINT16 QType,
IN UINT16 QClass,
IN EFI_DNS6_COMPLETION_TOKEN *Token
IN EFI_DNS6_PROTOCOL *This,
IN CHAR8 *QName,
IN UINT16 QType,
IN UINT16 QClass,
IN EFI_DNS6_COMPLETION_TOKEN *Token
);
/**
@@ -1138,10 +1135,10 @@ Dns6GeneralLookUp (
EFI_STATUS
EFIAPI
Dns6UpdateDnsCache (
IN EFI_DNS6_PROTOCOL *This,
IN EFI_DNS6_PROTOCOL *This,
IN BOOLEAN DeleteFlag,
IN BOOLEAN Override,
IN EFI_DNS6_CACHE_ENTRY DnsCacheEntry
IN EFI_DNS6_CACHE_ENTRY DnsCacheEntry
);
/**
@@ -1170,7 +1167,7 @@ Dns6UpdateDnsCache (
EFI_STATUS
EFIAPI
Dns6Poll (
IN EFI_DNS6_PROTOCOL *This
IN EFI_DNS6_PROTOCOL *This
);
/**

View File

@@ -48,24 +48,24 @@ EFI_DNS6_PROTOCOL mDns6Protocol = {
EFI_STATUS
EFIAPI
Dns4GetModeData (
IN EFI_DNS4_PROTOCOL *This,
OUT EFI_DNS4_MODE_DATA *DnsModeData
IN EFI_DNS4_PROTOCOL *This,
OUT EFI_DNS4_MODE_DATA *DnsModeData
)
{
DNS_INSTANCE *Instance;
DNS_INSTANCE *Instance;
EFI_TPL OldTpl;
EFI_TPL OldTpl;
UINTN Index;
UINTN Index;
LIST_ENTRY *Entry;
LIST_ENTRY *Next;
LIST_ENTRY *Entry;
LIST_ENTRY *Next;
DNS4_SERVER_IP *ServerItem;
EFI_IPv4_ADDRESS *ServerList;
DNS4_CACHE *CacheItem;
EFI_DNS4_CACHE_ENTRY *CacheList;
EFI_STATUS Status;
DNS4_SERVER_IP *ServerItem;
EFI_IPv4_ADDRESS *ServerList;
DNS4_CACHE *CacheItem;
EFI_DNS4_CACHE_ENTRY *CacheList;
EFI_STATUS Status;
ServerItem = NULL;
ServerList = NULL;
@@ -73,7 +73,6 @@ Dns4GetModeData (
CacheList = NULL;
Status = EFI_SUCCESS;
if ((This == NULL) || (DnsModeData == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -103,8 +102,8 @@ Dns4GetModeData (
NET_LIST_FOR_EACH_SAFE (Entry, Next, &mDriverData->Dns4ServerList) {
Index++;
}
DnsModeData->DnsServerCount = (UINT32) Index;
ServerList = AllocatePool (sizeof (EFI_IPv4_ADDRESS) * DnsModeData->DnsServerCount);
DnsModeData->DnsServerCount = (UINT32)Index;
ServerList = AllocatePool (sizeof (EFI_IPv4_ADDRESS) * DnsModeData->DnsServerCount);
if (ServerList == NULL) {
Status = EFI_OUT_OF_RESOURCES;
Dns4CleanConfigure (&DnsModeData->DnsConfigData);
@@ -122,12 +121,12 @@ Dns4GetModeData (
//
// Get the DnsCacheCount and DnsCacheList
//
Index =0;
Index = 0;
NET_LIST_FOR_EACH_SAFE (Entry, Next, &mDriverData->Dns4CacheList) {
Index++;
}
DnsModeData->DnsCacheCount = (UINT32) Index;
CacheList = AllocatePool (sizeof (EFI_DNS4_CACHE_ENTRY) * DnsModeData->DnsCacheCount);
DnsModeData->DnsCacheCount = (UINT32)Index;
CacheList = AllocatePool (sizeof (EFI_DNS4_CACHE_ENTRY) * DnsModeData->DnsCacheCount);
if (CacheList == NULL) {
Status = EFI_OUT_OF_RESOURCES;
Dns4CleanConfigure (&DnsModeData->DnsConfigData);
@@ -135,7 +134,7 @@ Dns4GetModeData (
goto ON_EXIT;
}
Index =0;
Index = 0;
NET_LIST_FOR_EACH_SAFE (Entry, Next, &mDriverData->Dns4CacheList) {
CacheItem = NET_LIST_USER_STRUCT (Entry, DNS4_CACHE, AllCacheLink);
CopyMem (CacheList + Index, &CacheItem->DnsCache, sizeof (EFI_DNS4_CACHE_ENTRY));
@@ -176,30 +175,31 @@ ON_EXIT:
EFI_STATUS
EFIAPI
Dns4Configure (
IN EFI_DNS4_PROTOCOL *This,
IN EFI_DNS4_CONFIG_DATA *DnsConfigData
IN EFI_DNS4_PROTOCOL *This,
IN EFI_DNS4_CONFIG_DATA *DnsConfigData
)
{
EFI_STATUS Status;
DNS_INSTANCE *Instance;
EFI_STATUS Status;
DNS_INSTANCE *Instance;
EFI_TPL OldTpl;
IP4_ADDR Ip;
IP4_ADDR Netmask;
EFI_TPL OldTpl;
IP4_ADDR Ip;
IP4_ADDR Netmask;
UINT32 ServerListCount;
EFI_IPv4_ADDRESS *ServerList;
UINT32 ServerListCount;
EFI_IPv4_ADDRESS *ServerList;
Status = EFI_SUCCESS;
ServerList = NULL;
if (This == NULL ||
(DnsConfigData != NULL && ((DnsConfigData->DnsServerListCount != 0 && DnsConfigData->DnsServerList == NULL) ||
(DnsConfigData->DnsServerListCount == 0 && DnsConfigData->DnsServerList != NULL)))) {
if ((This == NULL) ||
((DnsConfigData != NULL) && (((DnsConfigData->DnsServerListCount != 0) && (DnsConfigData->DnsServerList == NULL)) ||
((DnsConfigData->DnsServerListCount == 0) && (DnsConfigData->DnsServerList != NULL)))))
{
return EFI_INVALID_PARAMETER;
}
if (DnsConfigData != NULL && DnsConfigData->Protocol != DNS_PROTOCOL_UDP) {
if ((DnsConfigData != NULL) && (DnsConfigData->Protocol != DNS_PROTOCOL_UDP)) {
return EFI_UNSUPPORTED;
}
@@ -213,8 +213,8 @@ Dns4Configure (
//
// Reset the Instance if ConfigData is NULL
//
if (!NetMapIsEmpty(&Instance->Dns4TxTokens)) {
Dns4InstanceCancelToken(Instance, NULL);
if (!NetMapIsEmpty (&Instance->Dns4TxTokens)) {
Dns4InstanceCancelToken (Instance, NULL);
}
if (Instance->UdpIo != NULL) {
@@ -224,6 +224,7 @@ Dns4Configure (
if (Instance->Dns4CfgData.DnsServerList != NULL) {
FreePool (Instance->Dns4CfgData.DnsServerList);
}
ZeroMem (&Instance->Dns4CfgData, sizeof (EFI_DNS4_CONFIG_DATA));
Instance->State = DNS_STATE_UNCONFIGED;
@@ -234,11 +235,12 @@ Dns4Configure (
CopyMem (&Ip, &DnsConfigData->StationIp, sizeof (IP4_ADDR));
CopyMem (&Netmask, &DnsConfigData->SubnetMask, sizeof (IP4_ADDR));
Ip = NTOHL (Ip);
Netmask = NTOHL (Netmask);
Ip = NTOHL (Ip);
Netmask = NTOHL (Netmask);
if (!DnsConfigData->UseDefaultSetting &&
((!IP4_IS_VALID_NETMASK (Netmask) || (Netmask != 0 && !NetIp4IsUnicast (Ip, Netmask))))) {
((!IP4_IS_VALID_NETMASK (Netmask) || ((Netmask != 0) && !NetIp4IsUnicast (Ip, Netmask)))))
{
Status = EFI_INVALID_PARAMETER;
goto ON_EXIT;
}
@@ -263,7 +265,7 @@ Dns4Configure (
return Status;
}
ASSERT(ServerList != NULL);
ASSERT (ServerList != NULL);
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
@@ -281,6 +283,7 @@ Dns4Configure (
FreePool (Instance->Dns4CfgData.DnsServerList);
Instance->Dns4CfgData.DnsServerList = NULL;
}
goto ON_EXIT;
}
@@ -293,6 +296,7 @@ Dns4Configure (
FreePool (Instance->Dns4CfgData.DnsServerList);
Instance->Dns4CfgData.DnsServerList = NULL;
}
goto ON_EXIT;
}
@@ -332,23 +336,23 @@ Dns4HostNameToIp (
IN EFI_DNS4_COMPLETION_TOKEN *Token
)
{
EFI_STATUS Status;
EFI_STATUS Status;
DNS_INSTANCE *Instance;
DNS_INSTANCE *Instance;
EFI_DNS4_CONFIG_DATA *ConfigData;
UINTN Index;
DNS4_CACHE *Item;
LIST_ENTRY *Entry;
LIST_ENTRY *Next;
UINTN Index;
DNS4_CACHE *Item;
LIST_ENTRY *Entry;
LIST_ENTRY *Next;
CHAR8 *QueryName;
CHAR8 *QueryName;
DNS4_TOKEN_ENTRY *TokenEntry;
NET_BUF *Packet;
DNS4_TOKEN_ENTRY *TokenEntry;
NET_BUF *Packet;
EFI_TPL OldTpl;
EFI_TPL OldTpl;
Status = EFI_SUCCESS;
Item = NULL;
@@ -359,11 +363,11 @@ Dns4HostNameToIp (
//
// Validate the parameters
//
if ((This == NULL) || (HostName == NULL) || Token == NULL) {
if ((This == NULL) || (HostName == NULL) || (Token == NULL)) {
return EFI_INVALID_PARAMETER;
}
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
Instance = DNS_INSTANCE_FROM_THIS_PROTOCOL4 (This);
@@ -417,7 +421,7 @@ Dns4HostNameToIp (
}
Token->RspData.H2AData->IpCount = (UINT32)Index;
Token->RspData.H2AData->IpList = AllocatePool (sizeof (EFI_IPv4_ADDRESS) * Index);
Token->RspData.H2AData->IpList = AllocatePool (sizeof (EFI_IPv4_ADDRESS) * Index);
if (Token->RspData.H2AData->IpList == NULL) {
if (Token->RspData.H2AData != NULL) {
FreePool (Token->RspData.H2AData);
@@ -430,7 +434,7 @@ Dns4HostNameToIp (
Index = 0;
NET_LIST_FOR_EACH_SAFE (Entry, Next, &mDriverData->Dns4CacheList) {
Item = NET_LIST_USER_STRUCT (Entry, DNS4_CACHE, AllCacheLink);
if ((UINT32)Index < Token->RspData.H2AData->IpCount && StrCmp (HostName, Item->DnsCache.HostName) == 0) {
if (((UINT32)Index < Token->RspData.H2AData->IpCount) && (StrCmp (HostName, Item->DnsCache.HostName) == 0)) {
CopyMem ((Token->RspData.H2AData->IpList) + Index, Item->DnsCache.IpAddress, sizeof (EFI_IPv4_ADDRESS));
Index++;
}
@@ -451,14 +455,14 @@ Dns4HostNameToIp (
//
// Construct DNS TokenEntry.
//
TokenEntry = AllocateZeroPool (sizeof(DNS4_TOKEN_ENTRY));
TokenEntry = AllocateZeroPool (sizeof (DNS4_TOKEN_ENTRY));
if (TokenEntry == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto ON_EXIT;
}
TokenEntry->PacketToLive = Token->RetryInterval;
TokenEntry->Token = Token;
TokenEntry->PacketToLive = Token->RetryInterval;
TokenEntry->Token = Token;
TokenEntry->QueryHostName = AllocateZeroPool (StrSize (HostName));
if (TokenEntry->QueryHostName == NULL) {
Status = EFI_OUT_OF_RESOURCES;
@@ -551,9 +555,9 @@ ON_EXIT:
EFI_STATUS
EFIAPI
Dns4IpToHostName (
IN EFI_DNS4_PROTOCOL *This,
IN EFI_IPv4_ADDRESS IpAddress,
IN EFI_DNS4_COMPLETION_TOKEN *Token
IN EFI_DNS4_PROTOCOL *This,
IN EFI_IPv4_ADDRESS IpAddress,
IN EFI_DNS4_COMPLETION_TOKEN *Token
)
{
return EFI_UNSUPPORTED;
@@ -589,23 +593,23 @@ Dns4IpToHostName (
EFI_STATUS
EFIAPI
Dns4GeneralLookUp (
IN EFI_DNS4_PROTOCOL *This,
IN CHAR8 *QName,
IN UINT16 QType,
IN UINT16 QClass,
IN EFI_DNS4_COMPLETION_TOKEN *Token
IN EFI_DNS4_PROTOCOL *This,
IN CHAR8 *QName,
IN UINT16 QType,
IN UINT16 QClass,
IN EFI_DNS4_COMPLETION_TOKEN *Token
)
{
EFI_STATUS Status;
EFI_STATUS Status;
DNS_INSTANCE *Instance;
DNS_INSTANCE *Instance;
EFI_DNS4_CONFIG_DATA *ConfigData;
DNS4_TOKEN_ENTRY *TokenEntry;
NET_BUF *Packet;
DNS4_TOKEN_ENTRY *TokenEntry;
NET_BUF *Packet;
EFI_TPL OldTpl;
EFI_TPL OldTpl;
Status = EFI_SUCCESS;
TokenEntry = NULL;
@@ -614,11 +618,11 @@ Dns4GeneralLookUp (
//
// Validate the parameters
//
if ((This == NULL) || (QName == NULL) || Token == NULL) {
if ((This == NULL) || (QName == NULL) || (Token == NULL)) {
return EFI_INVALID_PARAMETER;
}
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
Instance = DNS_INSTANCE_FROM_THIS_PROTOCOL4 (This);
@@ -655,15 +659,15 @@ Dns4GeneralLookUp (
//
// Construct DNS TokenEntry.
//
TokenEntry = AllocateZeroPool (sizeof(DNS4_TOKEN_ENTRY));
TokenEntry = AllocateZeroPool (sizeof (DNS4_TOKEN_ENTRY));
if (TokenEntry == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto ON_EXIT;
}
TokenEntry->PacketToLive = Token->RetryInterval;
TokenEntry->PacketToLive = Token->RetryInterval;
TokenEntry->GeneralLookUp = TRUE;
TokenEntry->Token = Token;
TokenEntry->Token = Token;
//
// Construct DNS Query Packet.
@@ -741,18 +745,18 @@ ON_EXIT:
EFI_STATUS
EFIAPI
Dns4UpdateDnsCache (
IN EFI_DNS4_PROTOCOL *This,
IN BOOLEAN DeleteFlag,
IN BOOLEAN Override,
IN EFI_DNS4_CACHE_ENTRY DnsCacheEntry
IN EFI_DNS4_PROTOCOL *This,
IN BOOLEAN DeleteFlag,
IN BOOLEAN Override,
IN EFI_DNS4_CACHE_ENTRY DnsCacheEntry
)
{
EFI_STATUS Status;
EFI_TPL OldTpl;
EFI_STATUS Status;
EFI_TPL OldTpl;
Status = EFI_SUCCESS;
if (DnsCacheEntry.HostName == NULL || DnsCacheEntry.IpAddress == NULL || DnsCacheEntry.Timeout == 0) {
if ((DnsCacheEntry.HostName == NULL) || (DnsCacheEntry.IpAddress == NULL) || (DnsCacheEntry.Timeout == 0)) {
return EFI_INVALID_PARAMETER;
}
@@ -792,11 +796,11 @@ Dns4UpdateDnsCache (
EFI_STATUS
EFIAPI
Dns4Poll (
IN EFI_DNS4_PROTOCOL *This
IN EFI_DNS4_PROTOCOL *This
)
{
DNS_INSTANCE *Instance;
EFI_UDP4_PROTOCOL *Udp;
DNS_INSTANCE *Instance;
EFI_UDP4_PROTOCOL *Udp;
if (This == NULL) {
return EFI_INVALID_PARAMETER;
@@ -847,9 +851,9 @@ Dns4Cancel (
IN EFI_DNS4_COMPLETION_TOKEN *Token
)
{
EFI_STATUS Status;
DNS_INSTANCE *Instance;
EFI_TPL OldTpl;
EFI_STATUS Status;
DNS_INSTANCE *Instance;
EFI_TPL OldTpl;
if (This == NULL) {
return EFI_INVALID_PARAMETER;
@@ -897,24 +901,24 @@ Dns4Cancel (
EFI_STATUS
EFIAPI
Dns6GetModeData (
IN EFI_DNS6_PROTOCOL *This,
OUT EFI_DNS6_MODE_DATA *DnsModeData
IN EFI_DNS6_PROTOCOL *This,
OUT EFI_DNS6_MODE_DATA *DnsModeData
)
{
DNS_INSTANCE *Instance;
DNS_INSTANCE *Instance;
EFI_TPL OldTpl;
EFI_TPL OldTpl;
UINTN Index;
UINTN Index;
LIST_ENTRY *Entry;
LIST_ENTRY *Next;
LIST_ENTRY *Entry;
LIST_ENTRY *Next;
DNS6_SERVER_IP *ServerItem;
EFI_IPv6_ADDRESS *ServerList;
DNS6_CACHE *CacheItem;
EFI_DNS6_CACHE_ENTRY *CacheList;
EFI_STATUS Status;
DNS6_SERVER_IP *ServerItem;
EFI_IPv6_ADDRESS *ServerList;
DNS6_CACHE *CacheItem;
EFI_DNS6_CACHE_ENTRY *CacheList;
EFI_STATUS Status;
ServerItem = NULL;
ServerList = NULL;
@@ -928,7 +932,7 @@ Dns6GetModeData (
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
Instance = DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This);
Instance = DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This);
if (Instance->State == DNS_STATE_UNCONFIGED) {
Status = EFI_NOT_STARTED;
goto ON_EXIT;
@@ -951,8 +955,8 @@ Dns6GetModeData (
NET_LIST_FOR_EACH_SAFE (Entry, Next, &mDriverData->Dns6ServerList) {
Index++;
}
DnsModeData->DnsServerCount = (UINT32) Index;
ServerList = AllocatePool (sizeof(EFI_IPv6_ADDRESS) * DnsModeData->DnsServerCount);
DnsModeData->DnsServerCount = (UINT32)Index;
ServerList = AllocatePool (sizeof (EFI_IPv6_ADDRESS) * DnsModeData->DnsServerCount);
if (ServerList == NULL) {
Status = EFI_OUT_OF_RESOURCES;
Dns6CleanConfigure (&DnsModeData->DnsConfigData);
@@ -970,12 +974,12 @@ Dns6GetModeData (
//
// Get the DnsCacheCount and DnsCacheList
//
Index =0;
Index = 0;
NET_LIST_FOR_EACH_SAFE (Entry, Next, &mDriverData->Dns6CacheList) {
Index++;
}
DnsModeData->DnsCacheCount = (UINT32) Index;
CacheList = AllocatePool (sizeof(EFI_DNS6_CACHE_ENTRY) * DnsModeData->DnsCacheCount);
DnsModeData->DnsCacheCount = (UINT32)Index;
CacheList = AllocatePool (sizeof (EFI_DNS6_CACHE_ENTRY) * DnsModeData->DnsCacheCount);
if (CacheList == NULL) {
Status = EFI_OUT_OF_RESOURCES;
Dns6CleanConfigure (&DnsModeData->DnsConfigData);
@@ -983,7 +987,7 @@ Dns6GetModeData (
goto ON_EXIT;
}
Index =0;
Index = 0;
NET_LIST_FOR_EACH_SAFE (Entry, Next, &mDriverData->Dns6CacheList) {
CacheItem = NET_LIST_USER_STRUCT (Entry, DNS6_CACHE, AllCacheLink);
CopyMem (CacheList + Index, &CacheItem->DnsCache, sizeof (EFI_DNS6_CACHE_ENTRY));
@@ -1022,28 +1026,29 @@ ON_EXIT:
EFI_STATUS
EFIAPI
Dns6Configure (
IN EFI_DNS6_PROTOCOL *This,
IN EFI_DNS6_CONFIG_DATA *DnsConfigData
IN EFI_DNS6_PROTOCOL *This,
IN EFI_DNS6_CONFIG_DATA *DnsConfigData
)
{
EFI_STATUS Status;
DNS_INSTANCE *Instance;
EFI_STATUS Status;
DNS_INSTANCE *Instance;
EFI_TPL OldTpl;
EFI_TPL OldTpl;
UINT32 ServerListCount;
EFI_IPv6_ADDRESS *ServerList;
UINT32 ServerListCount;
EFI_IPv6_ADDRESS *ServerList;
Status = EFI_SUCCESS;
ServerList = NULL;
if (This == NULL ||
(DnsConfigData != NULL && ((DnsConfigData->DnsServerCount != 0 && DnsConfigData->DnsServerList == NULL) ||
(DnsConfigData->DnsServerCount == 0 && DnsConfigData->DnsServerList != NULL)))) {
if ((This == NULL) ||
((DnsConfigData != NULL) && (((DnsConfigData->DnsServerCount != 0) && (DnsConfigData->DnsServerList == NULL)) ||
((DnsConfigData->DnsServerCount == 0) && (DnsConfigData->DnsServerList != NULL)))))
{
return EFI_INVALID_PARAMETER;
}
if (DnsConfigData != NULL && DnsConfigData->Protocol != DNS_PROTOCOL_UDP) {
if ((DnsConfigData != NULL) && (DnsConfigData->Protocol != DNS_PROTOCOL_UDP)) {
return EFI_UNSUPPORTED;
}
@@ -1057,8 +1062,8 @@ Dns6Configure (
//
// Reset the Instance if ConfigData is NULL
//
if (!NetMapIsEmpty(&Instance->Dns6TxTokens)) {
Dns6InstanceCancelToken(Instance, NULL);
if (!NetMapIsEmpty (&Instance->Dns6TxTokens)) {
Dns6InstanceCancelToken (Instance, NULL);
}
if (Instance->UdpIo != NULL) {
@@ -1068,6 +1073,7 @@ Dns6Configure (
if (Instance->Dns6CfgData.DnsServerList != NULL) {
FreePool (Instance->Dns6CfgData.DnsServerList);
}
ZeroMem (&Instance->Dns6CfgData, sizeof (EFI_DNS6_CONFIG_DATA));
Instance->State = DNS_STATE_UNCONFIGED;
@@ -1089,7 +1095,7 @@ Dns6Configure (
gBS->RestoreTPL (OldTpl);
//
//The DNS instance will retrieve DNS server from DHCP Server.
// The DNS instance will retrieve DNS server from DHCP Server.
//
Status = GetDns6ServerFromDhcp6 (
Instance->Service->ImageHandle,
@@ -1101,7 +1107,7 @@ Dns6Configure (
goto ON_EXIT;
}
ASSERT(ServerList != NULL);
ASSERT (ServerList != NULL);
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
@@ -1121,6 +1127,7 @@ Dns6Configure (
FreePool (Instance->Dns6CfgData.DnsServerList);
Instance->Dns6CfgData.DnsServerList = NULL;
}
goto ON_EXIT;
}
@@ -1133,6 +1140,7 @@ Dns6Configure (
FreePool (Instance->Dns6CfgData.DnsServerList);
Instance->Dns6CfgData.DnsServerList = NULL;
}
goto ON_EXIT;
}
@@ -1174,23 +1182,23 @@ Dns6HostNameToIp (
IN EFI_DNS6_COMPLETION_TOKEN *Token
)
{
EFI_STATUS Status;
EFI_STATUS Status;
DNS_INSTANCE *Instance;
DNS_INSTANCE *Instance;
EFI_DNS6_CONFIG_DATA *ConfigData;
UINTN Index;
DNS6_CACHE *Item;
LIST_ENTRY *Entry;
LIST_ENTRY *Next;
UINTN Index;
DNS6_CACHE *Item;
LIST_ENTRY *Entry;
LIST_ENTRY *Next;
CHAR8 *QueryName;
CHAR8 *QueryName;
DNS6_TOKEN_ENTRY *TokenEntry;
NET_BUF *Packet;
DNS6_TOKEN_ENTRY *TokenEntry;
NET_BUF *Packet;
EFI_TPL OldTpl;
EFI_TPL OldTpl;
Status = EFI_SUCCESS;
Item = NULL;
@@ -1201,11 +1209,11 @@ Dns6HostNameToIp (
//
// Validate the parameters
//
if ((This == NULL) || (HostName == NULL) || Token == NULL) {
if ((This == NULL) || (HostName == NULL) || (Token == NULL)) {
return EFI_INVALID_PARAMETER;
}
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
Instance = DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This);
@@ -1259,7 +1267,7 @@ Dns6HostNameToIp (
}
Token->RspData.H2AData->IpCount = (UINT32)Index;
Token->RspData.H2AData->IpList = AllocatePool (sizeof (EFI_IPv6_ADDRESS) * Index);
Token->RspData.H2AData->IpList = AllocatePool (sizeof (EFI_IPv6_ADDRESS) * Index);
if (Token->RspData.H2AData->IpList == NULL) {
if (Token->RspData.H2AData != NULL) {
FreePool (Token->RspData.H2AData);
@@ -1272,7 +1280,7 @@ Dns6HostNameToIp (
Index = 0;
NET_LIST_FOR_EACH_SAFE (Entry, Next, &mDriverData->Dns6CacheList) {
Item = NET_LIST_USER_STRUCT (Entry, DNS6_CACHE, AllCacheLink);
if ((UINT32)Index < Token->RspData.H2AData->IpCount && StrCmp (HostName, Item->DnsCache.HostName) == 0) {
if (((UINT32)Index < Token->RspData.H2AData->IpCount) && (StrCmp (HostName, Item->DnsCache.HostName) == 0)) {
CopyMem ((Token->RspData.H2AData->IpList) + Index, Item->DnsCache.IpAddress, sizeof (EFI_IPv6_ADDRESS));
Index++;
}
@@ -1299,8 +1307,8 @@ Dns6HostNameToIp (
goto ON_EXIT;
}
TokenEntry->PacketToLive = Token->RetryInterval;
TokenEntry->Token = Token;
TokenEntry->PacketToLive = Token->RetryInterval;
TokenEntry->Token = Token;
TokenEntry->QueryHostName = AllocateZeroPool (StrSize (HostName));
if (TokenEntry->QueryHostName == NULL) {
Status = EFI_OUT_OF_RESOURCES;
@@ -1394,9 +1402,9 @@ ON_EXIT:
EFI_STATUS
EFIAPI
Dns6IpToHostName (
IN EFI_DNS6_PROTOCOL *This,
IN EFI_IPv6_ADDRESS IpAddress,
IN EFI_DNS6_COMPLETION_TOKEN *Token
IN EFI_DNS6_PROTOCOL *This,
IN EFI_IPv6_ADDRESS IpAddress,
IN EFI_DNS6_COMPLETION_TOKEN *Token
)
{
return EFI_UNSUPPORTED;
@@ -1434,23 +1442,23 @@ Dns6IpToHostName (
EFI_STATUS
EFIAPI
Dns6GeneralLookUp (
IN EFI_DNS6_PROTOCOL *This,
IN CHAR8 *QName,
IN UINT16 QType,
IN UINT16 QClass,
IN EFI_DNS6_COMPLETION_TOKEN *Token
IN EFI_DNS6_PROTOCOL *This,
IN CHAR8 *QName,
IN UINT16 QType,
IN UINT16 QClass,
IN EFI_DNS6_COMPLETION_TOKEN *Token
)
{
EFI_STATUS Status;
EFI_STATUS Status;
DNS_INSTANCE *Instance;
DNS_INSTANCE *Instance;
EFI_DNS6_CONFIG_DATA *ConfigData;
DNS6_TOKEN_ENTRY *TokenEntry;
NET_BUF *Packet;
DNS6_TOKEN_ENTRY *TokenEntry;
NET_BUF *Packet;
EFI_TPL OldTpl;
EFI_TPL OldTpl;
Status = EFI_SUCCESS;
TokenEntry = NULL;
@@ -1459,11 +1467,11 @@ Dns6GeneralLookUp (
//
// Validate the parameters
//
if ((This == NULL) || (QName == NULL) || Token == NULL) {
if ((This == NULL) || (QName == NULL) || (Token == NULL)) {
return EFI_INVALID_PARAMETER;
}
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
Instance = DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This);
@@ -1500,15 +1508,15 @@ Dns6GeneralLookUp (
//
// Construct DNS TokenEntry.
//
TokenEntry = AllocateZeroPool (sizeof(DNS6_TOKEN_ENTRY));
TokenEntry = AllocateZeroPool (sizeof (DNS6_TOKEN_ENTRY));
if (TokenEntry == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto ON_EXIT;
}
TokenEntry->PacketToLive = Token->RetryInterval;
TokenEntry->PacketToLive = Token->RetryInterval;
TokenEntry->GeneralLookUp = TRUE;
TokenEntry->Token = Token;
TokenEntry->Token = Token;
//
// Construct DNS Query Packet.
@@ -1587,18 +1595,18 @@ ON_EXIT:
EFI_STATUS
EFIAPI
Dns6UpdateDnsCache (
IN EFI_DNS6_PROTOCOL *This,
IN BOOLEAN DeleteFlag,
IN BOOLEAN Override,
IN EFI_DNS6_CACHE_ENTRY DnsCacheEntry
IN EFI_DNS6_PROTOCOL *This,
IN BOOLEAN DeleteFlag,
IN BOOLEAN Override,
IN EFI_DNS6_CACHE_ENTRY DnsCacheEntry
)
{
EFI_STATUS Status;
EFI_TPL OldTpl;
EFI_STATUS Status;
EFI_TPL OldTpl;
Status = EFI_SUCCESS;
if (DnsCacheEntry.HostName == NULL || DnsCacheEntry.IpAddress == NULL || DnsCacheEntry.Timeout == 0) {
if ((DnsCacheEntry.HostName == NULL) || (DnsCacheEntry.IpAddress == NULL) || (DnsCacheEntry.Timeout == 0)) {
return EFI_INVALID_PARAMETER;
}
@@ -1640,11 +1648,11 @@ Dns6UpdateDnsCache (
EFI_STATUS
EFIAPI
Dns6Poll (
IN EFI_DNS6_PROTOCOL *This
IN EFI_DNS6_PROTOCOL *This
)
{
DNS_INSTANCE *Instance;
EFI_UDP6_PROTOCOL *Udp;
DNS_INSTANCE *Instance;
EFI_UDP6_PROTOCOL *Udp;
if (This == NULL) {
return EFI_INVALID_PARAMETER;
@@ -1696,9 +1704,9 @@ Dns6Cancel (
IN EFI_DNS6_COMPLETION_TOKEN *Token
)
{
EFI_STATUS Status;
DNS_INSTANCE *Instance;
EFI_TPL OldTpl;
EFI_STATUS Status;
DNS_INSTANCE *Instance;
EFI_TPL OldTpl;
if (This == NULL) {
return EFI_INVALID_PARAMETER;
@@ -1726,4 +1734,3 @@ Dns6Cancel (
return Status;
}