]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.h
MdeModulePkg/DxeHttpLib: Fix the incorrect return status if URI port is invalid
[mirror_edk2.git] / MdeModulePkg / Library / DxeHttpLib / DxeHttpLib.h
CommitLineData
558b99a6
GB
1/** @file\r
2Header file for HttpLib.\r
3\r
d3017dd9 4 Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>\r
558b99a6
GB
5 (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
6\r
7 This program and the accompanying materials\r
8 are licensed and made available under the terms and conditions of the BSD License\r
9 which accompanies this distribution. The full text of the license may be found at\r
10 http://opensource.org/licenses/bsd-license.php\r
11\r
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
14\r
15**/\r
16\r
17#ifndef _DXE_HTTP_LIB_H_\r
18#define _DXE_HTTP_LIB_H_\r
19\r
20#include <Uefi.h>\r
21#include <Library/NetLib.h>\r
22#include <Library/HttpLib.h>\r
23#include <Library/BaseLib.h>\r
24#include <Library/DebugLib.h>\r
25#include <Library/MemoryAllocationLib.h>\r
26#include <Library/UefiBootServicesTableLib.h>\r
27#include <IndustryStandard/Http11.h>\r
28#include <Protocol/HttpUtilities.h>\r
29\r
30#define BIT(x) (1 << x)\r
31\r
32#define HTTP_VERSION_CRLF_STR " HTTP/1.1\r\n"\r
33#define EMPTY_SPACE " "\r
34\r
35#define NET_IS_HEX_CHAR(Ch) \\r
36 ((('0' <= (Ch)) && ((Ch) <= '9')) || \\r
37 (('A' <= (Ch)) && ((Ch) <= 'F')) || \\r
38 (('a' <= (Ch)) && ((Ch) <= 'f')))\r
39\r
40//\r
41// Field index of the HTTP URL parse result.\r
42//\r
43#define HTTP_URI_FIELD_SCHEME 0\r
44#define HTTP_URI_FIELD_AUTHORITY 1\r
45#define HTTP_URI_FIELD_PATH 2\r
46#define HTTP_URI_FIELD_QUERY 3\r
47#define HTTP_URI_FIELD_FRAGMENT 4\r
48#define HTTP_URI_FIELD_USERINFO 5\r
49#define HTTP_URI_FIELD_HOST 6\r
50#define HTTP_URI_FIELD_PORT 7\r
51#define HTTP_URI_FIELD_MAX 8\r
52\r
d3017dd9
JW
53#define HTTP_URI_PORT_MIN_NUM 0\r
54#define HTTP_URI_PORT_MAX_NUM 65535\r
55\r
558b99a6
GB
56//\r
57// Structure to store the parse result of a HTTP URL.\r
58//\r
59typedef struct {\r
60 UINT32 Offset;\r
61 UINT32 Length;\r
62} HTTP_URL_FILED_DATA;\r
63\r
64typedef struct {\r
65 UINT16 FieldBitMap;\r
66 HTTP_URL_FILED_DATA FieldData[HTTP_URI_FIELD_MAX];\r
67} HTTP_URL_PARSER;\r
68\r
69typedef enum {\r
70 UrlParserUrlStart,\r
71 UrlParserScheme,\r
72 UrlParserSchemeColon, // ":"\r
73 UrlParserSchemeColonSlash, // ":/"\r
74 UrlParserSchemeColonSlashSlash, // "://"\r
75 UrlParserAuthority,\r
76 UrlParserAtInAuthority,\r
77 UrlParserPath,\r
78 UrlParserQueryStart, // "?"\r
79 UrlParserQuery,\r
80 UrlParserFragmentStart, // "#"\r
81 UrlParserFragment,\r
82 UrlParserUserInfo,\r
83 UrlParserHostStart, // "@"\r
84 UrlParserHost,\r
85 UrlParserHostIpv6, // "["(Ipv6 address) "]"\r
86 UrlParserPortStart, // ":"\r
87 UrlParserPort,\r
88 UrlParserStateMax\r
89} HTTP_URL_PARSE_STATE;\r
90\r
91#endif\r
92\r