]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/HttpUtilities.h
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Include / Protocol / HttpUtilities.h
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 /**
27 Create HTTP header based on a combination of seed header, fields
28 to delete, and fields to append.
29
30 The Build() function is used to manage the headers portion of an
31 HTTP message by providing the ability to add, remove, or replace
32 HTTP headers.
33
34 @param[in] This Pointer to EFI_HTTP_UTILITIES_PROTOCOL instance.
35 @param[in] SeedMessageSize Size of the initial HTTP header. This can be zero.
36 @param[in] SeedMessage Initial HTTP header to be used as a base for
37 building a new HTTP header. If NULL,
38 SeedMessageSize is ignored.
39 @param[in] DeleteCount Number of null-terminated HTTP header field names
40 in DeleteList.
41 @param[in] DeleteList List of null-terminated HTTP header field names to
42 remove from SeedMessage. Only the field names are
43 in this list because the field values are irrelevant
44 to this operation.
45 @param[in] AppendCount Number of header fields in AppendList.
46 @param[in] AppendList List of HTTP headers to populate NewMessage with.
47 If SeedMessage is not NULL, AppendList will be
48 appended to the existing list from SeedMessage in
49 NewMessage.
50 @param[out] NewMessageSize Pointer to number of header fields in NewMessage.
51 @param[out] NewMessage Pointer to a new list of HTTP headers based on.
52
53 @retval EFI_SUCCESS Add, remove, and replace operations succeeded.
54 @retval EFI_OUT_OF_RESOURCES Could not allocate memory for NewMessage.
55 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
56 This is NULL.
57 **/
58 typedef
59 EFI_STATUS
60 (EFIAPI *EFI_HTTP_UTILS_BUILD) (
61 IN EFI_HTTP_UTILITIES_PROTOCOL *This,
62 IN UINTN SeedMessageSize,
63 IN VOID *SeedMessage, OPTIONAL
64 IN UINTN DeleteCount,
65 IN CHAR8 *DeleteList[], OPTIONAL
66 IN UINTN AppendCount,
67 IN EFI_HTTP_HEADER *AppendList[], OPTIONAL
68 OUT UINTN *NewMessageSize,
69 OUT VOID **NewMessage
70 );
71
72 /**
73 Parses HTTP header and produces an array of key/value pairs.
74
75 The Parse() function is used to transform data stored in HttpHeader
76 into a list of fields paired with their corresponding values.
77
78 @param[in] This Pointer to EFI_HTTP_UTILITIES_PROTOCOL instance.
79 @param[in] HttpMessage Contains raw unformatted HTTP header string.
80 @param[in] HttpMessageSize Size of HTTP header.
81 @param[out] HeaderFields Array of key/value header pairs.
82 @param[out] FieldCount Number of headers in HeaderFields.
83
84 @retval EFI_SUCCESS Allocation succeeded.
85 @retval EFI_NOT_STARTED This EFI HTTP Protocol instance has not been
86 initialized.
87 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
88 This is NULL.
89 HttpMessage is NULL.
90 HeaderFields is NULL.
91 FieldCount is NULL.
92 **/
93 typedef
94 EFI_STATUS
95 (EFIAPI *EFI_HTTP_UTILS_PARSE) (
96 IN EFI_HTTP_UTILITIES_PROTOCOL *This,
97 IN CHAR8 *HttpMessage,
98 IN UINTN HttpMessageSize,
99 OUT EFI_HTTP_HEADER **HeaderFields,
100 OUT UINTN *FieldCount
101 );
102
103
104 ///
105 /// EFI_HTTP_UTILITIES_PROTOCOL
106 /// designed to be used by EFI drivers and applications to parse HTTP
107 /// headers from a byte stream. This driver is neither dependent on
108 /// network connectivity, nor the existence of an underlying network
109 /// infrastructure.
110 ///
111 struct _EFI_HTTP_UTILITIES_PROTOCOL {
112 EFI_HTTP_UTILS_BUILD Build;
113 EFI_HTTP_UTILS_PARSE Parse;
114 };
115
116 extern EFI_GUID gEfiHttpUtilitiesProtocolGuid;
117
118 #endif