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