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

Go to the source code of this file.

Functions

EFI_STATUS HttpBootUpdateDevicePath (IN HTTP_BOOT_PRIVATE_DATA *Private)
 
EFI_STATUS HttpBootDhcp4ExtractUriInfo (IN HTTP_BOOT_PRIVATE_DATA *Private)
 
EFI_STATUS HttpBootDhcp6ExtractUriInfo (IN HTTP_BOOT_PRIVATE_DATA *Private)
 
EFI_STATUS HttpBootDiscoverBootInfo (IN OUT HTTP_BOOT_PRIVATE_DATA *Private)
 
EFI_STATUS EFIAPI HttpBootHttpIoCallback (IN HTTP_IO_CALLBACK_EVENT EventType, IN EFI_HTTP_MESSAGE *Message, IN VOID *Context)
 
EFI_STATUS HttpBootCreateHttpIo (IN HTTP_BOOT_PRIVATE_DATA *Private)
 
VOID HttpBootFreeCache (IN HTTP_BOOT_CACHE_CONTENT *Cache)
 
VOID HttpBootFreeCacheList (IN HTTP_BOOT_PRIVATE_DATA *Private)
 
EFI_STATUS HttpBootGetFileFromCache (IN HTTP_BOOT_PRIVATE_DATA *Private, IN CHAR16 *Uri, IN OUT UINTN *BufferSize, OUT UINT8 *Buffer, OUT HTTP_BOOT_IMAGE_TYPE *ImageType)
 
EFI_STATUS EFIAPI HttpBootGetBootFileCallback (IN HTTP_BODY_PARSE_EVENT EventType, IN CHAR8 *Data, IN UINTN Length, IN VOID *Context)
 
EFI_STATUS HttpBootGetBootFile (IN HTTP_BOOT_PRIVATE_DATA *Private, IN BOOLEAN HeaderOnly, IN OUT UINTN *BufferSize, OUT UINT8 *Buffer, OUT HTTP_BOOT_IMAGE_TYPE *ImageType)
 

Detailed Description

Implementation of the boot file download function.

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

Definition in file HttpBootClient.c.

Function Documentation

◆ HttpBootCreateHttpIo()

EFI_STATUS HttpBootCreateHttpIo ( IN HTTP_BOOT_PRIVATE_DATA Private)

Create a HttpIo instance for the file download.

Parameters
[in]PrivateThe pointer to the driver's private data.
Return values
EFI_SUCCESSSuccessfully created.
OthersFailed to create HttpIo.

Definition at line 609 of file HttpBootClient.c.

◆ HttpBootDhcp4ExtractUriInfo()

EFI_STATUS HttpBootDhcp4ExtractUriInfo ( IN HTTP_BOOT_PRIVATE_DATA Private)

Parse the boot file URI information from the selected Dhcp4 offer packet.

Parameters
[in]PrivateThe pointer to the driver's private data.
Return values
EFI_SUCCESSSuccessfully parsed out all the boot information.
OthersFailed to parse out the boot information.

Definition at line 188 of file HttpBootClient.c.

◆ HttpBootDhcp6ExtractUriInfo()

EFI_STATUS HttpBootDhcp6ExtractUriInfo ( IN HTTP_BOOT_PRIVATE_DATA Private)

Parse the boot file URI information from the selected Dhcp6 offer packet.

Parameters
[in]PrivateThe pointer to the driver's private data.
Return values
EFI_SUCCESSSuccessfully parsed out all the boot information.
OthersFailed to parse out the boot information.

Definition at line 328 of file HttpBootClient.c.

◆ HttpBootDiscoverBootInfo()

EFI_STATUS HttpBootDiscoverBootInfo ( IN OUT HTTP_BOOT_PRIVATE_DATA Private)

Discover all the boot information for boot file.

Parameters
[in,out]PrivateThe pointer to the driver's private data.
Return values
EFI_SUCCESSSuccessfully obtained all the boot information .
OthersFailed to retrieve the boot information.

Definition at line 539 of file HttpBootClient.c.

◆ HttpBootFreeCache()

VOID HttpBootFreeCache ( IN HTTP_BOOT_CACHE_CONTENT Cache)

Release all the resource of a cache item.

Parameters
[in]CacheThe pointer to the cache item.

Definition at line 663 of file HttpBootClient.c.

◆ HttpBootFreeCacheList()

VOID HttpBootFreeCacheList ( IN HTTP_BOOT_PRIVATE_DATA Private)

Clean up all cached data.

Parameters
[in]PrivateThe pointer to the driver's private data.

Definition at line 722 of file HttpBootClient.c.

◆ HttpBootGetBootFile()

EFI_STATUS HttpBootGetBootFile ( IN HTTP_BOOT_PRIVATE_DATA Private,
IN BOOLEAN  HeaderOnly,
IN OUT UINTN BufferSize,
OUT UINT8 *  Buffer,
OUT HTTP_BOOT_IMAGE_TYPE *  ImageType 
)

This function download the boot file by using UEFI HTTP protocol.

Parameters
[in]PrivateThe pointer to the driver's private data.
[in]HeaderOnlyOnly request the response header, it could save a lot of time if the caller only want to know the size of the requested file.
[in,out]BufferSizeOn input the size of Buffer in bytes. On output with a return code of EFI_SUCCESS, the amount of data transferred to Buffer. On output with a return code of EFI_BUFFER_TOO_SMALL, the size of Buffer required to retrieve the requested file.
[out]BufferThe memory buffer to transfer the file to. IF Buffer is NULL, then the size of the requested file is returned in BufferSize.
[out]ImageTypeThe image type of the downloaded file.
Return values
EFI_SUCCESSThe file was loaded.
EFI_INVALID_PARAMETERBufferSize is NULL or Buffer Size is not NULL but Buffer is NULL.
EFI_OUT_OF_RESOURCESCould not allocate needed resources
EFI_BUFFER_TOO_SMALLThe BufferSize is too small to read the current directory entry. BufferSize has been updated with the size needed to complete the request.
EFI_ACCESS_DENIEDThe server needs to authenticate the client.
EFI_NOT_READYData transfer has timed-out, call HttpBootGetBootFile again to resume the download operation using HTTP Range headers.
EFI_UNSUPPORTEDSome HTTP response header is not supported.
OthersUnexpected error happened.

Definition at line 933 of file HttpBootClient.c.

◆ HttpBootGetBootFileCallback()

EFI_STATUS EFIAPI HttpBootGetBootFileCallback ( IN HTTP_BODY_PARSE_EVENT  EventType,
IN CHAR8 *  Data,
IN UINTN  Length,
IN VOID *  Context 
)

A callback function to intercept events during message parser.

This function will be invoked during HttpParseMessageBody() with various events type. An error return status of the callback function will cause the HttpParseMessageBody() aborted.

Parameters
[in]EventTypeEvent type of this callback call.
[in]DataA pointer to data buffer.
[in]LengthLength in bytes of the Data.
[in]ContextCallback context set by HttpInitMsgParser().
Return values
EFI_SUCCESSContinue to parser the message body.
OthersAbort the parse.

Definition at line 836 of file HttpBootClient.c.

◆ HttpBootGetFileFromCache()

EFI_STATUS HttpBootGetFileFromCache ( IN HTTP_BOOT_PRIVATE_DATA Private,
IN CHAR16 *  Uri,
IN OUT UINTN BufferSize,
OUT UINT8 *  Buffer,
OUT HTTP_BOOT_IMAGE_TYPE *  ImageType 
)

Get the file content from cached data.

Parameters
[in]PrivateThe pointer to the driver's private data.
[in]UriUri of the file to be retrieved from cache.
[in,out]BufferSizeOn input the size of Buffer in bytes. On output with a return code of EFI_SUCCESS, the amount of data transferred to Buffer. On output with a return code of EFI_BUFFER_TOO_SMALL, the size of Buffer required to retrieve the requested file.
[out]BufferThe memory buffer to transfer the file to. IF Buffer is NULL, then the size of the requested file is returned in BufferSize.
[out]ImageTypeThe image type of the downloaded file.
Return values
EFI_SUCCESSSuccessfully created.
OthersFailed to create HttpIo.

Definition at line 756 of file HttpBootClient.c.

◆ HttpBootHttpIoCallback()

EFI_STATUS EFIAPI HttpBootHttpIoCallback ( IN HTTP_IO_CALLBACK_EVENT  EventType,
IN EFI_HTTP_MESSAGE Message,
IN VOID *  Context 
)

HttpIo Callback function which will be invoked when specified HTTP_IO_CALLBACK_EVENT happened.

Parameters
[in]EventTypeIndicate the Event type that occurs in the current callback.
[in]MessageHTTP message which will be send to, or just received from HTTP server.
[in]ContextThe Callback Context pointer.
Return values
EFI_SUCCESSTells the HttpIo to continue the HTTP process.
OthersTells the HttpIo to abort the current HTTP process.

Definition at line 575 of file HttpBootClient.c.

◆ HttpBootUpdateDevicePath()

EFI_STATUS HttpBootUpdateDevicePath ( IN HTTP_BOOT_PRIVATE_DATA Private)

Update the device path node to include the boot resource information.

Parameters
[in]PrivateThe pointer to the driver's private data.
Return values
EFI_SUCCESSDevice patch successfully updated.
EFI_OUT_OF_RESOURCESCould not allocate needed resources.
OthersUnexpected error happened.

Definition at line 23 of file HttpBootClient.c.