]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.h
d064a98438065b72cf848fc33fc08e15ad3b5e25
[mirror_edk2.git] / MdeModulePkg / Library / DxeHttpLib / DxeHttpLib.h
1 /** @file
2 Header file for HttpLib.
3
4 Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
5 (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
6
7 SPDX-License-Identifier: BSD-2-Clause-Patent
8
9 **/
10
11 #ifndef _DXE_HTTP_LIB_H_
12 #define _DXE_HTTP_LIB_H_
13
14 #include <Uefi.h>
15 #include <Library/NetLib.h>
16 #include <Library/HttpLib.h>
17 #include <Library/BaseLib.h>
18 #include <Library/DebugLib.h>
19 #include <Library/MemoryAllocationLib.h>
20 #include <Library/UefiBootServicesTableLib.h>
21 #include <IndustryStandard/Http11.h>
22 #include <Protocol/HttpUtilities.h>
23
24 #define BIT(x) (1 << x)
25
26 #define HTTP_VERSION_CRLF_STR " HTTP/1.1\r\n"
27 #define EMPTY_SPACE " "
28
29 #define NET_IS_HEX_CHAR(Ch) \
30 ((('0' <= (Ch)) && ((Ch) <= '9')) || \
31 (('A' <= (Ch)) && ((Ch) <= 'F')) || \
32 (('a' <= (Ch)) && ((Ch) <= 'f')))
33
34 //
35 // Field index of the HTTP URL parse result.
36 //
37 #define HTTP_URI_FIELD_SCHEME 0
38 #define HTTP_URI_FIELD_AUTHORITY 1
39 #define HTTP_URI_FIELD_PATH 2
40 #define HTTP_URI_FIELD_QUERY 3
41 #define HTTP_URI_FIELD_FRAGMENT 4
42 #define HTTP_URI_FIELD_USERINFO 5
43 #define HTTP_URI_FIELD_HOST 6
44 #define HTTP_URI_FIELD_PORT 7
45 #define HTTP_URI_FIELD_MAX 8
46
47 #define HTTP_URI_PORT_MAX_NUM 65535
48
49 //
50 // Structure to store the parse result of a HTTP URL.
51 //
52 typedef struct {
53 UINT32 Offset;
54 UINT32 Length;
55 } HTTP_URL_FILED_DATA;
56
57 typedef struct {
58 UINT16 FieldBitMap;
59 HTTP_URL_FILED_DATA FieldData[HTTP_URI_FIELD_MAX];
60 } HTTP_URL_PARSER;
61
62 typedef enum {
63 UrlParserUrlStart,
64 UrlParserScheme,
65 UrlParserSchemeColon, // ":"
66 UrlParserSchemeColonSlash, // ":/"
67 UrlParserSchemeColonSlashSlash, // "://"
68 UrlParserAuthority,
69 UrlParserAtInAuthority,
70 UrlParserPath,
71 UrlParserQueryStart, // "?"
72 UrlParserQuery,
73 UrlParserFragmentStart, // "#"
74 UrlParserFragment,
75 UrlParserUserInfo,
76 UrlParserHostStart, // "@"
77 UrlParserHost,
78 UrlParserHostIpv6, // "["(Ipv6 address) "]"
79 UrlParserPortStart, // ":"
80 UrlParserPort,
81 UrlParserStateMax
82 } HTTP_URL_PARSE_STATE;
83
84 #endif
85