1 | /** @file
|
---|
2 | EFI HTTP Utilities protocol provides a platform independent abstraction for HTTP
|
---|
3 | message comprehension.
|
---|
4 |
|
---|
5 | Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
|
---|
6 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
7 |
|
---|
8 | @par Revision Reference:
|
---|
9 | This Protocol is introduced in UEFI Specification 2.5
|
---|
10 |
|
---|
11 | **/
|
---|
12 |
|
---|
13 | #ifndef __EFI_HTTP_UTILITIES_PROTOCOL_H__
|
---|
14 | #define __EFI_HTTP_UTILITIES_PROTOCOL_H__
|
---|
15 |
|
---|
16 | #include <Protocol/Http.h>
|
---|
17 |
|
---|
18 | #define EFI_HTTP_UTILITIES_PROTOCOL_GUID \
|
---|
19 | { \
|
---|
20 | 0x3e35c163, 0x4074, 0x45dd, {0x43, 0x1e, 0x23, 0x98, 0x9d, 0xd8, 0x6b, 0x32 } \
|
---|
21 | }
|
---|
22 |
|
---|
23 | typedef struct _EFI_HTTP_UTILITIES_PROTOCOL EFI_HTTP_UTILITIES_PROTOCOL;
|
---|
24 |
|
---|
25 | /**
|
---|
26 | Create HTTP header based on a combination of seed header, fields
|
---|
27 | to delete, and fields to append.
|
---|
28 |
|
---|
29 | The Build() function is used to manage the headers portion of an
|
---|
30 | HTTP message by providing the ability to add, remove, or replace
|
---|
31 | HTTP headers.
|
---|
32 |
|
---|
33 | @param[in] This Pointer to EFI_HTTP_UTILITIES_PROTOCOL instance.
|
---|
34 | @param[in] SeedMessageSize Size of the initial HTTP header. This can be zero.
|
---|
35 | @param[in] SeedMessage Initial HTTP header to be used as a base for
|
---|
36 | building a new HTTP header. If NULL,
|
---|
37 | SeedMessageSize is ignored.
|
---|
38 | @param[in] DeleteCount Number of null-terminated HTTP header field names
|
---|
39 | in DeleteList.
|
---|
40 | @param[in] DeleteList List of null-terminated HTTP header field names to
|
---|
41 | remove from SeedMessage. Only the field names are
|
---|
42 | in this list because the field values are irrelevant
|
---|
43 | to this operation.
|
---|
44 | @param[in] AppendCount Number of header fields in AppendList.
|
---|
45 | @param[in] AppendList List of HTTP headers to populate NewMessage with.
|
---|
46 | If SeedMessage is not NULL, AppendList will be
|
---|
47 | appended to the existing list from SeedMessage in
|
---|
48 | NewMessage.
|
---|
49 | @param[out] NewMessageSize Pointer to number of header fields in NewMessage.
|
---|
50 | @param[out] NewMessage Pointer to a new list of HTTP headers based on.
|
---|
51 |
|
---|
52 | @retval EFI_SUCCESS Add, remove, and replace operations succeeded.
|
---|
53 | @retval EFI_OUT_OF_RESOURCES Could not allocate memory for NewMessage.
|
---|
54 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
|
---|
55 | This is NULL.
|
---|
56 | **/
|
---|
57 | typedef
|
---|
58 | EFI_STATUS
|
---|
59 | (EFIAPI *EFI_HTTP_UTILS_BUILD)(
|
---|
60 | IN EFI_HTTP_UTILITIES_PROTOCOL *This,
|
---|
61 | IN UINTN SeedMessageSize,
|
---|
62 | IN VOID *SeedMessage OPTIONAL,
|
---|
63 | IN UINTN DeleteCount,
|
---|
64 | IN CHAR8 *DeleteList[] OPTIONAL,
|
---|
65 | IN UINTN AppendCount,
|
---|
66 | IN EFI_HTTP_HEADER *AppendList[] OPTIONAL,
|
---|
67 | OUT UINTN *NewMessageSize,
|
---|
68 | OUT VOID **NewMessage
|
---|
69 | );
|
---|
70 |
|
---|
71 | /**
|
---|
72 | Parses HTTP header and produces an array of key/value pairs.
|
---|
73 |
|
---|
74 | The Parse() function is used to transform data stored in HttpHeader
|
---|
75 | into a list of fields paired with their corresponding values.
|
---|
76 |
|
---|
77 | @param[in] This Pointer to EFI_HTTP_UTILITIES_PROTOCOL instance.
|
---|
78 | @param[in] HttpMessage Contains raw unformatted HTTP header string.
|
---|
79 | @param[in] HttpMessageSize Size of HTTP header.
|
---|
80 | @param[out] HeaderFields Array of key/value header pairs.
|
---|
81 | @param[out] FieldCount Number of headers in HeaderFields.
|
---|
82 |
|
---|
83 | @retval EFI_SUCCESS Allocation succeeded.
|
---|
84 | @retval EFI_NOT_STARTED This EFI HTTP Protocol instance has not been
|
---|
85 | initialized.
|
---|
86 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
|
---|
87 | This is NULL.
|
---|
88 | HttpMessage is NULL.
|
---|
89 | HeaderFields is NULL.
|
---|
90 | FieldCount is NULL.
|
---|
91 | **/
|
---|
92 | typedef
|
---|
93 | EFI_STATUS
|
---|
94 | (EFIAPI *EFI_HTTP_UTILS_PARSE)(
|
---|
95 | IN EFI_HTTP_UTILITIES_PROTOCOL *This,
|
---|
96 | IN CHAR8 *HttpMessage,
|
---|
97 | IN UINTN HttpMessageSize,
|
---|
98 | OUT EFI_HTTP_HEADER **HeaderFields,
|
---|
99 | OUT UINTN *FieldCount
|
---|
100 | );
|
---|
101 |
|
---|
102 | ///
|
---|
103 | /// EFI_HTTP_UTILITIES_PROTOCOL
|
---|
104 | /// designed to be used by EFI drivers and applications to parse HTTP
|
---|
105 | /// headers from a byte stream. This driver is neither dependent on
|
---|
106 | /// network connectivity, nor the existence of an underlying network
|
---|
107 | /// infrastructure.
|
---|
108 | ///
|
---|
109 | struct _EFI_HTTP_UTILITIES_PROTOCOL {
|
---|
110 | EFI_HTTP_UTILS_BUILD Build;
|
---|
111 | EFI_HTTP_UTILS_PARSE Parse;
|
---|
112 | };
|
---|
113 |
|
---|
114 | extern EFI_GUID gEfiHttpUtilitiesProtocolGuid;
|
---|
115 |
|
---|
116 | #endif
|
---|