1 | /** @file
|
---|
2 | Header file for 'http' command functions.
|
---|
3 |
|
---|
4 | Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved. <BR>
|
---|
5 | Copyright (c) 2015, ARM Ltd. All rights reserved.<BR>
|
---|
6 | Copyright (c) 2020, Broadcom. All rights reserved.<BR>
|
---|
7 |
|
---|
8 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
9 |
|
---|
10 | **/
|
---|
11 |
|
---|
12 | #ifndef _HTTP_H_
|
---|
13 | #define _HTTP_H_
|
---|
14 |
|
---|
15 | #include <Uefi.h>
|
---|
16 |
|
---|
17 | #include <Library/BaseLib.h>
|
---|
18 | #include <Library/BaseMemoryLib.h>
|
---|
19 | #include <Library/DebugLib.h>
|
---|
20 | #include <Library/HiiLib.h>
|
---|
21 | #include <Library/HttpLib.h>
|
---|
22 | #include <Library/MemoryAllocationLib.h>
|
---|
23 | #include <Library/NetLib.h>
|
---|
24 | #include <Library/PrintLib.h>
|
---|
25 | #include <Library/ShellLib.h>
|
---|
26 | #include <Library/UefiBootServicesTableLib.h>
|
---|
27 | #include <Library/UefiHiiServicesLib.h>
|
---|
28 | #include <Library/UefiLib.h>
|
---|
29 | #include <Library/UefiRuntimeServicesTableLib.h>
|
---|
30 |
|
---|
31 | #include <Protocol/HiiPackageList.h>
|
---|
32 | #include <Protocol/HttpUtilities.h>
|
---|
33 | #include <Protocol/ServiceBinding.h>
|
---|
34 |
|
---|
35 | #define HTTP_APP_NAME L"http"
|
---|
36 |
|
---|
37 | #define REQ_OK 0
|
---|
38 | #define REQ_NEED_REPEAT 1
|
---|
39 |
|
---|
40 | //
|
---|
41 | // Download Flags.
|
---|
42 | //
|
---|
43 | #define DL_FLAG_TIME BIT0 // Show elapsed time.
|
---|
44 | #define DL_FLAG_KEEP_BAD BIT1 // Keep files even if download failed.
|
---|
45 |
|
---|
46 | extern EFI_HII_HANDLE mHttpHiiHandle;
|
---|
47 |
|
---|
48 | typedef struct {
|
---|
49 | UINTN ContentDownloaded;
|
---|
50 | UINTN ContentLength;
|
---|
51 | UINTN LastReportedNbOfBytes;
|
---|
52 | UINTN BufferSize;
|
---|
53 | UINTN Status;
|
---|
54 | UINTN Flags;
|
---|
55 | UINT8 *Buffer;
|
---|
56 | CHAR16 *ServerAddrAndProto;
|
---|
57 | CHAR16 *Uri;
|
---|
58 | EFI_HTTP_TOKEN ResponseToken;
|
---|
59 | EFI_HTTP_TOKEN RequestToken;
|
---|
60 | EFI_HTTP_PROTOCOL *Http;
|
---|
61 | EFI_HTTP_CONFIG_DATA HttpConfigData;
|
---|
62 | } HTTP_DOWNLOAD_CONTEXT;
|
---|
63 |
|
---|
64 | /**
|
---|
65 | Function for 'http' command.
|
---|
66 |
|
---|
67 | @param[in] ImageHandle The image handle.
|
---|
68 | @param[in] SystemTable The system table.
|
---|
69 |
|
---|
70 | @retval SHELL_SUCCESS Command completed successfully.
|
---|
71 | @retval SHELL_INVALID_PARAMETER Command usage error.
|
---|
72 | @retval SHELL_ABORTED The user aborts the operation.
|
---|
73 | @retval value Unknown error.
|
---|
74 | **/
|
---|
75 | SHELL_STATUS
|
---|
76 | RunHttp (
|
---|
77 | IN EFI_HANDLE ImageHandle,
|
---|
78 | IN EFI_SYSTEM_TABLE *SystemTable
|
---|
79 | );
|
---|
80 |
|
---|
81 | /**
|
---|
82 | Retrieve HII package list from ImageHandle and publish to HII database.
|
---|
83 |
|
---|
84 | @param[in] ImageHandle The image handle of the process.
|
---|
85 |
|
---|
86 | @retval HII handle.
|
---|
87 | **/
|
---|
88 | EFI_HII_HANDLE
|
---|
89 | InitializeHiiPackage (
|
---|
90 | IN EFI_HANDLE ImageHandle
|
---|
91 | );
|
---|
92 |
|
---|
93 | #endif // _HTTP_H_
|
---|