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