TianoCore EDK2 master
Loading...
Searching...
No Matches
DxeHttpLib.h
Go to the documentation of this file.
1
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>
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//
52typedef struct {
53 UINT32 Offset;
54 UINT32 Length;
56
57typedef struct {
58 UINT16 FieldBitMap;
59 HTTP_URL_FILED_DATA FieldData[HTTP_URI_FIELD_MAX];
61
62typedef 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