TianoCore EDK2 master
Loading...
Searching...
No Matches
HttpBootSupport.c File Reference
#include "HttpBootDxe.h"

Go to the source code of this file.

Functions

EFI_HANDLE HttpBootGetNicByIp4Children (IN EFI_HANDLE ControllerHandle)
 
EFI_HANDLE HttpBootGetNicByIp6Children (IN EFI_HANDLE ControllerHandle)
 
VOID HttpBootUintnToAscDecWithFormat (IN UINTN Number, IN UINT8 *Buffer, IN INTN Length)
 
VOID HttpBootShowIp4Addr (IN EFI_IPv4_ADDRESS *Ip)
 
VOID HttpBootShowIp6Addr (IN EFI_IPv6_ADDRESS *Ip)
 
VOID HttpBootPrintErrorMessage (EFI_HTTP_STATUS_CODE StatusCode)
 
VOID EFIAPI HttpBootCommonNotify (IN EFI_EVENT Event, IN VOID *Context)
 
EFI_STATUS HttpBootDns (IN HTTP_BOOT_PRIVATE_DATA *Private, IN CHAR16 *HostName, OUT EFI_IPv6_ADDRESS *IpAddress)
 
EFI_STATUS HttpBootCheckUriScheme (IN CHAR8 *Uri)
 
EFI_STATUS HttpBootParseFilePath (IN EFI_DEVICE_PATH_PROTOCOL *FilePath, OUT CHAR8 **UriAddress)
 
EFI_STATUS HttpBootCheckImageType (IN CHAR8 *Uri, IN VOID *UriParser, IN UINTN HeaderCount, IN EFI_HTTP_HEADER *Headers, OUT HTTP_BOOT_IMAGE_TYPE *ImageType)
 
EFI_STATUS HttpBootRegisterRamDisk (IN HTTP_BOOT_PRIVATE_DATA *Private, IN UINTN BufferSize, IN VOID *Buffer, IN HTTP_BOOT_IMAGE_TYPE ImageType)
 
BOOLEAN HttpBootIsHttpRedirectStatusCode (IN EFI_HTTP_STATUS_CODE StatusCode)
 

Detailed Description

Support functions implementation for UEFI HTTP boot driver.

Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
(C) Copyright 2016 - 2020 Hewlett Packard Enterprise Development LP
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file HttpBootSupport.c.

Function Documentation

◆ HttpBootCheckImageType()

EFI_STATUS HttpBootCheckImageType ( IN CHAR8 *  Uri,
IN VOID *  UriParser,
IN UINTN  HeaderCount,
IN EFI_HTTP_HEADER Headers,
OUT HTTP_BOOT_IMAGE_TYPE *  ImageType 
)

This function returns the image type according to server replied HTTP message and also the image's URI info.

Parameters
[in]UriThe pointer to the image's URI string.
[in]UriParserURI Parse result returned by NetHttpParseUrl().
[in]HeaderCountNumber of HTTP header structures in Headers list.
[in]HeadersArray containing list of HTTP headers.
[out]ImageTypeThe image type of the downloaded file.
Return values
EFI_SUCCESSThe image type is returned in ImageType.
EFI_INVALID_PARAMETERImageType, Uri or UriParser is NULL.
EFI_INVALID_PARAMETERHeaderCount is not zero, and Headers is NULL.
EFI_NOT_FOUNDFailed to identify the image type.
OthersUnexpected error happened.

Definition at line 639 of file HttpBootSupport.c.

◆ HttpBootCheckUriScheme()

EFI_STATUS HttpBootCheckUriScheme ( IN CHAR8 *  Uri)

This function checks the HTTP(S) URI scheme.

Parameters
[in]UriThe pointer to the URI string.
Return values
EFI_SUCCESSThe URI scheme is valid.
EFI_INVALID_PARAMETERThe URI scheme is not HTTP or HTTPS.
EFI_ACCESS_DENIEDHTTP is disabled and the URI is HTTP.

Definition at line 513 of file HttpBootSupport.c.

◆ HttpBootCommonNotify()

VOID EFIAPI HttpBootCommonNotify ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Notify the callback function when an event is triggered.

Parameters
[in]EventThe triggered event.
[in]ContextThe opaque parameter to the function.

Definition at line 300 of file HttpBootSupport.c.

◆ HttpBootDns()

EFI_STATUS HttpBootDns ( IN HTTP_BOOT_PRIVATE_DATA Private,
IN CHAR16 *  HostName,
OUT EFI_IPv6_ADDRESS IpAddress 
)

Retrieve the host address using the EFI_DNS6_PROTOCOL.

Parameters
[in]PrivateThe pointer to the driver's private data.
[in]HostNamePointer to buffer containing hostname.
[out]IpAddressOn output, pointer to buffer containing IPv6 address.
Return values
EFI_SUCCESSOperation succeeded.
EFI_DEVICE_ERRORAn unexpected network error occurred.
OthersOther errors as indicated.

Definition at line 320 of file HttpBootSupport.c.

◆ HttpBootGetNicByIp4Children()

EFI_HANDLE HttpBootGetNicByIp4Children ( IN EFI_HANDLE  ControllerHandle)

Get the Nic handle using any child handle in the IPv4 stack.

Parameters
[in]ControllerHandlePointer to child handle over IPv4.
Returns
NicHandle The pointer to the Nic handle.
NULL Can't find the Nic handle.

Definition at line 22 of file HttpBootSupport.c.

◆ HttpBootGetNicByIp6Children()

EFI_HANDLE HttpBootGetNicByIp6Children ( IN EFI_HANDLE  ControllerHandle)

Get the Nic handle using any child handle in the IPv6 stack.

Parameters
[in]ControllerHandlePointer to child handle over IPv6.
Returns
NicHandle The pointer to the Nic handle.
NULL Can't find the Nic handle.

Definition at line 49 of file HttpBootSupport.c.

◆ HttpBootIsHttpRedirectStatusCode()

BOOLEAN HttpBootIsHttpRedirectStatusCode ( IN EFI_HTTP_STATUS_CODE  StatusCode)

Indicate if the HTTP status code indicates a redirection.

Parameters
[in]StatusCodeHTTP status code from server.
Returns
TRUE if it's redirection.

Definition at line 779 of file HttpBootSupport.c.

◆ HttpBootParseFilePath()

EFI_STATUS HttpBootParseFilePath ( IN EFI_DEVICE_PATH_PROTOCOL FilePath,
OUT CHAR8 **  UriAddress 
)

Get the URI address string from the input device path.

Caller need to free the buffer in the UriAddress pointer.

Parameters
[in]FilePathPointer to the device path which contains a URI device path node.
[out]UriAddressThe URI address string extract from the device path.
Return values
EFI_SUCCESSThe URI string is returned.
EFI_OUT_OF_RESOURCESFailed to allocate memory.

Definition at line 567 of file HttpBootSupport.c.

◆ HttpBootPrintErrorMessage()

VOID HttpBootPrintErrorMessage ( EFI_HTTP_STATUS_CODE  StatusCode)

This function is to display the HTTP error status.

Parameters
[in]StatusCodeThe status code value in HTTP message.

Definition at line 152 of file HttpBootSupport.c.

◆ HttpBootRegisterRamDisk()

EFI_STATUS HttpBootRegisterRamDisk ( IN HTTP_BOOT_PRIVATE_DATA Private,
IN UINTN  BufferSize,
IN VOID *  Buffer,
IN HTTP_BOOT_IMAGE_TYPE  ImageType 
)

This function register the RAM disk info to the system.

Parameters
[in]PrivateThe pointer to the driver's private data.
[in]BufferSizeThe size of Buffer in bytes.
[in]BufferThe base address of the RAM disk.
[in]ImageTypeThe image type of the file in Buffer.
Return values
EFI_SUCCESSThe RAM disk has been registered.
EFI_NOT_FOUNDNo RAM disk protocol instances were found.
EFI_UNSUPPORTEDThe ImageType is not supported.
OthersUnexpected error happened.

Definition at line 726 of file HttpBootSupport.c.

◆ HttpBootShowIp4Addr()

VOID HttpBootShowIp4Addr ( IN EFI_IPv4_ADDRESS Ip)

This function is to display the IPv4 address.

Parameters
[in]IpThe pointer to the IPv4 address.

Definition at line 97 of file HttpBootSupport.c.

◆ HttpBootShowIp6Addr()

VOID HttpBootShowIp6Addr ( IN EFI_IPv6_ADDRESS Ip)

This function is to display the IPv6 address.

Parameters
[in]IpThe pointer to the IPv6 address.

Definition at line 118 of file HttpBootSupport.c.

◆ HttpBootUintnToAscDecWithFormat()

VOID HttpBootUintnToAscDecWithFormat ( IN UINTN  Number,
IN UINT8 *  Buffer,
IN INTN  Length 
)

This function is to convert UINTN to ASCII string with the required formatting.

Parameters
[in]NumberNumeric value to be converted.
[in]BufferThe pointer to the buffer for ASCII string.
[in]LengthThe length of the required format.

Definition at line 75 of file HttpBootSupport.c.