]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - NetworkPkg/HttpBootDxe/HttpBootClient.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / NetworkPkg / HttpBootDxe / HttpBootClient.h
... / ...
CommitLineData
1/** @file\r
2 Declaration of the boot file download function.\r
3\r
4Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.<BR>\r
5(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
6SPDX-License-Identifier: BSD-2-Clause-Patent\r
7\r
8**/\r
9\r
10#ifndef __EFI_HTTP_BOOT_HTTP_H__\r
11#define __EFI_HTTP_BOOT_HTTP_H__\r
12\r
13#define HTTP_BOOT_BLOCK_SIZE 1500\r
14#define HTTP_USER_AGENT_EFI_HTTP_BOOT "UefiHttpBoot/1.0"\r
15#define HTTP_BOOT_AUTHENTICATION_INFO_MAX_LEN 255\r
16\r
17//\r
18// Record the data length and start address of a data block.\r
19//\r
20typedef struct {\r
21 LIST_ENTRY Link; // Link to the EntityDataList in HTTP_BOOT_CACHE_CONTENT\r
22 UINT8 *Block; // If NULL, the data is in previous data block.\r
23 UINT8 *DataStart; // Point to somewhere in the Block\r
24 UINTN DataLength;\r
25} HTTP_BOOT_ENTITY_DATA;\r
26\r
27//\r
28// Structure for a cache item\r
29//\r
30typedef struct {\r
31 LIST_ENTRY Link; // Link to the CacheList in driver's private data.\r
32 EFI_HTTP_REQUEST_DATA *RequestData;\r
33 HTTP_IO_RESPONSE_DATA *ResponseData; // Not include any message-body data.\r
34 HTTP_BOOT_IMAGE_TYPE ImageType;\r
35 UINTN EntityLength;\r
36 LIST_ENTRY EntityDataList; // Entity data (message-body)\r
37} HTTP_BOOT_CACHE_CONTENT;\r
38\r
39//\r
40// Callback data for HTTP_BODY_PARSER_CALLBACK()\r
41//\r
42typedef struct {\r
43 EFI_STATUS Status;\r
44 //\r
45 // Cache info.\r
46 //\r
47 HTTP_BOOT_CACHE_CONTENT *Cache;\r
48 BOOLEAN NewBlock;\r
49 UINT8 *Block;\r
50\r
51 //\r
52 // Caller provided buffer to load the file in.\r
53 //\r
54 UINTN CopyedSize;\r
55 UINTN BufferSize;\r
56 UINT8 *Buffer;\r
57\r
58 HTTP_BOOT_PRIVATE_DATA *Private;\r
59} HTTP_BOOT_CALLBACK_DATA;\r
60\r
61/**\r
62 Discover all the boot information for boot file.\r
63\r
64 @param[in, out] Private The pointer to the driver's private data.\r
65\r
66 @retval EFI_SUCCESS Successfully obtained all the boot information .\r
67 @retval Others Failed to retrieve the boot information.\r
68\r
69**/\r
70EFI_STATUS\r
71HttpBootDiscoverBootInfo (\r
72 IN OUT HTTP_BOOT_PRIVATE_DATA *Private\r
73 );\r
74\r
75/**\r
76 Create a HttpIo instance for the file download.\r
77\r
78 @param[in] Private The pointer to the driver's private data.\r
79\r
80 @retval EFI_SUCCESS Successfully created.\r
81 @retval Others Failed to create HttpIo.\r
82\r
83**/\r
84EFI_STATUS\r
85HttpBootCreateHttpIo (\r
86 IN HTTP_BOOT_PRIVATE_DATA *Private\r
87 );\r
88\r
89/**\r
90 This function download the boot file by using UEFI HTTP protocol.\r
91\r
92 @param[in] Private The pointer to the driver's private data.\r
93 @param[in] HeaderOnly Only request the response header, it could save a lot of time if\r
94 the caller only want to know the size of the requested file.\r
95 @param[in, out] BufferSize On input the size of Buffer in bytes. On output with a return\r
96 code of EFI_SUCCESS, the amount of data transferred to\r
97 Buffer. On output with a return code of EFI_BUFFER_TOO_SMALL,\r
98 the size of Buffer required to retrieve the requested file.\r
99 @param[out] Buffer The memory buffer to transfer the file to. IF Buffer is NULL,\r
100 then the size of the requested file is returned in\r
101 BufferSize.\r
102 @param[out] ImageType The image type of the downloaded file.\r
103\r
104 @retval EFI_SUCCESS The file was loaded.\r
105 @retval EFI_INVALID_PARAMETER BufferSize is NULL or Buffer Size is not NULL but Buffer is NULL.\r
106 @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources\r
107 @retval EFI_BUFFER_TOO_SMALL The BufferSize is too small to read the current directory entry.\r
108 BufferSize has been updated with the size needed to complete\r
109 the request.\r
110 @retval EFI_ACCESS_DENIED The server needs to authenticate the client.\r
111 @retval Others Unexpected error happened.\r
112\r
113**/\r
114EFI_STATUS\r
115HttpBootGetBootFile (\r
116 IN HTTP_BOOT_PRIVATE_DATA *Private,\r
117 IN BOOLEAN HeaderOnly,\r
118 IN OUT UINTN *BufferSize,\r
119 OUT UINT8 *Buffer,\r
120 OUT HTTP_BOOT_IMAGE_TYPE *ImageType\r
121 );\r
122\r
123/**\r
124 Clean up all cached data.\r
125\r
126 @param[in] Private The pointer to the driver's private data.\r
127\r
128**/\r
129VOID\r
130HttpBootFreeCacheList (\r
131 IN HTTP_BOOT_PRIVATE_DATA *Private\r
132 );\r
133\r
134#endif\r