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