2 Declaration of the boot file download function.
4 Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials are licensed and made available under
6 the terms and conditions of the BSD License that accompanies this distribution.
7 The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #ifndef __EFI_HTTP_BOOT_HTTP_H__
16 #define __EFI_HTTP_BOOT_HTTP_H__
18 #define HTTP_BOOT_REQUEST_TIMEOUT 5000 // 5 seconds in uints of millisecond.
19 #define HTTP_BOOT_BLOCK_SIZE 1024
21 #define HTTP_FIELD_NAME_USER_AGENT "User-Agent"
22 #define HTTP_FIELD_NAME_HOST "Host"
23 #define HTTP_FIELD_NAME_ACCEPT "Accept"
26 #define HTTP_USER_AGENT_EFI_HTTP_BOOT "UefiHttpBoot/1.0"
29 // Record the data length and start address of a data block.
32 LIST_ENTRY Link
; // Link to the EntityDataList in HTTP_BOOT_CACHE_CONTENT
33 UINT8
*Block
; // If NULL, the data is in previous data block.
34 UINT8
*DataStart
; // Point to somewhere in the Block
36 } HTTP_BOOT_ENTITY_DATA
;
39 // Structure for a cache item
42 LIST_ENTRY Link
; // Link to the CacheList in driver's private data.
43 EFI_HTTP_REQUEST_DATA
*RequestData
;
44 HTTP_IO_RESOPNSE_DATA
*ResponseData
; // Not include any message-body data.
46 LIST_ENTRY EntityDataList
; // Entity data (message-body)
47 } HTTP_BOOT_CACHE_CONTENT
;
50 // Callback data for HTTP_BODY_PARSER_CALLBACK()
57 HTTP_BOOT_CACHE_CONTENT
*Cache
;
62 // Caller provided buffer to load the file in.
67 } HTTP_BOOT_CALLBACK_DATA
;
70 Discover all the boot information for boot file.
72 @param[in, out] Private The pointer to the driver's private data.
74 @retval EFI_SUCCESS Successfully obtained all the boot information .
75 @retval Others Failed to retrieve the boot information.
79 HttpBootDiscoverBootInfo (
80 IN OUT HTTP_BOOT_PRIVATE_DATA
*Private
84 Create a HttpIo instance for the file download.
86 @param[in] Private The pointer to the driver's private data.
88 @retval EFI_SUCCESS Successfully created.
89 @retval Others Failed to create HttpIo.
93 HttpBootCreateHttpIo (
94 IN HTTP_BOOT_PRIVATE_DATA
*Private
98 This function download the boot file by using UEFI HTTP protocol.
100 @param[in] Private The pointer to the driver's private data.
101 @param[in] HeaderOnly Only request the response header, it could save a lot of time if
102 the caller only want to know the size of the requested file.
103 @param[in, out] BufferSize On input the size of Buffer in bytes. On output with a return
104 code of EFI_SUCCESS, the amount of data transferred to
105 Buffer. On output with a return code of EFI_BUFFER_TOO_SMALL,
106 the size of Buffer required to retrieve the requested file.
107 @param[out] Buffer The memory buffer to transfer the file to. IF Buffer is NULL,
108 then the size of the requested file is returned in
111 @retval EFI_SUCCESS The file was loaded.
112 @retval EFI_INVALID_PARAMETER BufferSize is NULL or Buffer Size is not NULL but Buffer is NULL.
113 @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources
114 @retval EFI_BUFFER_TOO_SMALL The BufferSize is too small to read the current directory entry.
115 BufferSize has been updated with the size needed to complete
117 @retval Others Unexpected error happened.
121 HttpBootGetBootFile (
122 IN HTTP_BOOT_PRIVATE_DATA
*Private
,
123 IN BOOLEAN HeaderOnly
,
124 IN OUT UINTN
*BufferSize
,
129 Clean up all cached data.
131 @param[in] Private The pointer to the driver's private data.
135 HttpBootFreeCacheList (
136 IN HTTP_BOOT_PRIVATE_DATA
*Private