\r
Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>\r
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
-This program and the accompanying materials are licensed and made available under \r
-the terms and conditions of the BSD License that accompanies this distribution. \r
+This program and the accompanying materials are licensed and made available under\r
+the terms and conditions of the BSD License that accompanies this distribution.\r
The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php. \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
+http://opensource.org/licenses/bsd-license.php.\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
**/\r
/**\r
Enable the use of UEFI HTTP boot function.\r
\r
- If the driver has already been started but not satisfy the requirement (IP stack and \r
+ If the driver has already been started but not satisfy the requirement (IP stack and\r
specified boot file path), this function will stop the driver and start it again.\r
\r
@param[in] Private The pointer to the driver's private data.\r
@retval EFI_INVALID_PARAMETER The FilePath doesn't contain a valid URI device path node.\r
@retval EFI_ALREADY_STARTED The driver is already in started state.\r
@retval EFI_OUT_OF_RESOURCES There are not enough resources.\r
- \r
+\r
**/\r
EFI_STATUS\r
HttpBootStart (\r
CHAR8 *Uri;\r
\r
Uri = NULL;\r
- \r
+\r
if (Private == NULL || FilePath == NULL) {\r
return EFI_INVALID_PARAMETER;\r
}\r
- \r
+\r
//\r
// Check the URI in the input FilePath, in order to see whether it is\r
- // required to boot from a new specified boot file. \r
+ // required to boot from a new specified boot file.\r
//\r
Status = HttpBootParseFilePath (FilePath, &Uri);\r
if (EFI_ERROR (Status)) {\r
return EFI_INVALID_PARAMETER;\r
}\r
- \r
+\r
//\r
// Check whether we need to stop and restart the HTTP boot driver.\r
//\r
// 2. The specified boot file URI in FilePath is different with the one we have\r
// recorded before.\r
//\r
- if ((UsingIpv6 != Private->UsingIpv6) || \r
+ if ((UsingIpv6 != Private->UsingIpv6) ||\r
((Uri != NULL) && (AsciiStrCmp (Private->BootFileUri, Uri) != 0))) {\r
//\r
// Restart is required, first stop then continue this start function.\r
return Status;\r
}\r
}\r
- \r
+\r
//\r
// Init the content of cached DHCP offer list.\r
//\r
@retval EFI_NOT_STARTED The driver is in stopped state.\r
@retval EFI_DEVICE_ERROR An unexpected network error occurred.\r
@retval Others Other errors as indicated.\r
- \r
+\r
**/\r
EFI_STATUS\r
HttpBootDhcp (\r
if (Private == NULL) {\r
return EFI_INVALID_PARAMETER;\r
}\r
- \r
+\r
if (!Private->Started) {\r
return EFI_NOT_STARTED;\r
}\r
@retval EFI_INVALID_PARAMETER Private is NULL, or ImageType is NULL, or BufferSize is NULL.\r
@retval EFI_INVALID_PARAMETER *BufferSize is not zero, and Buffer is NULL.\r
@retval EFI_NOT_STARTED The driver is in stopped state.\r
- @retval EFI_BUFFER_TOO_SMALL The BufferSize is too small to read the boot file. BufferSize has \r
+ @retval EFI_BUFFER_TOO_SMALL The BufferSize is too small to read the boot file. BufferSize has\r
been updated with the size needed to complete the request.\r
@retval EFI_DEVICE_ERROR An unexpected network error occurred.\r
@retval Others Other errors as indicated.\r
- \r
+\r
**/\r
EFI_STATUS\r
HttpBootLoadFile (\r
if (*BufferSize != 0 && Buffer == NULL) {\r
return EFI_INVALID_PARAMETER;\r
}\r
- \r
+\r
if (!Private->Started) {\r
return EFI_NOT_STARTED;\r
}\r
Buffer,\r
ImageType\r
);\r
- \r
+\r
ON_EXIT:\r
HttpBootUninstallCallback (Private);\r
- \r
+\r
if (EFI_ERROR (Status)) {\r
if (Status == EFI_ACCESS_DENIED) {\r
AsciiPrint ("\n Error: Could not establish connection with HTTP server.\n");\r
AsciiPrint ("\n Error: Unexpected network error.\n");\r
}\r
}\r
- \r
+\r
return Status;\r
}\r
\r
@retval EFI_NOT_STARTED The driver is already in stopped state.\r
@retval EFI_INVALID_PARAMETER Private is NULL.\r
@retval Others Unexpected error when stop the function.\r
- \r
+\r
**/\r
EFI_STATUS\r
HttpBootStop (\r
if (Private == NULL) {\r
return EFI_INVALID_PARAMETER;\r
}\r
- \r
+\r
if (!Private->Started) {\r
return EFI_NOT_STARTED;\r
}\r
- \r
+\r
if (Private->HttpCreated) {\r
HttpIoDestroyIo (&Private->HttpIo);\r
Private->HttpCreated = FALSE;\r
}\r
- \r
+\r
Private->Started = FALSE;\r
ZeroMem (&Private->StationIp, sizeof (EFI_IP_ADDRESS));\r
ZeroMem (&Private->SubnetMask, sizeof (EFI_IP_ADDRESS));\r
Private->BootFileUriParser = NULL;\r
Private->BootFileSize = 0;\r
Private->SelectIndex = 0;\r
- Private->SelectProxyType = HttpOfferTypeMax; \r
+ Private->SelectProxyType = HttpOfferTypeMax;\r
\r
if (!Private->UsingIpv6) {\r
//\r
//\r
Private->Dhcp6->Stop (Private->Dhcp6);\r
Private->Dhcp6->Configure (Private->Dhcp6, NULL);\r
- \r
+\r
for (Index = 0; Index < HTTP_BOOT_OFFER_MAX_NUM; Index++) {\r
if (Private->OfferBuffer[Index].Dhcp6.UriParser) {\r
HttpUrlFreeParser (Private->OfferBuffer[Index].Dhcp6.UriParser);\r
Private->FilePathUri = NULL;\r
Private->FilePathUriParser = NULL;\r
}\r
- \r
+\r
ZeroMem (Private->OfferBuffer, sizeof (Private->OfferBuffer));\r
Private->OfferNum = 0;\r
ZeroMem (Private->OfferCount, sizeof (Private->OfferCount));\r
ZeroMem (Private->OfferIndex, sizeof (Private->OfferIndex));\r
- \r
+\r
HttpBootFreeCacheList (Private);\r
- \r
+\r
return EFI_SUCCESS;\r
}\r
\r
\r
VirtualNic = HTTP_BOOT_VIRTUAL_NIC_FROM_LOADFILE (This);\r
Private = VirtualNic->Private;\r
- \r
+\r
//\r
// Check media status before HTTP boot start\r
//\r
AsciiPrint ("\n Error: Could not detect network connection.\n");\r
return EFI_NO_MEDIA;\r
}\r
- \r
+\r
//\r
// Check whether the virtual nic is using IPv6 or not.\r
//\r
if (Status != EFI_SUCCESS && Status != EFI_ALREADY_STARTED) {\r
return Status;\r
}\r
- \r
+\r
//\r
// Load the boot file.\r
//\r
///\r
/// Load File Protocol instance\r
///\r
-GLOBAL_REMOVE_IF_UNREFERENCED \r
+GLOBAL_REMOVE_IF_UNREFERENCED\r
EFI_LOAD_FILE_PROTOCOL gHttpBootDxeLoadFile = {\r
HttpBootDxeLoadFile\r
};\r
@param[in] DataLength The length in bytes of the buffer pointed to by Data.\r
@param[in] Data A pointer to the buffer of data, the data type is specified by\r
DataType.\r
- \r
+\r
@retval EFI_SUCCESS Tells the HTTP Boot driver to continue the HTTP Boot process.\r
@retval EFI_ABORTED Tells the HTTP Boot driver to abort the current HTTP Boot process.\r
**/\r
case HttpBootHttpResponse:\r
if (Data != NULL) {\r
HttpMessage = (EFI_HTTP_MESSAGE *) Data;\r
- \r
+\r
if (HttpMessage->Data.Response != NULL) {\r
if (HttpBootIsHttpRedirectStatusCode (HttpMessage->Data.Response->StatusCode)) {\r
//\r
if (HttpHeader != NULL) {\r
Print (L"\n HTTP ERROR: Resource Redirected.\n New Location: %a\n", HttpHeader->FieldValue);\r
}\r
- break; \r
+ break;\r
}\r
}\r
- \r
+\r
HttpHeader = HttpFindHeader (\r
HttpMessage->HeaderCount,\r
HttpMessage->Headers,\r
///\r
/// HTTP Boot Callback Protocol instance\r
///\r
-GLOBAL_REMOVE_IF_UNREFERENCED \r
+GLOBAL_REMOVE_IF_UNREFERENCED\r
EFI_HTTP_BOOT_CALLBACK_PROTOCOL gHttpBootDxeHttpBootCallback = {\r
HttpBootCallback\r
};\r