]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/HttpUtilities.h
MdePkg: Add header file for HTTP utilities protocol
[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 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 @par Revision Reference:
15 This Protocol is introduced in UEFI Specification 2.5
16
17 **/
18
19 #ifndef __EFI_HTTP_UTILITIES_PROTOCOL_H__
20 #define __EFI_HTTP_UTILITIES_PROTOCOL_H__
21
22 #include <Protocol/Http.h>
23
24 #define EFI_HTTP_UTILITIES_PROTOCOL_GUID \
25 { \
26 0x3e35c163, 0x4074, 0x45dd, {0x43, 0x1e, 0x23, 0x98, 0x9d, 0xd8, 0x6b, 0x32 } \
27 }
28
29 typedef struct _EFI_HTTP_UTILITIES_PROTOCOL EFI_HTTP_UTILITIES_PROTOCOL;
30
31
32 /**
33 Create HTTP header based on a combination of seed header, fields
34 to delete, and fields to append.
35
36 The Build() function is used to manage the headers portion of an
37 HTTP message by providing the ability to add, remove, or replace
38 HTTP headers.
39
40 @param[in] This Pointer to EFI_HTTP_UTILITIES_PROTOCOL instance.
41 @param[in] SeedMessageSize Size of the initial HTTP header. This can be zero.
42 @param[in] SeedMessage Initial HTTP header to be used as a base for
43 building a new HTTP header. If NULL,
44 SeedMessageSize is ignored.
45 @param[in] DeleteCount Number of null-terminated HTTP header field names
46 in DeleteList.
47 @param[in] DeleteList List of null-terminated HTTP header field names to
48 remove from SeedMessage. Only the field names are
49 in this list because the field values are irrelevant
50 to this operation.
51 @param[in] AppendCount Number of header fields in AppendList.
52 @param[in] AppendList List of HTTP headers to populate NewMessage with.
53 If SeedMessage is not NULL, AppendList will be
54 appended to the existing list from SeedMessage in
55 NewMessage.
56 @param[out] NewMessageSize Pointer to number of header fields in NewMessage.
57 @param[out] NewMessage Pointer to a new list of HTTP headers based on.
58
59 @retval EFI_SUCCESS Add, remove, and replace operations succeeded.
60 @retval EFI_OUT_OF_RESOURCES Could not allocate memory for NewMessage.
61 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
62 This is NULL.
63 **/
64 typedef
65 EFI_STATUS
66 (EFIAPI *EFI_HTTP_UTILS_BUILD) (
67 IN EFI_HTTP_UTILITIES_PROTOCOL *This,
68 IN UINTN SeedMessageSize,
69 IN VOID *SeedMessage, OPTIONAL
70 IN UINTN DeleteCount,
71 IN CHAR8 *DeleteList[], OPTIONAL
72 IN UINTN AppendCount,
73 IN EFI_HTTP_HEADER *AppendList[], OPTIONAL
74 OUT UINTN *NewMessageSize,
75 OUT VOID **NewMessage
76 );
77
78 /**
79 Parses HTTP header and produces an array of key/value pairs.
80
81 The Parse() function is used to transform data stored in HttpHeader
82 into a list of fields paired with their corresponding values.
83
84 @param[in] This Pointer to EFI_HTTP_UTILITIES_PROTOCOL instance.
85 @param[in] HttpMessage Contains raw unformatted HTTP header string.
86 @param[in] HttpMessageSize Size of HTTP header.
87 @param[out] HeaderFields Array of key/value header pairs.
88 @param[out] FieldCount Number of headers in HeaderFields.
89
90 @retval EFI_SUCCESS Allocation succeeded.
91 @retval EFI_NOT_STARTED This EFI HTTP Protocol instance has not been
92 initialized.
93 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
94 This is NULL.
95 HttpMessage is NULL.
96 HeaderFields is NULL.
97 FieldCount is NULL.
98 **/
99 typedef
100 EFI_STATUS
101 (EFIAPI *EFI_HTTP_UTILS_PARSE) (
102 IN EFI_HTTP_UTILITIES_PROTOCOL *This,
103 IN CHAR8 *HttpMessage,
104 IN UINTN HttpMessageSize,
105 OUT EFI_HTTP_HEADER **HeaderFields,
106 OUT UINTN *FieldCount
107 );
108
109
110 ///
111 /// EFI_HTTP_UTILITIES_PROTOCOL
112 /// designed to be used by EFI drivers and applications to parse HTTP
113 /// headers from a byte stream. This driver is neither dependent on
114 /// network connectivity, nor the existence of an underlying network
115 /// infrastructure.
116 ///
117 struct _EFI_HTTP_UTILITIES_PROTOCOL {
118 EFI_HTTP_UTILS_BUILD Build;
119 EFI_HTTP_UTILS_PARSE Parse;
120 };
121
122 extern EFI_GUID gEfiHttpUtilitiesProtocolGuid;
123
124 #endif