]>
Commit | Line | Data |
---|---|---|
d933e70a JW |
1 | /** @file\r |
2 | Declaration of the boot file download function.\r | |
3 | \r | |
ac70e71b | 4 | Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.<BR>\r |
90f658c4 | 5 | (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r |
ecf98fbc | 6 | SPDX-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 | |
b5780309 | 13 | #define HTTP_BOOT_BLOCK_SIZE 1500\r |
d933e70a JW |
14 | #define HTTP_USER_AGENT_EFI_HTTP_BOOT "UefiHttpBoot/1.0"\r |
15 | \r | |
16 | //\r | |
17 | // Record the data length and start address of a data block.\r | |
18 | //\r | |
19 | typedef struct {\r | |
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 | |
24 | } HTTP_BOOT_ENTITY_DATA;\r | |
25 | \r | |
26 | //\r | |
27 | // Structure for a cache item\r | |
28 | //\r | |
29 | typedef struct {\r | |
30 | LIST_ENTRY Link; // Link to the CacheList in driver's private data.\r | |
31 | EFI_HTTP_REQUEST_DATA *RequestData;\r | |
ef422fc5 | 32 | HTTP_IO_RESPONSE_DATA *ResponseData; // Not include any message-body data.\r |
587d204c | 33 | HTTP_BOOT_IMAGE_TYPE ImageType;\r |
d933e70a JW |
34 | UINTN EntityLength;\r |
35 | LIST_ENTRY EntityDataList; // Entity data (message-body)\r | |
36 | } HTTP_BOOT_CACHE_CONTENT;\r | |
37 | \r | |
38 | //\r | |
39 | // Callback data for HTTP_BODY_PARSER_CALLBACK()\r | |
40 | //\r | |
41 | typedef 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 | |
69 | EFI_STATUS\r | |
70 | HttpBootDiscoverBootInfo (\r | |
71 | IN OUT HTTP_BOOT_PRIVATE_DATA *Private\r | |
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 | |
83 | EFI_STATUS\r | |
84 | HttpBootCreateHttpIo (\r | |
85 | IN HTTP_BOOT_PRIVATE_DATA *Private\r | |
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 | |
112 | EFI_STATUS\r | |
113 | HttpBootGetBootFile (\r | |
114 | IN HTTP_BOOT_PRIVATE_DATA *Private,\r | |
115 | IN BOOLEAN HeaderOnly,\r | |
116 | IN OUT UINTN *BufferSize,\r | |
587d204c FS |
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 | |
127 | VOID\r | |
128 | HttpBootFreeCacheList (\r | |
129 | IN HTTP_BOOT_PRIVATE_DATA *Private\r | |
130 | );\r | |
131 | \r | |
132 | #endif\r |