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