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