]> git.proxmox.com Git - mirror_edk2.git/blame - NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.h
NetworkPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / NetworkPkg / HttpUtilitiesDxe / HttpUtilitiesDxe.h
CommitLineData
d933e70a
JW
1/** @file\r
2 The header files of Http Utilities functions for HttpUtilities driver.\r
3\r
4 Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
f58554fc 5 (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
d933e70a 6\r
ecf98fbc 7 SPDX-License-Identifier: BSD-2-Clause-Patent\r
d933e70a
JW
8\r
9**/\r
10\r
11#ifndef __EFI_HTTP_UTILITIES_DXE_H__\r
12#define __EFI_HTTP_UTILITIES_DXE_H__\r
13\r
14#include <Uefi.h>\r
15\r
16//\r
17// Libraries\r
18//\r
19#include <Library/UefiBootServicesTableLib.h>\r
20#include <Library/MemoryAllocationLib.h>\r
21#include <Library/BaseMemoryLib.h>\r
22#include <Library/BaseLib.h>\r
23#include <Library/UefiLib.h>\r
24#include <Library/DebugLib.h>\r
f58554fc 25#include <Library/HttpLib.h>\r
d933e70a
JW
26\r
27//\r
28// Consumed Protocols\r
29//\r
30#include <Protocol/HttpUtilities.h>\r
31#include <Protocol/Http.h>\r
32\r
33//\r
34// Protocol instances\r
35//\r
36extern EFI_HTTP_UTILITIES_PROTOCOL mHttpUtilitiesProtocol;\r
37\r
d933e70a
JW
38/**\r
39 Create HTTP header based on a combination of seed header, fields\r
40 to delete, and fields to append.\r
41\r
42 The Build() function is used to manage the headers portion of an\r
43 HTTP message by providing the ability to add, remove, or replace\r
44 HTTP headers.\r
45\r
46 @param[in] This Pointer to EFI_HTTP_UTILITIES_PROTOCOL instance.\r
47 @param[in] SeedMessageSize Size of the initial HTTP header. This can be zero.\r
48 @param[in] SeedMessage Initial HTTP header to be used as a base for\r
49 building a new HTTP header. If NULL,\r
50 SeedMessageSize is ignored.\r
51 @param[in] DeleteCount Number of null-terminated HTTP header field names\r
52 in DeleteList.\r
53 @param[in] DeleteList List of null-terminated HTTP header field names to\r
54 remove from SeedMessage. Only the field names are\r
55 in this list because the field values are irrelevant\r
56 to this operation.\r
57 @param[in] AppendCount Number of header fields in AppendList.\r
58 @param[in] AppendList List of HTTP headers to populate NewMessage with.\r
59 If SeedMessage is not NULL, AppendList will be\r
60 appended to the existing list from SeedMessage in\r
61 NewMessage.\r
62 @param[out] NewMessageSize Pointer to number of header fields in NewMessage.\r
63 @param[out] NewMessage Pointer to a new list of HTTP headers based on.\r
64\r
65 @retval EFI_SUCCESS Add, remove, and replace operations succeeded.\r
66 @retval EFI_OUT_OF_RESOURCES Could not allocate memory for NewMessage.\r
67 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
68 This is NULL.\r
69**/\r
70EFI_STATUS\r
71EFIAPI\r
72HttpUtilitiesBuild (\r
73 IN EFI_HTTP_UTILITIES_PROTOCOL *This,\r
74 IN UINTN SeedMessageSize,\r
75 IN VOID *SeedMessage, OPTIONAL\r
76 IN UINTN DeleteCount,\r
77 IN CHAR8 *DeleteList[], OPTIONAL\r
78 IN UINTN AppendCount,\r
79 IN EFI_HTTP_HEADER *AppendList[], OPTIONAL\r
80 OUT UINTN *NewMessageSize,\r
81 OUT VOID **NewMessage\r
82 );\r
83\r
84\r
85/**\r
86 Parses HTTP header and produces an array of key/value pairs.\r
87\r
88 The Parse() function is used to transform data stored in HttpHeader\r
89 into a list of fields paired with their corresponding values.\r
90\r
91 @param[in] This Pointer to EFI_HTTP_UTILITIES_PROTOCOL instance.\r
92 @param[in] HttpMessage Contains raw unformatted HTTP header string.\r
93 @param[in] HttpMessageSize Size of HTTP header.\r
94 @param[out] HeaderFields Array of key/value header pairs.\r
95 @param[out] FieldCount Number of headers in HeaderFields.\r
96\r
97 @retval EFI_SUCCESS Allocation succeeded.\r
98 @retval EFI_NOT_STARTED This EFI HTTP Protocol instance has not been\r
99 initialized.\r
100 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
101 This is NULL.\r
102 HttpMessage is NULL.\r
103 HeaderFields is NULL.\r
104 FieldCount is NULL.\r
105**/\r
106EFI_STATUS\r
107EFIAPI\r
108HttpUtilitiesParse (\r
109 IN EFI_HTTP_UTILITIES_PROTOCOL *This,\r
110 IN CHAR8 *HttpMessage,\r
111 IN UINTN HttpMessageSize,\r
112 OUT EFI_HTTP_HEADER **HeaderFields,\r
113 OUT UINTN *FieldCount\r
114 );\r
115\r
116#endif\r