TianoCore EDK2 master
Loading...
Searching...
No Matches
HttpBootDhcp4.h
Go to the documentation of this file.
1
11#ifndef __EFI_UEFI_HTTP_BOOT_DHCP4_H__
12#define __EFI_UEFI_HTTP_BOOT_DHCP4_H__
13
14#define HTTP_BOOT_DHCP4_OPTION_MAX_NUM 16
15#define HTTP_BOOT_DHCP4_OPTION_MAX_SIZE 312
16#define HTTP_BOOT_DHCP4_PACKET_MAX_SIZE 1472
17
18#define HTTP_BOOT_DHCP4_OPCODE_REQUEST 1
19#define HTTP_BOOT_DHCP4_OPCODE_REPLY 2
20#define HTTP_BOOT_DHCP4_MSG_TYPE_REQUEST 3
21#define HTTP_BOOT_DHCP4_MAGIC 0x63538263 // network byte order
22
23#define HTTP_BOOT_DHCP4_OVERLOAD_FILE 1
24#define HTTP_BOOT_DHCP4_OVERLOAD_SERVER_NAME 2
25
32#if defined (MDE_CPU_IA32)
33#define EFI_HTTP_BOOT_CLIENT_SYSTEM_ARCHITECTURE HTTP_CLIENT_ARCH_IA32
34#elif defined (MDE_CPU_X64)
35#define EFI_HTTP_BOOT_CLIENT_SYSTEM_ARCHITECTURE HTTP_CLIENT_ARCH_X64
36#elif defined (MDE_CPU_ARM)
37#define EFI_HTTP_BOOT_CLIENT_SYSTEM_ARCHITECTURE HTTP_CLIENT_ARCH_ARM
38#elif defined (MDE_CPU_AARCH64)
39#define EFI_HTTP_BOOT_CLIENT_SYSTEM_ARCHITECTURE HTTP_CLIENT_ARCH_AARCH64
40#elif defined (MDE_CPU_RISCV64)
41#define EFI_HTTP_BOOT_CLIENT_SYSTEM_ARCHITECTURE HTTP_CLIENT_ARCH_RISCV64
42#elif defined (MDE_CPU_EBC)
43#define EFI_HTTP_BOOT_CLIENT_SYSTEM_ARCHITECTURE HTTP_CLIENT_ARCH_EBC
44#elif defined (MDE_CPU_LOONGARCH64)
45#define EFI_HTTP_BOOT_CLIENT_SYSTEM_ARCHITECTURE HTTP_CLIENT_ARCH_LOONGARCH64
46#endif
47
56typedef enum {
57 //
58 // <IP address, IP expressed URI>
59 //
60 HttpOfferTypeDhcpIpUri,
61 //
62 // <IP address, IP expressed URI, Name-server>
63 //
64 HttpOfferTypeDhcpIpUriDns,
65 //
66 // <IP address, Domain-name expressed URI, Name-server>
67 //
68 HttpOfferTypeDhcpNameUriDns,
69 //
70 // <IP address, Name-server>
71 //
72 HttpOfferTypeDhcpDns,
73 //
74 // <IP address>
75 //
76 HttpOfferTypeDhcpOnly,
77 //
78 // <Domain-name expressed URI> or
79 // <Domain-name expressed URI, Name-server (will be ignored)>
80 //
81 HttpOfferTypeProxyNameUri,
82 //
83 // <IP expressed URI> or
84 // <IP expressed URI, Name-server (will be ignored)>
85 //
86 HttpOfferTypeProxyIpUri,
87 //
88 // <IP address, Domain-name expressed URI>
89 //
90 HttpOfferTypeDhcpNameUri,
91 HttpOfferTypeMax
93
94#define HTTP_BOOT_DHCP_RETRIES 4
95#define HTTP_BOOT_OFFER_MAX_NUM 16
96
97// The array index of the DHCP4 option tag interested
98//
99#define HTTP_BOOT_DHCP4_TAG_INDEX_BOOTFILE_LEN 0
100#define HTTP_BOOT_DHCP4_TAG_INDEX_OVERLOAD 1
101#define HTTP_BOOT_DHCP4_TAG_INDEX_MSG_TYPE 2
102#define HTTP_BOOT_DHCP4_TAG_INDEX_SERVER_ID 3
103#define HTTP_BOOT_DHCP4_TAG_INDEX_CLASS_ID 4
104#define HTTP_BOOT_DHCP4_TAG_INDEX_BOOTFILE 5
105#define HTTP_BOOT_DHCP4_TAG_INDEX_DNS_SERVER 6
106#define HTTP_BOOT_DHCP4_TAG_INDEX_MAX 7
107
108#pragma pack(1)
109
110typedef struct {
111 UINT8 ParaList[135];
113
114typedef struct {
115 UINT16 Size;
117
118typedef struct {
119 UINT8 Type;
120 UINT8 MajorVer;
121 UINT8 MinorVer;
123
124typedef struct {
125 UINT8 Type;
127
128typedef struct {
129 UINT16 Type;
131
132typedef struct {
133 UINT8 ClassIdentifier[11];
134 UINT8 ArchitecturePrefix[5];
135 UINT8 ArchitectureType[5];
136 UINT8 Lit3[1];
137 UINT8 InterfaceName[4];
138 UINT8 Lit4[1];
139 UINT8 UndiMajor[3];
140 UINT8 UndiMinor[3];
142
143typedef struct {
144 UINT8 Type;
145 UINT8 Guid[16];
147
148typedef struct {
149 UINT16 Type;
150 UINT16 Layer;
152
153#pragma pack()
154
155typedef union {
164
165#define GET_NEXT_DHCP_OPTION(Opt) \
166 (EFI_DHCP4_PACKET_OPTION *) ((UINT8 *) (Opt) + \
167 sizeof (EFI_DHCP4_PACKET_OPTION) + (Opt)->Length - 1)
168
169#define GET_OPTION_BUFFER_LEN(Pkt) \
170 ((Pkt)->Length - sizeof (EFI_DHCP4_HEADER) - 4)
171
172#define DEFAULT_CLASS_ID_DATA "HTTPClient:Arch:xxxxx:UNDI:003000"
173#define DEFAULT_UNDI_TYPE 1
174#define DEFAULT_UNDI_MAJOR 3
175#define DEFAULT_UNDI_MINOR 0
176
177typedef struct {
178 UINT32 Reserved;
180
181#define HTTP_CACHED_DHCP4_PACKET_MAX_SIZE (OFFSET_OF (EFI_DHCP4_PACKET, Dhcp4) + HTTP_BOOT_DHCP4_PACKET_MAX_SIZE)
182
183typedef union {
184 EFI_DHCP4_PACKET Offer;
186 UINT8 Buffer[HTTP_CACHED_DHCP4_PACKET_MAX_SIZE];
188
189typedef struct {
190 //
191 // URI component
192 //
193 CHAR8 *Scheme;
194 CHAR8 *Authority;
195 CHAR8 *Path;
196 CHAR8 *Query;
197 CHAR8 *Fragment;
198
199 CHAR8 *RegName;
200 BOOLEAN AddrIsOk;
201 EFI_IP_ADDRESS Address;
202 UINT16 Port;
204
205typedef struct {
207 HTTP_BOOT_OFFER_TYPE OfferType;
208 VOID *UriParser;
209 EFI_DHCP4_PACKET_OPTION *OptList[HTTP_BOOT_DHCP4_TAG_INDEX_MAX];
211
218VOID
221 );
222
235 );
236
251 IN HTTP_BOOT_PRIVATE_DATA *Private,
252 IN UINTN DataLength,
253 IN VOID *DnsServerData
254 );
255
256#endif
UINT64 UINTN
VOID HttpBootSelectDhcpOffer(IN HTTP_BOOT_PRIVATE_DATA *Private)
EFI_STATUS HttpBootDhcp4Dora(IN HTTP_BOOT_PRIVATE_DATA *Private)
EFI_STATUS HttpBootRegisterIp4Dns(IN HTTP_BOOT_PRIVATE_DATA *Private, IN UINTN DataLength, IN VOID *DnsServerData)
HTTP_BOOT_OFFER_TYPE
Definition: HttpBootDhcp4.h:56
#define IN
Definition: Base.h:279
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
BOOLEAN AddrIsOk
Point to somewhere in Authority.
CHAR8 * RegName
TODO: may not required in HTTP URL.