NetworkPkg: Clean up source files
1. Do not use tab characters 2. No trailing white space in one line 3. All files must end with CRLF Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
/** @file
|
||||
Functions implementation related with DHCPv6 for HTTP boot driver.
|
||||
|
||||
Copyright (c) 2015 - 2017, 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.
|
||||
Copyright (c) 2015 - 2018, 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
|
||||
http://opensource.org/licenses/bsd-license.php.
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
http://opensource.org/licenses/bsd-license.php.
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
@@ -192,14 +192,14 @@ HttpBootParseDhcp6Packet (
|
||||
EFI_STATUS Status;
|
||||
UINT32 Offset;
|
||||
UINT32 Length;
|
||||
|
||||
|
||||
IsDnsOffer = FALSE;
|
||||
IpExpressedUri = FALSE;
|
||||
IsProxyOffer = TRUE;
|
||||
IsHttpOffer = FALSE;
|
||||
Offer = &Cache6->Packet.Offer;
|
||||
Options = Cache6->OptList;
|
||||
|
||||
|
||||
ZeroMem (Cache6->OptList, sizeof (Cache6->OptList));
|
||||
|
||||
Option = (EFI_DHCP6_PACKET_OPTION *) (Offer->Dhcp6.Option);
|
||||
@@ -270,9 +270,9 @@ HttpBootParseDhcp6Packet (
|
||||
if (IsHttpOffer && Options[HTTP_BOOT_DHCP6_IDX_BOOT_FILE_URL] == NULL) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Try to retrieve the IP of HTTP server from URI.
|
||||
// Try to retrieve the IP of HTTP server from URI.
|
||||
//
|
||||
if (IsHttpOffer) {
|
||||
Status = HttpParseUrl (
|
||||
@@ -318,7 +318,7 @@ HttpBootParseDhcp6Packet (
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Cache6->OfferType = OfferType;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
@@ -345,7 +345,7 @@ HttpBootCacheDhcp6Packet (
|
||||
|
||||
CopyMem (&Dst->Dhcp6, &Src->Dhcp6, Src->Length);
|
||||
Dst->Length = Src->Length;
|
||||
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -397,7 +397,7 @@ HttpBootCacheDhcp6Offer (
|
||||
Private->OfferIndex[OfferType][Private->OfferCount[OfferType]] = Private->OfferNum;
|
||||
Private->OfferCount[OfferType]++;
|
||||
Private->OfferNum++;
|
||||
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -435,7 +435,7 @@ HttpBootDhcp6CallBack (
|
||||
EFI_DHCP6_PACKET *SelectAd;
|
||||
EFI_STATUS Status;
|
||||
BOOLEAN Received;
|
||||
|
||||
|
||||
if ((Dhcp6Event != Dhcp6SendSolicit) &&
|
||||
(Dhcp6Event != Dhcp6RcvdAdvertise) &&
|
||||
(Dhcp6Event != Dhcp6SendRequest) &&
|
||||
@@ -445,13 +445,13 @@ HttpBootDhcp6CallBack (
|
||||
}
|
||||
|
||||
ASSERT (Packet != NULL);
|
||||
|
||||
|
||||
Private = (HTTP_BOOT_PRIVATE_DATA *) Context;
|
||||
Status = EFI_SUCCESS;
|
||||
if (Private->HttpBootCallback != NULL && Dhcp6Event != Dhcp6SelectAdvertise) {
|
||||
Received = (BOOLEAN) (Dhcp6Event == Dhcp6RcvdAdvertise || Dhcp6Event == Dhcp6RcvdReply);
|
||||
Status = Private->HttpBootCallback->Callback (
|
||||
Private->HttpBootCallback,
|
||||
Private->HttpBootCallback,
|
||||
HttpBootDhcp6,
|
||||
Received,
|
||||
Packet->Length,
|
||||
@@ -462,7 +462,7 @@ HttpBootDhcp6CallBack (
|
||||
}
|
||||
}
|
||||
switch (Dhcp6Event) {
|
||||
|
||||
|
||||
case Dhcp6RcvdAdvertise:
|
||||
Status = EFI_NOT_READY;
|
||||
if (Packet->Length > HTTP_BOOT_DHCP6_PACKET_MAX_SIZE) {
|
||||
@@ -500,17 +500,17 @@ HttpBootDhcp6CallBack (
|
||||
CopyMem (*NewPacket, SelectAd, SelectAd->Size);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return Status;
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
Check whether IP driver could route the message which will be sent to ServerIp address.
|
||||
|
||||
|
||||
This function will check the IP6 route table every 1 seconds until specified timeout is expired, if a valid
|
||||
route is found in IP6 route table, the address will be filed in GatewayAddr and return.
|
||||
|
||||
@@ -521,7 +521,7 @@ HttpBootDhcp6CallBack (
|
||||
@retval EFI_SUCCESS Found a valid gateway address successfully.
|
||||
@retval EFI_TIMEOUT The operation is time out.
|
||||
@retval Other Unexpect error happened.
|
||||
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
HttpBootCheckRouteTable (
|
||||
@@ -553,7 +553,7 @@ HttpBootCheckRouteTable (
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto ON_EXIT;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Find out the gateway address which can route the message which send to ServerIp.
|
||||
//
|
||||
@@ -583,13 +583,13 @@ HttpBootCheckRouteTable (
|
||||
if (Ip6ModeData.IcmpTypeList != NULL) {
|
||||
FreePool (Ip6ModeData.IcmpTypeList);
|
||||
}
|
||||
|
||||
|
||||
if (GatewayIsFound || RetryCount == TimeOutInSecond) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
RetryCount++;
|
||||
|
||||
|
||||
//
|
||||
// Delay 1 second then recheck it again.
|
||||
//
|
||||
@@ -614,19 +614,19 @@ HttpBootCheckRouteTable (
|
||||
Ip6->Poll (Ip6);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ON_EXIT:
|
||||
if (TimeOutEvt != NULL) {
|
||||
gBS->CloseEvent (TimeOutEvt);
|
||||
}
|
||||
|
||||
|
||||
if (GatewayIsFound) {
|
||||
Status = EFI_SUCCESS;
|
||||
} else if (RetryCount == TimeOutInSecond) {
|
||||
Status = EFI_TIMEOUT;
|
||||
}
|
||||
|
||||
return Status;
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -650,7 +650,7 @@ HttpBootSetIp6Policy (
|
||||
|
||||
Ip6Config = Private->Ip6Config;
|
||||
DataSize = sizeof (EFI_IP6_CONFIG_POLICY);
|
||||
|
||||
|
||||
//
|
||||
// Get and store the current policy of IP6 driver.
|
||||
//
|
||||
@@ -681,7 +681,7 @@ HttpBootSetIp6Policy (
|
||||
|
||||
/**
|
||||
This function will register the default DNS addresses to the network device.
|
||||
|
||||
|
||||
@param[in] Private The pointer to HTTP_BOOT_PRIVATE_DATA.
|
||||
@param[in] DataLength Size of the buffer pointed to by DnsServerData in bytes.
|
||||
@param[in] DnsServerData Point a list of DNS server address in an array
|
||||
@@ -699,11 +699,11 @@ HttpBootSetIp6Dns (
|
||||
)
|
||||
{
|
||||
EFI_IP6_CONFIG_PROTOCOL *Ip6Config;
|
||||
|
||||
|
||||
ASSERT (Private->UsingIpv6);
|
||||
|
||||
Ip6Config = Private->Ip6Config;
|
||||
|
||||
|
||||
return Ip6Config->SetData (
|
||||
Ip6Config,
|
||||
Ip6ConfigDataTypeDnsServer,
|
||||
@@ -714,7 +714,7 @@ HttpBootSetIp6Dns (
|
||||
|
||||
/**
|
||||
This function will register the IPv6 gateway address to the network device.
|
||||
|
||||
|
||||
@param[in] Private The pointer to HTTP_BOOT_PRIVATE_DATA.
|
||||
|
||||
@retval EFI_SUCCESS The new IP configuration has been configured successfully.
|
||||
@@ -731,9 +731,9 @@ HttpBootSetIp6Gateway (
|
||||
|
||||
ASSERT (Private->UsingIpv6);
|
||||
Ip6Config = Private->Ip6Config;
|
||||
|
||||
|
||||
//
|
||||
// Set the default gateway address.
|
||||
// Set the default gateway address.
|
||||
//
|
||||
if (!Private->NoGateway && !NetIp6IsUnspecifiedAddr (&Private->GatewayIp.v6)) {
|
||||
Status = Ip6Config->SetData (
|
||||
@@ -752,7 +752,7 @@ HttpBootSetIp6Gateway (
|
||||
|
||||
/**
|
||||
This function will register the station IP address.
|
||||
|
||||
|
||||
@param[in] Private The pointer to HTTP_BOOT_PRIVATE_DATA.
|
||||
|
||||
@retval EFI_SUCCESS The new IP address has been configured successfully.
|
||||
@@ -772,29 +772,29 @@ HttpBootSetIp6Address (
|
||||
EFI_IPv6_ADDRESS *Ip6Addr;
|
||||
EFI_IPv6_ADDRESS GatewayAddr;
|
||||
EFI_IP6_CONFIG_DATA Ip6CfgData;
|
||||
EFI_EVENT MappedEvt;
|
||||
EFI_EVENT MappedEvt;
|
||||
UINTN DataSize;
|
||||
BOOLEAN IsAddressOk;
|
||||
UINTN Index;
|
||||
|
||||
ASSERT (Private->UsingIpv6);
|
||||
|
||||
|
||||
MappedEvt = NULL;
|
||||
IsAddressOk = FALSE;
|
||||
Ip6Addr = NULL;
|
||||
Ip6Cfg = Private->Ip6Config;
|
||||
Ip6 = Private->Ip6;
|
||||
|
||||
|
||||
ZeroMem (&CfgAddr, sizeof (EFI_IP6_CONFIG_MANUAL_ADDRESS));
|
||||
CopyMem (&CfgAddr, &Private->StationIp.v6, sizeof (EFI_IPv6_ADDRESS));
|
||||
ZeroMem (&Ip6CfgData, sizeof (EFI_IP6_CONFIG_DATA));
|
||||
|
||||
|
||||
Ip6CfgData.AcceptIcmpErrors = TRUE;
|
||||
Ip6CfgData.DefaultProtocol = IP6_ICMP;
|
||||
Ip6CfgData.HopLimit = HTTP_BOOT_DEFAULT_HOPLIMIT;
|
||||
Ip6CfgData.ReceiveTimeout = HTTP_BOOT_DEFAULT_LIFETIME;
|
||||
Ip6CfgData.TransmitTimeout = HTTP_BOOT_DEFAULT_LIFETIME;
|
||||
|
||||
|
||||
Status = Ip6->Configure (Ip6, &Ip6CfgData);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto ON_EXIT;
|
||||
@@ -823,7 +823,7 @@ HttpBootSetIp6Address (
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto ON_EXIT;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Create a notify event to set address flag when DAD if IP6 driver succeeded.
|
||||
//
|
||||
@@ -837,7 +837,7 @@ HttpBootSetIp6Address (
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto ON_EXIT;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Set static host ip6 address. This is a asynchronous process.
|
||||
//
|
||||
@@ -855,7 +855,7 @@ HttpBootSetIp6Address (
|
||||
Ip6ConfigDataTypeManualAddress,
|
||||
sizeof (EFI_IP6_CONFIG_MANUAL_ADDRESS),
|
||||
&CfgAddr
|
||||
);
|
||||
);
|
||||
if (EFI_ERROR (Status) && Status != EFI_NOT_READY) {
|
||||
goto ON_EXIT;
|
||||
} else if (Status == EFI_NOT_READY) {
|
||||
@@ -879,7 +879,7 @@ HttpBootSetIp6Address (
|
||||
Status = EFI_DEVICE_ERROR;
|
||||
goto ON_EXIT;
|
||||
}
|
||||
|
||||
|
||||
Ip6Addr = AllocatePool (DataSize);
|
||||
if (Ip6Addr == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
@@ -903,9 +903,9 @@ HttpBootSetIp6Address (
|
||||
if (Index == DataSize / sizeof (EFI_IPv6_ADDRESS)) {
|
||||
Status = EFI_ABORTED;
|
||||
goto ON_EXIT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ON_EXIT:
|
||||
if (MappedEvt != NULL) {
|
||||
Ip6Cfg->UnregisterDataNotify (
|
||||
@@ -919,8 +919,8 @@ ON_EXIT:
|
||||
if (Ip6Addr != NULL) {
|
||||
FreePool (Ip6Addr);
|
||||
}
|
||||
|
||||
return Status;
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -954,15 +954,15 @@ HttpBootDhcp6Sarr (
|
||||
//
|
||||
OptCount = HttpBootBuildDhcp6Options (Private, OptList, Buffer);
|
||||
ASSERT (OptCount >0);
|
||||
|
||||
|
||||
Retransmit = AllocateZeroPool (sizeof (EFI_DHCP6_RETRANSMISSION));
|
||||
if (Retransmit == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
|
||||
ZeroMem (&Mode, sizeof (EFI_DHCP6_MODE_DATA));
|
||||
ZeroMem (&Config, sizeof (EFI_DHCP6_CONFIG_DATA));
|
||||
|
||||
|
||||
Config.OptionCount = OptCount;
|
||||
Config.OptionList = OptList;
|
||||
Config.Dhcp6Callback = HttpBootDhcp6CallBack;
|
||||
@@ -977,7 +977,7 @@ HttpBootDhcp6Sarr (
|
||||
Retransmit->Mrc = 4;
|
||||
Retransmit->Mrt = 32;
|
||||
Retransmit->Mrd = 60;
|
||||
|
||||
|
||||
//
|
||||
// Configure the DHCPv6 instance for HTTP boot.
|
||||
//
|
||||
@@ -993,7 +993,7 @@ HttpBootDhcp6Sarr (
|
||||
Private->SelectIndex = 0;
|
||||
ZeroMem (Private->OfferCount, sizeof (Private->OfferCount));
|
||||
ZeroMem (Private->OfferIndex, sizeof (Private->OfferIndex));
|
||||
|
||||
|
||||
//
|
||||
// Start DHCPv6 S.A.R.R. process to acquire IPv6 address.
|
||||
//
|
||||
@@ -1001,7 +1001,7 @@ HttpBootDhcp6Sarr (
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto ON_EXIT;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Get the acquired IPv6 address and store them.
|
||||
//
|
||||
@@ -1009,14 +1009,14 @@ HttpBootDhcp6Sarr (
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto ON_EXIT;
|
||||
}
|
||||
|
||||
|
||||
ASSERT (Mode.Ia->State == Dhcp6Bound);
|
||||
CopyMem (&Private->StationIp.v6, &Mode.Ia->IaAddress[0].IpAddress, sizeof (EFI_IPv6_ADDRESS));
|
||||
|
||||
|
||||
AsciiPrint ("\n Station IPv6 address is ");
|
||||
HttpBootShowIp6Addr (&Private->StationIp.v6);
|
||||
AsciiPrint ("\n");
|
||||
|
||||
|
||||
ON_EXIT:
|
||||
if (EFI_ERROR (Status)) {
|
||||
Dhcp6->Stop (Dhcp6);
|
||||
@@ -1032,7 +1032,7 @@ ON_EXIT:
|
||||
}
|
||||
}
|
||||
|
||||
return Status;
|
||||
|
||||
return Status;
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user