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