]>
Commit | Line | Data |
---|---|---|
47f51a06 YT |
1 | /** @file\r |
2 | The header files of HTTP helper functions for HttpDxe driver.\r | |
3 | \r | |
4 | Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r | |
5 | This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | #ifndef __EFI_HTTP_UTILITIES_H__\r | |
16 | #define __EFI_HTTP_UTILITIES_H__\r | |
17 | \r | |
18 | /**\r | |
19 | This function is used to manage the headers portion of an HTTP message by providing \r | |
20 | the ability to add, remove, or replace HTTP headers.\r | |
21 | \r | |
22 | @param[in] SeedMessageSize Size in bytes of the initial HTTP header. This can be zero. \r | |
23 | @param[in] SeedMessage Initial raw unformatted HTTP header to be used as a base for \r | |
24 | building a new unformatted HTTP header. If NULL, SeedMessageSize \r | |
25 | is ignored. The buffer containing this message will be allocated \r | |
26 | and released by the caller. \r | |
27 | @param[in] DeleteCount Number of null-terminated HTTP header field names in DeleteList.\r | |
28 | @param[in] DeleteList List of null-terminated HTTP header field names to remove from SeedMessage. \r | |
29 | Only the field names are in this list because the field values are irrelevant \r | |
30 | to this operation. If NULL, DeleteCount is ignored. The buffer containing the \r | |
31 | list will be allocated and released by the caller.\r | |
32 | @param[in] AppendCount Number of header fields in AppendList. \r | |
33 | @param[in] AppendList List of HTTP headers to populate NewMessage with. If SeedMessage is not NULL, \r | |
34 | AppendList will be appended to the existing list from SeedMessage in NewMessage.\r | |
35 | @param[out] NewMessageSize Pointer to the size in bytes of the new unformatted HTTP header in NewMessage. \r | |
36 | @param[out] NewMessage Pointer to a new unformatted HTTP header. The storage for this NewMessage is \r | |
37 | allocated by the driver publishing this protocol, and must be freed by the caller. \r | |
38 | \r | |
39 | @retval EFI_SUCCESS Add, remove, and replace operations succeeded.\r | |
40 | @retval EFI_OUT_OF_RESOURCES Could not allocate memory for NewMessage.\r | |
41 | \r | |
42 | **/\r | |
43 | EFI_STATUS\r | |
44 | HttpUtilitiesBuild(\r | |
45 | IN UINTN SeedMessageSize,\r | |
46 | IN VOID *SeedMessage, OPTIONAL\r | |
47 | IN UINTN DeleteCount,\r | |
48 | IN CHAR8 *DeleteList[], OPTIONAL\r | |
49 | IN UINTN AppendCount,\r | |
50 | IN EFI_HTTP_HEADER *AppendList[], OPTIONAL\r | |
51 | OUT UINTN *NewMessageSize,\r | |
52 | OUT VOID **NewMessage\r | |
53 | );\r | |
54 | \r | |
55 | /**\r | |
56 | This function is used to transform data stored in HttpMessage into a list of fields \r | |
57 | paired with their corresponding values.\r | |
58 | \r | |
59 | @param[in] HttpMessage Contains raw unformatted HTTP header string. The buffer for this string will \r | |
60 | be allocated and released by the caller.\r | |
61 | @param[in] HttpMessageSize Size in bytes of raw unformatted HTTP header. \r | |
62 | @param[out] HeaderFields Array of key/value header pairs. The storage for all header pairs is allocated\r | |
63 | by the driver publishing this protocol, and must be freed by the caller. \r | |
64 | @param[out] FieldCount Number of headers in HeaderFields.\r | |
65 | \r | |
66 | @retval EFI_SUCCESS Parse HTTP header into array of key/value pairs succeeded.\r | |
67 | @retval EFI_OUT_OF_RESOURCES Could not allocate memory for NewMessage.\r | |
68 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r | |
69 | HttpMessage is NULL.\r | |
70 | HeaderFields is NULL.\r | |
71 | FieldCount is NULL.\r | |
72 | \r | |
73 | **/\r | |
74 | EFI_STATUS\r | |
75 | HttpUtilitiesParse(\r | |
76 | IN CHAR8 *HttpMessage,\r | |
77 | IN UINTN HttpMessageSize,\r | |
78 | OUT EFI_HTTP_HEADER **HeaderFields,\r | |
79 | OUT UINTN *FieldCount\r | |
80 | );\r | |
81 | \r | |
82 | #endif\r |