summaryrefslogtreecommitdiff
path: root/NetworkPkg/HttpDxe/HttpUtilities.h
diff options
context:
space:
mode:
authorYe Ting <ting.ye@intel.com>2015-07-07 09:09:21 +0000
committertye1 <tye1@Edk2>2015-07-07 09:09:21 +0000
commit47f51a064fbb3d3226304380674b2bec3cb33ba1 (patch)
tree44cb073e0aa95990d605a00e6118e3620fd38400 /NetworkPkg/HttpDxe/HttpUtilities.h
parent99c048ef4aca44589d519946ee6a6c890ad9123b (diff)
downloadedk2-47f51a064fbb3d3226304380674b2bec3cb33ba1.zip
edk2-47f51a064fbb3d3226304380674b2bec3cb33ba1.tar.gz
edk2-47f51a064fbb3d3226304380674b2bec3cb33ba1.tar.bz2
NetworkPkg: Add HTTP Driver
Add HTTP driver to support HTTP protocols defined in UEFI 2.5 specification. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Samer El-Haj-Mahmoud <elhaj@hp.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17855 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'NetworkPkg/HttpDxe/HttpUtilities.h')
-rw-r--r--NetworkPkg/HttpDxe/HttpUtilities.h82
1 files changed, 82 insertions, 0 deletions
diff --git a/NetworkPkg/HttpDxe/HttpUtilities.h b/NetworkPkg/HttpDxe/HttpUtilities.h
new file mode 100644
index 0000000..bd4ef0b
--- /dev/null
+++ b/NetworkPkg/HttpDxe/HttpUtilities.h
@@ -0,0 +1,82 @@
+/** @file
+ The header files of HTTP helper functions for HttpDxe driver.
+
+Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
+This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef __EFI_HTTP_UTILITIES_H__
+#define __EFI_HTTP_UTILITIES_H__
+
+/**
+ This function is used to manage the headers portion of an HTTP message by providing
+ the ability to add, remove, or replace HTTP headers.
+
+ @param[in] SeedMessageSize Size in bytes of the initial HTTP header. This can be zero.
+ @param[in] SeedMessage Initial raw unformatted HTTP header to be used as a base for
+ building a new unformatted HTTP header. If NULL, SeedMessageSize
+ is ignored. The buffer containing this message will be allocated
+ and released by the caller.
+ @param[in] DeleteCount Number of null-terminated HTTP header field names in DeleteList.
+ @param[in] DeleteList List of null-terminated HTTP header field names to remove from SeedMessage.
+ Only the field names are in this list because the field values are irrelevant
+ to this operation. If NULL, DeleteCount is ignored. The buffer containing the
+ list will be allocated and released by the caller.
+ @param[in] AppendCount Number of header fields in AppendList.
+ @param[in] AppendList List of HTTP headers to populate NewMessage with. If SeedMessage is not NULL,
+ AppendList will be appended to the existing list from SeedMessage in NewMessage.
+ @param[out] NewMessageSize Pointer to the size in bytes of the new unformatted HTTP header in NewMessage.
+ @param[out] NewMessage Pointer to a new unformatted HTTP header. The storage for this NewMessage is
+ allocated by the driver publishing this protocol, and must be freed by the caller.
+
+ @retval EFI_SUCCESS Add, remove, and replace operations succeeded.
+ @retval EFI_OUT_OF_RESOURCES Could not allocate memory for NewMessage.
+
+**/
+EFI_STATUS
+HttpUtilitiesBuild(
+ IN UINTN SeedMessageSize,
+ IN VOID *SeedMessage, OPTIONAL
+ IN UINTN DeleteCount,
+ IN CHAR8 *DeleteList[], OPTIONAL
+ IN UINTN AppendCount,
+ IN EFI_HTTP_HEADER *AppendList[], OPTIONAL
+ OUT UINTN *NewMessageSize,
+ OUT VOID **NewMessage
+ );
+
+/**
+ This function is used to transform data stored in HttpMessage into a list of fields
+ paired with their corresponding values.
+
+ @param[in] HttpMessage Contains raw unformatted HTTP header string. The buffer for this string will
+ be allocated and released by the caller.
+ @param[in] HttpMessageSize Size in bytes of raw unformatted HTTP header.
+ @param[out] HeaderFields Array of key/value header pairs. The storage for all header pairs is allocated
+ by the driver publishing this protocol, and must be freed by the caller.
+ @param[out] FieldCount Number of headers in HeaderFields.
+
+ @retval EFI_SUCCESS Parse HTTP header into array of key/value pairs succeeded.
+ @retval EFI_OUT_OF_RESOURCES Could not allocate memory for NewMessage.
+ @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
+ HttpMessage is NULL.
+ HeaderFields is NULL.
+ FieldCount is NULL.
+
+**/
+EFI_STATUS
+HttpUtilitiesParse(
+ IN CHAR8 *HttpMessage,
+ IN UINTN HttpMessageSize,
+ OUT EFI_HTTP_HEADER **HeaderFields,
+ OUT UINTN *FieldCount
+ );
+
+#endif