]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | Support functions declaration for UEFI HTTP boot driver.\r | |
3 | \r | |
4 | Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>\r | |
5 | (C) Copyright 2020 Hewlett-Packard Development Company, L.P.<BR>\r | |
6 | SPDX-License-Identifier: BSD-2-Clause-Patent\r | |
7 | \r | |
8 | **/\r | |
9 | \r | |
10 | #ifndef __EFI_HTTP_BOOT_SUPPORT_H__\r | |
11 | #define __EFI_HTTP_BOOT_SUPPORT_H__\r | |
12 | \r | |
13 | /**\r | |
14 | Get the Nic handle using any child handle in the IPv4 stack.\r | |
15 | \r | |
16 | @param[in] ControllerHandle Pointer to child handle over IPv4.\r | |
17 | \r | |
18 | @return NicHandle The pointer to the Nic handle.\r | |
19 | @return NULL Can't find the Nic handle.\r | |
20 | \r | |
21 | **/\r | |
22 | EFI_HANDLE\r | |
23 | HttpBootGetNicByIp4Children (\r | |
24 | IN EFI_HANDLE ControllerHandle\r | |
25 | );\r | |
26 | \r | |
27 | /**\r | |
28 | Get the Nic handle using any child handle in the IPv6 stack.\r | |
29 | \r | |
30 | @param[in] ControllerHandle Pointer to child handle over IPv6.\r | |
31 | \r | |
32 | @return NicHandle The pointer to the Nic handle.\r | |
33 | @return NULL Can't find the Nic handle.\r | |
34 | \r | |
35 | **/\r | |
36 | EFI_HANDLE\r | |
37 | HttpBootGetNicByIp6Children (\r | |
38 | IN EFI_HANDLE ControllerHandle\r | |
39 | );\r | |
40 | \r | |
41 | /**\r | |
42 | This function is to convert UINTN to ASCII string with the required formatting.\r | |
43 | \r | |
44 | @param[in] Number Numeric value to be converted.\r | |
45 | @param[in] Buffer The pointer to the buffer for ASCII string.\r | |
46 | @param[in] Length The length of the required format.\r | |
47 | \r | |
48 | **/\r | |
49 | VOID\r | |
50 | HttpBootUintnToAscDecWithFormat (\r | |
51 | IN UINTN Number,\r | |
52 | IN UINT8 *Buffer,\r | |
53 | IN INTN Length\r | |
54 | );\r | |
55 | \r | |
56 | \r | |
57 | /**\r | |
58 | This function is to display the IPv4 address.\r | |
59 | \r | |
60 | @param[in] Ip The pointer to the IPv4 address.\r | |
61 | \r | |
62 | **/\r | |
63 | VOID\r | |
64 | HttpBootShowIp4Addr (\r | |
65 | IN EFI_IPv4_ADDRESS *Ip\r | |
66 | );\r | |
67 | \r | |
68 | /**\r | |
69 | This function is to display the IPv6 address.\r | |
70 | \r | |
71 | @param[in] Ip The pointer to the IPv6 address.\r | |
72 | \r | |
73 | **/\r | |
74 | VOID\r | |
75 | HttpBootShowIp6Addr (\r | |
76 | IN EFI_IPv6_ADDRESS *Ip\r | |
77 | );\r | |
78 | \r | |
79 | /**\r | |
80 | This function is to display the HTTP error status.\r | |
81 | \r | |
82 | @param[in] StatusCode The status code value in HTTP message.\r | |
83 | \r | |
84 | **/\r | |
85 | VOID\r | |
86 | HttpBootPrintErrorMessage (\r | |
87 | EFI_HTTP_STATUS_CODE StatusCode\r | |
88 | );\r | |
89 | \r | |
90 | /**\r | |
91 | Retrieve the host address using the EFI_DNS6_PROTOCOL.\r | |
92 | \r | |
93 | @param[in] Private The pointer to the driver's private data.\r | |
94 | @param[in] HostName Pointer to buffer containing hostname.\r | |
95 | @param[out] IpAddress On output, pointer to buffer containing IPv6 address.\r | |
96 | \r | |
97 | @retval EFI_SUCCESS Operation succeeded.\r | |
98 | @retval EFI_DEVICE_ERROR An unexpected network error occurred.\r | |
99 | @retval Others Other errors as indicated.\r | |
100 | **/\r | |
101 | EFI_STATUS\r | |
102 | HttpBootDns (\r | |
103 | IN HTTP_BOOT_PRIVATE_DATA *Private,\r | |
104 | IN CHAR16 *HostName,\r | |
105 | OUT EFI_IPv6_ADDRESS *IpAddress\r | |
106 | );\r | |
107 | \r | |
108 | /**\r | |
109 | Notify the callback function when an event is triggered.\r | |
110 | \r | |
111 | @param[in] Event The triggered event.\r | |
112 | @param[in] Context The opaque parameter to the function.\r | |
113 | \r | |
114 | **/\r | |
115 | VOID\r | |
116 | EFIAPI\r | |
117 | HttpBootCommonNotify (\r | |
118 | IN EFI_EVENT Event,\r | |
119 | IN VOID *Context\r | |
120 | );\r | |
121 | \r | |
122 | /**\r | |
123 | This function checks the HTTP(S) URI scheme.\r | |
124 | \r | |
125 | @param[in] Uri The pointer to the URI string.\r | |
126 | \r | |
127 | @retval EFI_SUCCESS The URI scheme is valid.\r | |
128 | @retval EFI_INVALID_PARAMETER The URI scheme is not HTTP or HTTPS.\r | |
129 | @retval EFI_ACCESS_DENIED HTTP is disabled and the URI is HTTP.\r | |
130 | \r | |
131 | **/\r | |
132 | EFI_STATUS\r | |
133 | HttpBootCheckUriScheme (\r | |
134 | IN CHAR8 *Uri\r | |
135 | );\r | |
136 | \r | |
137 | /**\r | |
138 | Get the URI address string from the input device path.\r | |
139 | \r | |
140 | Caller need to free the buffer in the UriAddress pointer.\r | |
141 | \r | |
142 | @param[in] FilePath Pointer to the device path which contains a URI device path node.\r | |
143 | @param[out] UriAddress The URI address string extract from the device path.\r | |
144 | \r | |
145 | @retval EFI_SUCCESS The URI string is returned.\r | |
146 | @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r | |
147 | \r | |
148 | **/\r | |
149 | EFI_STATUS\r | |
150 | HttpBootParseFilePath (\r | |
151 | IN EFI_DEVICE_PATH_PROTOCOL *FilePath,\r | |
152 | OUT CHAR8 **UriAddress\r | |
153 | );\r | |
154 | \r | |
155 | /**\r | |
156 | This function returns the image type according to server replied HTTP message\r | |
157 | and also the image's URI info.\r | |
158 | \r | |
159 | @param[in] Uri The pointer to the image's URI string.\r | |
160 | @param[in] UriParser URI Parse result returned by NetHttpParseUrl().\r | |
161 | @param[in] HeaderCount Number of HTTP header structures in Headers list.\r | |
162 | @param[in] Headers Array containing list of HTTP headers.\r | |
163 | @param[out] ImageType The image type of the downloaded file.\r | |
164 | \r | |
165 | @retval EFI_SUCCESS The image type is returned in ImageType.\r | |
166 | @retval EFI_INVALID_PARAMETER ImageType, Uri or UriParser is NULL.\r | |
167 | @retval EFI_INVALID_PARAMETER HeaderCount is not zero, and Headers is NULL.\r | |
168 | @retval EFI_NOT_FOUND Failed to identify the image type.\r | |
169 | @retval Others Unexpected error happened.\r | |
170 | \r | |
171 | **/\r | |
172 | EFI_STATUS\r | |
173 | HttpBootCheckImageType (\r | |
174 | IN CHAR8 *Uri,\r | |
175 | IN VOID *UriParser,\r | |
176 | IN UINTN HeaderCount,\r | |
177 | IN EFI_HTTP_HEADER *Headers,\r | |
178 | OUT HTTP_BOOT_IMAGE_TYPE *ImageType\r | |
179 | );\r | |
180 | \r | |
181 | /**\r | |
182 | This function register the RAM disk info to the system.\r | |
183 | \r | |
184 | @param[in] Private The pointer to the driver's private data.\r | |
185 | @param[in] BufferSize The size of Buffer in bytes.\r | |
186 | @param[in] Buffer The base address of the RAM disk.\r | |
187 | @param[in] ImageType The image type of the file in Buffer.\r | |
188 | \r | |
189 | @retval EFI_SUCCESS The RAM disk has been registered.\r | |
190 | @retval EFI_NOT_FOUND No RAM disk protocol instances were found.\r | |
191 | @retval EFI_UNSUPPORTED The ImageType is not supported.\r | |
192 | @retval Others Unexpected error happened.\r | |
193 | \r | |
194 | **/\r | |
195 | EFI_STATUS\r | |
196 | HttpBootRegisterRamDisk (\r | |
197 | IN HTTP_BOOT_PRIVATE_DATA *Private,\r | |
198 | IN UINTN BufferSize,\r | |
199 | IN VOID *Buffer,\r | |
200 | IN HTTP_BOOT_IMAGE_TYPE ImageType\r | |
201 | );\r | |
202 | \r | |
203 | /**\r | |
204 | Indicate if the HTTP status code indicates a redirection.\r | |
205 | \r | |
206 | @param[in] StatusCode HTTP status code from server.\r | |
207 | \r | |
208 | @return TRUE if it's redirection.\r | |
209 | \r | |
210 | **/\r | |
211 | BOOLEAN\r | |
212 | HttpBootIsHttpRedirectStatusCode (\r | |
213 | IN EFI_HTTP_STATUS_CODE StatusCode\r | |
214 | );\r | |
215 | #endif\r |