]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.h
ModulePkg/DxeHttpLib: Adding Functions to HttpLib
[mirror_edk2.git] / MdeModulePkg / Library / DxeHttpLib / DxeHttpLib.h
diff --git a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.h b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.h
new file mode 100644 (file)
index 0000000..0d0ad3d
--- /dev/null
@@ -0,0 +1,89 @@
+/** @file\r
+Header file for HttpLib.\r
+\r
+  Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
+  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
+\r
+  This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef _DXE_HTTP_LIB_H_\r
+#define _DXE_HTTP_LIB_H_\r
+\r
+#include <Uefi.h>\r
+#include <Library/NetLib.h>\r
+#include <Library/HttpLib.h>\r
+#include <Library/BaseLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/MemoryAllocationLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+#include <IndustryStandard/Http11.h>\r
+#include <Protocol/HttpUtilities.h>\r
+\r
+#define BIT(x)  (1 << x)\r
+\r
+#define HTTP_VERSION_CRLF_STR  " HTTP/1.1\r\n"\r
+#define EMPTY_SPACE            " "\r
+\r
+#define NET_IS_HEX_CHAR(Ch)   \\r
+  ((('0' <= (Ch)) && ((Ch) <= '9')) ||  \\r
+   (('A' <= (Ch)) && ((Ch) <= 'F')) ||  \\r
+   (('a' <= (Ch)) && ((Ch) <= 'f')))\r
+\r
+//\r
+// Field index of the HTTP URL parse result.\r
+//\r
+#define   HTTP_URI_FIELD_SCHEME           0\r
+#define   HTTP_URI_FIELD_AUTHORITY        1\r
+#define   HTTP_URI_FIELD_PATH             2\r
+#define   HTTP_URI_FIELD_QUERY            3\r
+#define   HTTP_URI_FIELD_FRAGMENT         4\r
+#define   HTTP_URI_FIELD_USERINFO         5\r
+#define   HTTP_URI_FIELD_HOST             6\r
+#define   HTTP_URI_FIELD_PORT             7\r
+#define   HTTP_URI_FIELD_MAX              8\r
+\r
+//\r
+// Structure to store the parse result of a HTTP URL.\r
+//\r
+typedef struct {\r
+  UINT32      Offset;\r
+  UINT32      Length;\r
+} HTTP_URL_FILED_DATA;\r
+\r
+typedef struct {\r
+  UINT16                  FieldBitMap;\r
+  HTTP_URL_FILED_DATA     FieldData[HTTP_URI_FIELD_MAX];\r
+} HTTP_URL_PARSER;\r
+\r
+typedef enum {\r
+  UrlParserUrlStart,\r
+  UrlParserScheme,\r
+  UrlParserSchemeColon,            // ":"\r
+  UrlParserSchemeColonSlash,       // ":/"\r
+  UrlParserSchemeColonSlashSlash,  // "://"\r
+  UrlParserAuthority,\r
+  UrlParserAtInAuthority,\r
+  UrlParserPath,\r
+  UrlParserQueryStart,    // "?"\r
+  UrlParserQuery,\r
+  UrlParserFragmentStart, // "#"\r
+  UrlParserFragment,\r
+  UrlParserUserInfo,\r
+  UrlParserHostStart,     // "@"\r
+  UrlParserHost,\r
+  UrlParserHostIpv6,      // "["(Ipv6 address) "]"\r
+  UrlParserPortStart,     // ":"\r
+  UrlParserPort,\r
+  UrlParserStateMax\r
+} HTTP_URL_PARSE_STATE;\r
+\r
+#endif\r
+\r